Skip to content

Commit b731dbe

Browse files
authored
Merge pull request #1 from edinstance/migrate-to-github-actions
2 parents b918f5a + 7e8c12e commit b731dbe

33 files changed

Lines changed: 289 additions & 134 deletions

File tree

.github/workflows/backend.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Backend Lint and Unit Tests
2+
3+
on:
4+
pull_request:
5+
workflow_dispatch:
6+
7+
env:
8+
TEST_COGNITO_JWT_URL: ${{ secrets.TEST_COGNITO_JWT_URL }}
9+
10+
jobs:
11+
lint-backend:
12+
runs-on: ubuntu-latest
13+
container:
14+
image: maven:3.9.9-amazoncorretto-21-alpine
15+
16+
defaults:
17+
run:
18+
working-directory: ./backend/application/
19+
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v4
23+
24+
- name: Run backend linting (Checkstyle)
25+
run: |
26+
echo "Running backend linting..."
27+
mvn -f ./backendService/pom.xml clean checkstyle:check
28+
echo "Backend linting passed"
29+
30+
unit-test-backend:
31+
runs-on: ubuntu-latest
32+
needs: lint-backend
33+
container:
34+
image: maven:3.9.9-amazoncorretto-21-alpine
35+
36+
defaults:
37+
run:
38+
working-directory: ./backend/application/
39+
40+
steps:
41+
- name: Checkout code
42+
uses: actions/checkout@v4
43+
44+
- name: Prepare application.yml for tests
45+
run: |
46+
echo "Copying the test-application.yml into a application.yml file..."
47+
cp ./backendService/src/main/resources/test-application.example.yml ./backendService/src/main/resources/application.yml
48+
cp ./backendService/src/test/resources/application.example.yml ./backendService/src/test/resources/application.yml
49+
echo "Copying completed"
50+
51+
- name: Run unit tests
52+
run: |
53+
echo "Running unit tests..."
54+
mvn -f ./backendService/pom.xml clean test -DTEST_COGNITO_JWT_URL=$TEST_COGNITO_JWT_URL
55+
echo "Unit tests passed"

.github/workflows/frontend.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Lint and Test Frontend
2+
on:
3+
pull_request:
4+
workflow_dispatch:
5+
6+
jobs:
7+
lint-frontend:
8+
runs-on: ubuntu-latest
9+
defaults:
10+
run:
11+
working-directory: ./frontend
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
17+
- name: Setup Node.js
18+
uses: actions/setup-node@v4
19+
with:
20+
node-version: 20.x
21+
22+
- name: Install dependencies
23+
run: npm ci
24+
25+
- name: Set environment variables
26+
run: |
27+
echo "API_KEY=Test" >> $GITHUB_ENV
28+
29+
- name: Lint frontend
30+
run: npm run lint
31+
32+
component-tests:
33+
runs-on: ubuntu-latest
34+
needs: lint-frontend
35+
defaults:
36+
run:
37+
working-directory: ./frontend
38+
39+
steps:
40+
- name: Checkout code
41+
uses: actions/checkout@v4
42+
43+
- name: Setup Node.js
44+
uses: actions/setup-node@v4
45+
with:
46+
node-version: 20.x
47+
48+
- name: Install dependencies
49+
run: npm ci
50+
51+
- name: Set test environment variables
52+
run: |
53+
echo "API_KEY=Test" >> $GITHUB_ENV
54+
55+
- name: Cypress.io component tests
56+
uses: cypress-io/github-action@v6.5.0
57+
with:
58+
working-directory: ./frontend
59+
command: npm run cy:run:ct
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Infrastructure Lint
2+
on:
3+
pull_request:
4+
5+
jobs:
6+
lint-and-security-scan-infrastructure:
7+
runs-on: ubuntu-latest
8+
9+
defaults:
10+
run:
11+
working-directory: ./infrastructure
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
17+
- name: Setup TFLint
18+
uses: terraform-linters/setup-tflint@v4.1.1
19+
20+
- name: Initialise TFLint
21+
run: tflint --init
22+
23+
- name: Run TFLint
24+
run: tflint --recursive

.gitlab-ci.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.

CICD/gitlab/backend.yml

Lines changed: 0 additions & 31 deletions
This file was deleted.

CICD/gitlab/frontend.yml

Lines changed: 0 additions & 34 deletions
This file was deleted.

CICD/gitlab/terraform.yml

Lines changed: 0 additions & 13 deletions
This file was deleted.

frontend/src/app/api/billing/payments/route.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// File: app/api/billing/subscriptions/route.ts (for App Router)
21
import stripe from "@/utils/stripe";
32
import { NextRequest, NextResponse } from "next/server";
43

frontend/src/app/api/billing/subscriptions/route.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// File: app/api/billing/subscriptions/route.ts (for App Router)
21
import stripe, { findExistingSubscriptionByCustomerId } from "@/utils/stripe";
32
import { NextRequest, NextResponse } from "next/server";
43
import Stripe from "stripe";

frontend/src/components/ui/Sidebar.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,10 @@ export function Sidebar() {
4242

4343
const userBilling = useQuery(GET_USER_BILLING);
4444
const accountId = userBilling.data?.getUserBilling?.accountId;
45-
45+
4646
// Filter out the Items page from sidebar links if no account ID exists
47-
const filteredSidebarLinks = sidebarLinks.filter(link =>
48-
link.name !== "Items" || accountId
47+
const filteredSidebarLinks = sidebarLinks.filter(
48+
(link) => link.name !== "Items" || accountId,
4949
);
5050

5151
return (

0 commit comments

Comments
 (0)