Skip to content

Commit fd9f7d8

Browse files
authored
Merge pull request #17 from bcgov/feat/ecr
chore: multiple enhancements
2 parents be174d0 + 700d9e3 commit fd9f7d8

24 files changed

+3499
-3174
lines changed

.github/workflows/.deployer.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ env:
4949
jobs:
5050
infra:
5151
environment: ${{ inputs.environment_name }}
52-
name: Terraform ${{inputs.command}}
52+
name: Terraform ${{inputs.command}} ${{inputs.working_directory}} ${{inputs.environment_name}}
5353
runs-on: ubuntu-24.04
5454
outputs:
5555
API_GW_URL: ${{ steps.tg-outputs.outputs.API_GW_URL }}

.github/workflows/.load-test.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Load tests
2+
on:
3+
workflow_call:
4+
inputs:
5+
BACKEND_URL:
6+
description: 'The URL of the backend to test'
7+
required: true
8+
type: string
9+
FRONTEND_URL:
10+
description: 'The URL of the frontend to test'
11+
required: true
12+
type: string
13+
jobs:
14+
load-tests:
15+
name: Load
16+
env:
17+
BACKEND_URL: ${{inputs.BACKEND_URL}}
18+
FRONTEND_URL: ${{inputs.FRONTEND_URL}}
19+
runs-on: ubuntu-24.04
20+
strategy:
21+
matrix:
22+
name: [backend, frontend]
23+
steps:
24+
- uses: actions/checkout@v4
25+
- uses: grafana/setup-k6-action@v1
26+
- uses: grafana/run-k6-action@v1
27+
with:
28+
path: ./tests/load/${{ matrix.name }}-test.js
29+
flags: --vus 10 --duration 30s

.github/workflows/.tests.yml

Lines changed: 76 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,69 @@ on:
1111
permissions:
1212
contents: write # This is required for actions/checkout
1313
jobs:
14+
tests:
15+
name: Tests
16+
if: ${{ ! github.event.pull_request.draft }}
17+
runs-on: ubuntu-24.04
18+
timeout-minutes: 5
19+
services:
20+
postgres:
21+
image: postgres
22+
env:
23+
POSTGRES_PASSWORD: postgres
24+
options: >-
25+
--health-cmd pg_isready
26+
--health-interval 10s
27+
--health-timeout 5s
28+
--health-retries 5
29+
ports:
30+
- 5432:5432
31+
strategy:
32+
matrix:
33+
dir: [backend, frontend]
34+
include:
35+
- dir: backend
36+
token: SONAR_TOKEN_BACKEND
37+
- dir: frontend
38+
token: SONAR_TOKEN_FRONTEND
39+
steps:
40+
- uses: bcgov-nr/action-test-and-analyse@v1.2.1
41+
with:
42+
commands: |
43+
npm ci
44+
npm run test:cov
45+
dir: ${{ matrix.dir }}
46+
node_version: "22"
47+
sonar_args: >
48+
-Dsonar.exclusions=**/coverage/**,**/node_modules/**,**/*spec.ts
49+
-Dsonar.organization=bcgov-sonarcloud
50+
-Dsonar.projectKey=quickstart-openshift_${{ matrix.dir }}
51+
-Dsonar.sources=src
52+
-Dsonar.tests.inclusions=**/*spec.ts
53+
-Dsonar.javascript.lcov.reportPaths=./coverage/lcov.info
54+
sonar_token: ${{ secrets[matrix.token] }}
55+
triggers: ('${{ matrix.dir }}/')
56+
trivy:
57+
name: Trivy Security Scan
58+
if: ${{ ! github.event.pull_request.draft }}
59+
runs-on: ubuntu-24.04
60+
timeout-minutes: 1
61+
steps:
62+
- uses: actions/checkout@v4
63+
- name: Run Trivy vulnerability scanner in repo mode
64+
uses: aquasecurity/trivy-action@0.29.0
65+
with:
66+
format: "sarif"
67+
output: "trivy-results.sarif"
68+
ignore-unfixed: true
69+
scan-type: "fs"
70+
scanners: "vuln,secret,config"
71+
severity: "CRITICAL,HIGH"
72+
73+
- name: Upload Trivy scan results to GitHub Security tab
74+
uses: github/codeql-action/upload-sarif@v3
75+
with:
76+
sarif_file: "trivy-results.sarif"
1477
e2e:
1578
name: E2E Tests
1679
runs-on: ubuntu-24.04
@@ -24,6 +87,13 @@ jobs:
2487
FRONTEND_IMAGE: ghcr.io/${{ github.repository }}/frontend:${{ inputs.tag }}
2588
run: docker compose up -d --wait
2689
continue-on-error: true
90+
- name: Cache Playwright Browsers
91+
uses: actions/cache@v4
92+
id: playwright-cache
93+
with:
94+
path: |
95+
~/.cache/ms-playwright
96+
key: ${{ runner.os }}-playwright-${{ hashFiles('**/package-lock.json') }}
2797
- uses: actions/setup-node@v4
2898
name: Setup Node
2999
with:
@@ -36,7 +106,12 @@ jobs:
36106
working-directory: frontend
37107
run: |
38108
npm ci
39-
npx playwright install --with-deps
109+
- run: npx @playwright/test install --with-deps
110+
if: steps.playwright-cache.outputs.cache-hit != 'true'
111+
working-directory: ./frontend
112+
- run: npx @playwright/test install-deps
113+
if: steps.playwright-cache.outputs.cache-hit == 'true'
114+
working-directory: ./frontend
40115
- name: Run Tests
41116
working-directory: frontend
42117
env:

.github/workflows/merge.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,3 +89,10 @@ jobs:
8989
aws s3 sync --delete ./dist s3://$(echo "$S3_BUCKET_ARN" | cut -d: -f6)
9090
aws cloudfront create-invalidation --distribution-id $CF_DISTRIBUTION_ID --paths "/*"
9191
92+
load-test:
93+
needs: [deploy-api, build-ui, deploy-cloudfront]
94+
name: Load Test
95+
uses: ./.github/workflows/.load-test.yml
96+
with:
97+
BACKEND_URL: ${{ needs.deploy-api.outputs.API_GW_URL }}/api
98+
FRONTEND_URL: https://${{ needs.deploy-cloudfront.outputs.CF_DOMAIN }}

.github/workflows/pr-open.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ jobs:
6767
app_env: ephermal-${{ github.event.number }}
6868
secrets: inherit
6969

70-
tests-e2e:
70+
tests:
7171
name: Tests
7272
needs: builds
7373
uses: ./.github/workflows/.tests.yml

0 commit comments

Comments
 (0)