-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aef4d74
commit a7d7ea8
Showing
81 changed files
with
94 additions
and
8,215 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,61 +6,23 @@ on: | |
pull_request: | ||
types: [opened, reopened, synchronize, ready_for_review] | ||
schedule: | ||
- cron: "0 12 * * 0" # 4 AM PST = 12 PM UDT, runs sundays | ||
- cron: "0 11 * * 0" # 3 AM PST = 12 PM UDT, runs sundays | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
CodeQL: | ||
codeql: | ||
name: CodeQL | ||
if: github.event_name != 'pull_request' || !github.event.pull_request.draft | ||
runs-on: ubuntu-22.04 | ||
strategy: | ||
matrix: | ||
language: [go, java, javascript, python] | ||
include: | ||
- language: go | ||
working-directory: backend-go | ||
build: | | ||
sed -i '/^toolchain .*$/d' go.mod | ||
go install github.com/swaggo/swag/cmd/swag@latest | ||
CGO_ENABLED=0 GOOS=linux go build -v | ||
- language: "java" | ||
working-directory: backend-java | ||
build: ./mvnw package -DskipTests | ||
- language: "javascript" | ||
- language: "python" | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: github/codeql-action/init@v2 | ||
with: | ||
languages: ${{ matrix.language }} | ||
|
||
- name: Autobuild | ||
if: ${{ ! matrix.build }} | ||
uses: github/codeql-action/autobuild@v2 | ||
|
||
- uses: actions/setup-java@v3 | ||
if: ${{ matrix.build && matrix.language == 'java' }} | ||
with: | ||
distribution: "temurin" | ||
java-version: "17" | ||
|
||
- uses: actions/cache@v3 | ||
if: ${{ matrix.build && matrix.language == 'java' }} | ||
with: | ||
path: ~/.m2/repository | ||
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} | ||
restore-keys: | | ||
${{ runner.os }}-maven- | ||
- name: Build | ||
if: ${{ matrix.build }} | ||
run: ${{ matrix.build }} | ||
working-directory: ${{ matrix.working-directory }} | ||
languages: javascript | ||
|
||
- name: Perform CodeQL Analysis | ||
uses: github/codeql-action/analyze@v2 | ||
|
@@ -74,7 +36,6 @@ jobs: | |
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Run Trivy vulnerability scanner in repo mode | ||
uses: aquasecurity/[email protected] | ||
with: | ||
|
@@ -89,3 +50,51 @@ jobs: | |
uses: github/codeql-action/upload-sarif@v2 | ||
with: | ||
sarif_file: "trivy-results.sarif" | ||
|
||
tests: | ||
name: Tests | ||
if: github.event_name != 'pull_request' || !github.event.pull_request.draft | ||
runs-on: ubuntu-22.04 | ||
services: | ||
postgres: | ||
image: postgres | ||
env: | ||
POSTGRES_DB: postgres | ||
POSTGRES_USER: postgres | ||
POSTGRES_PASSWORD: postgres | ||
options: >- | ||
--health-cmd pg_isready | ||
--health-interval 10s | ||
--health-timeout 5s | ||
--health-retries 5 | ||
ports: | ||
- 5432:5432 | ||
strategy: | ||
matrix: | ||
dir: [backend, frontend] | ||
include: | ||
- dir: backend | ||
sonar_projectKey: quickstart-openshift_backend | ||
token: SONAR_TOKEN_BACKEND | ||
triggers: ('backend/') | ||
- dir: frontend | ||
sonar_projectKey: quickstart-openshift_frontend | ||
token: SONAR_TOKEN_FRONTEND | ||
triggers: ('frontend/') | ||
steps: | ||
- uses: bcgov-nr/[email protected] | ||
with: | ||
commands: | | ||
npm ci | ||
npm run test:cov | ||
dir: ${{ matrix.dir }} | ||
node_version: "20" | ||
sonar_args: > | ||
-Dsonar.exclusions=**/coverage/**,**/node_modules/**,**/*spec.ts | ||
-Dsonar.organization=bcgov-sonarcloud | ||
-Dsonar.projectKey=${{ matrix.sonar_projectKey }} | ||
-Dsonar.sources=src | ||
-Dsonar.tests.inclusions=**/*spec.ts | ||
-Dsonar.javascript.lcov.reportPaths=./coverage/lcov.info | ||
sonar_token: ${{ secrets[matrix.token] }} | ||
triggers: ${{ matrix.triggers }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,14 +19,7 @@ jobs: | |
issues: write | ||
strategy: | ||
matrix: | ||
name: | ||
- init | ||
- database | ||
- backend | ||
- backend-go | ||
- backend-java | ||
- backend-py | ||
- frontend | ||
name: [init, database, backend, frontend] | ||
include: | ||
- name: init | ||
file: common/openshift.init.yml | ||
|
@@ -36,20 +29,9 @@ jobs: | |
overwrite: false | ||
- name: backend | ||
file: backend/openshift.deploy.yml | ||
parameters: -p PROMOTE_MIGRATION=${{ github.repository }}/database-migrations:test | ||
parameters: -p PROMOTE_MIGRATION=${{ github.repository }}/migrations:test | ||
overwrite: true | ||
verification_path: /api | ||
- name: backend-go | ||
file: backend-go/openshift.deploy.yml | ||
overwrite: true | ||
parameters: -p PROMOTE_MIGRATION=${{ github.repository }}/database-migrations-go:test | ||
- name: backend-java | ||
file: backend-java/openshift.deploy.yml | ||
overwrite: true | ||
- name: backend-py | ||
file: backend-py/openshift.deploy.yml | ||
overwrite: true | ||
parameters: -p PROMOTE_MIGRATION=${{ github.repository }}/database-migrations-py:test | ||
- name: frontend | ||
file: frontend/openshift.deploy.yml | ||
overwrite: true | ||
|
@@ -77,32 +59,15 @@ jobs: | |
run: | ||
working-directory: integration-tests | ||
runs-on: ubuntu-22.04 | ||
strategy: | ||
matrix: | ||
name: [quarkus, nest, fiber, fastapi] | ||
include: | ||
- name: quarkus | ||
baseUrl: https://quickstart-openshift-test-backend-java.apps.silver.devops.gov.bc.ca | ||
- name: nest | ||
baseUrl: https://quickstart-openshift-test-backend.apps.silver.devops.gov.bc.ca | ||
- name: fiber | ||
baseUrl: https://quickstart-openshift-test-backend-go.apps.silver.devops.gov.bc.ca | ||
- name: fastapi | ||
baseUrl: https://quickstart-openshift-test-backend-py.apps.silver.devops.gov.bc.ca | ||
steps: | ||
- uses: actions/checkout@v4 | ||
name: Checkout | ||
- name: Cache node modules | ||
id: cache-npm | ||
- id: cache-npm | ||
uses: actions/cache@v3 | ||
env: | ||
cache-name: cache-node-modules | ||
with: | ||
# npm cache files are stored in `~/.npm` on Linux/macOS | ||
path: ~/.npm | ||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | ||
key: ${{ runner.os }}-build-cache-node-modules-${{ hashFiles('**/package-lock.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-build-${{ env.cache-name }}- | ||
${{ runner.os }}-build-cache-node-modules- | ||
${{ runner.os }}-build- | ||
${{ runner.os }}- | ||
- if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }} | ||
|
@@ -112,7 +77,7 @@ jobs: | |
- name: Install dependencies | ||
run: npm ci | ||
- name: Run integration tests | ||
run: BASE_URL=${{ matrix.baseUrl }} API_NAME=${{ matrix.name }} node src/main.js | ||
run: BASE_URL=https://quickstart-openshift-test-backend.apps.silver.devops.gov.bc.ca API_NAME=nest node src/main.js | ||
|
||
cypress-e2e: | ||
name: Cypress end to end test | ||
|
@@ -126,17 +91,13 @@ jobs: | |
browser: [chrome, firefox, edge] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
name: Checkout | ||
- name: Cache node modules | ||
id: cache-npm | ||
- id: cache-npm | ||
uses: actions/cache@v3 | ||
env: | ||
cache-name: cache-node-modules | ||
with: # npm cache files are stored in `~/.npm` on Linux/macOS | ||
with: | ||
path: ~/.npm | ||
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | ||
key: ${{ runner.os }}-build-cache-node-modules-${{ hashFiles('**/package-lock.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-build-${{ env.cache-name }}- | ||
${{ runner.os }}-build-cache-node-modules- | ||
${{ runner.os }}-build- | ||
${{ runner.os }}- | ||
- if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }} | ||
|
@@ -161,16 +122,7 @@ jobs: | |
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
name: | ||
- frontend | ||
- backend | ||
- backend-go | ||
- backend-py | ||
- backend-java | ||
- database | ||
- database-migrations | ||
- database-migrations-go | ||
- database-migrations-py | ||
name: [database, migrations, backend, frontend] | ||
steps: | ||
- name: Keep last 50 | ||
uses: actions/delete-package-versions@v4 | ||
|
@@ -187,41 +139,22 @@ jobs: | |
runs-on: ubuntu-22.04 | ||
strategy: | ||
matrix: | ||
name: | ||
- backend | ||
- database | ||
- frontend | ||
- init | ||
- backend-py | ||
- backend-java | ||
- backend-go | ||
name: [init, database, backend, frontend] | ||
include: | ||
- name: init | ||
file: common/openshift.init.yml | ||
overwrite: false | ||
- name: database | ||
file: database/openshift.deploy.yml | ||
overwrite: false | ||
- name: backend | ||
file: backend/openshift.deploy.yml | ||
parameters: -p PROMOTE_MIGRATION=${{ github.repository }}/database-migrations:test | ||
parameters: -p PROMOTE_MIGRATION=${{ github.repository }}/migrations:test | ||
overwrite: true | ||
verification_path: /api | ||
- name: database | ||
file: database/openshift.deploy.yml | ||
overwrite: false | ||
- name: frontend | ||
file: frontend/openshift.deploy.yml | ||
overwrite: true | ||
- name: init | ||
file: common/openshift.init.yml | ||
overwrite: false | ||
- name: backend-py | ||
file: backend-py/openshift.deploy.yml | ||
overwrite: true | ||
parameters: -p PROMOTE_MIGRATION=${{ github.repository }}/database-migrations-py:test | ||
- name: backend-java | ||
file: backend-java/openshift.deploy.yml | ||
overwrite: true | ||
- name: backend-go | ||
file: backend-go/openshift.deploy.yml | ||
overwrite: true | ||
parameters: -p PROMOTE_MIGRATION=${{ github.repository }}/database-migrations-go:test | ||
|
||
steps: | ||
- uses: bcgov-nr/[email protected] | ||
with: | ||
|
@@ -244,13 +177,7 @@ jobs: | |
packages: write | ||
strategy: | ||
matrix: | ||
component: | ||
- backend | ||
- database | ||
- frontend | ||
- backend-py | ||
- backend-java | ||
- backend-go | ||
component: [database, backend, frontend] | ||
steps: | ||
- uses: shrink/actions-docker-registry-tag@v3 | ||
with: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.