-
Notifications
You must be signed in to change notification settings - Fork 0
Move gitlab cicd to github actions #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
0a756c4
c4aaf39
538b941
bd51c41
2276872
604885a
d0d3c18
d37b825
5a49835
aa6e11c
7e8c12e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| name: Backend Lint and Unit Tests | ||
|
|
||
| on: | ||
| pull_request: | ||
| workflow_dispatch: | ||
|
|
||
| env: | ||
| TEST_COGNITO_JWT_URL: ${{ secrets.TEST_COGNITO_JWT_URL }} | ||
|
|
||
| jobs: | ||
| lint-backend: | ||
| runs-on: ubuntu-latest | ||
| container: | ||
| image: maven:3.9.9-amazoncorretto-21-alpine | ||
|
|
||
| defaults: | ||
| run: | ||
| working-directory: ./backend/application/ | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Run backend linting (Checkstyle) | ||
| run: | | ||
| echo "Running backend linting..." | ||
| mvn -f ./backendService/pom.xml clean checkstyle:check | ||
| echo "Backend linting passed" | ||
|
|
||
| unit-test-backend: | ||
| runs-on: ubuntu-latest | ||
| needs: lint-backend | ||
| container: | ||
| image: maven:3.9.9-amazoncorretto-21-alpine | ||
|
|
||
| defaults: | ||
| run: | ||
| working-directory: ./backend/application/ | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Prepare application.yml for tests | ||
| run: | | ||
| echo "Copying the test-application.yml into a application.yml file..." | ||
| cp ./backendService/src/main/resources/test-application.example.yml ./backendService/src/main/resources/application.yml | ||
| cp ./backendService/src/test/resources/application.example.yml ./backendService/src/test/resources/application.yml | ||
| echo "Copying completed" | ||
|
|
||
| - name: Run unit tests | ||
| run: | | ||
| echo "Running unit tests..." | ||
| mvn -f ./backendService/pom.xml clean test -DTEST_COGNITO_JWT_URL=$TEST_COGNITO_JWT_URL | ||
| echo "Unit tests passed" |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| name: Lint and Test Frontend | ||
| on: | ||
| pull_request: | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| lint-frontend: | ||
| runs-on: ubuntu-latest | ||
| defaults: | ||
| run: | ||
| working-directory: ./frontend | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 20.x | ||
|
|
||
| - name: Install dependencies | ||
| run: npm ci | ||
|
|
||
| - name: Set environment variables | ||
| run: | | ||
| echo "API_KEY=Test" >> $GITHUB_ENV | ||
|
|
||
| - name: Lint frontend | ||
| run: npm run lint | ||
|
|
||
| component-tests: | ||
| runs-on: ubuntu-latest | ||
| needs: lint-frontend | ||
| defaults: | ||
| run: | ||
| working-directory: ./frontend | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 20.x | ||
|
|
||
| - name: Install dependencies | ||
| run: npm ci | ||
|
|
||
| - name: Set test environment variables | ||
| run: | | ||
| echo "API_KEY=Test" >> $GITHUB_ENV | ||
|
|
||
| - name: Cypress.io component tests | ||
| uses: cypress-io/github-action@v6.5.0 | ||
| with: | ||
| working-directory: ./frontend | ||
| command: npm run cy:run:ct |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| name: Infrastructure Lint | ||
| on: | ||
| pull_request: | ||
|
|
||
| jobs: | ||
| lint-and-security-scan-infrastructure: | ||
| runs-on: ubuntu-latest | ||
|
|
||
| defaults: | ||
| run: | ||
| working-directory: ./infrastructure | ||
|
|
||
| steps: | ||
| - name: Checkout code | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup TFLint | ||
| uses: terraform-linters/setup-tflint@v4.1.1 | ||
|
|
||
| - name: Initialise TFLint | ||
| run: tflint --init | ||
|
|
||
| - name: Run TFLint | ||
| run: tflint --recursive |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| terraform { | ||
| required_version = ">= 1.9" | ||
| required_providers { | ||
| aws = { | ||
| source = "hashicorp/aws" | ||
| version = ">= 5.60.0" | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| terraform { | ||
| required_version = ">= 1.9" | ||
| required_providers { | ||
| aws = { | ||
| source = "hashicorp/aws" | ||
| version = ">= 5.60.0" | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| terraform { | ||
| required_version = ">= 1.9" | ||
| required_providers { | ||
| aws = { | ||
| source = "hashicorp/aws" | ||
| version = ">= 5.60.0" | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| terraform { | ||
| required_version = ">= 1.9" | ||
| required_providers { | ||
| aws = { | ||
| source = "hashicorp/aws" | ||
| version = ">= 5.60.0" | ||
| } | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| terraform { | ||
| required_version = ">= 1.9" | ||
| required_providers { | ||
| aws = { | ||
| source = "hashicorp/aws" | ||
| version = ">= 5.60.0" | ||
| } | ||
| } | ||
| } | ||
|
Comment on lines
+1
to
+9
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Tighten Terraform & provider version constraints terraform {
required_version = "~> 1.9"
required_providers {
aws = {
source = "hashicorp/aws"
- version = ">= 5.60.0"
+ version = "~> 5.60.0"
}
}
}This prevents unintended upgrades beyond the tested provider series. 🤖 Prompt for AI Agents |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Verification agent
🧩 Analysis chain
Excellent security improvement!
Moving from a hardcoded secret key to an environment variable is a significant security enhancement. The existing validation on lines 3-5 ensures the application fails fast if the environment variable isn't configured.
However, please ensure that
STRIPE_SECRET_KEYis properly configured in your new GitHub Actions workflows.🏁 Script executed:
Length of output: 213
🏁 Script executed:
Length of output: 220
Missing STRIPE_SECRET_KEY in GitHub Actions workflows
I re-ran a search across
.github/workflowsand found no references toSTRIPE_SECRET_KEY. Without this in your workflows, jobs that initialise Stripe will fail at runtime.• Add
STRIPE_SECRET_KEYas a repository secret in GitHub.• Update your workflow YAML files under
.github/workflows/*.yml, for example:🤖 Prompt for AI Agents