Skip to content

Commit

Permalink
Simplified workflow, single task, maximum gain
Browse files Browse the repository at this point in the history
  • Loading branch information
friedbyalice committed Mar 15, 2024
1 parent fcc5e13 commit 80dcc59
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 41 deletions.
44 changes: 7 additions & 37 deletions .github/workflows/fullstack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,25 @@ name: Test
on:
push:
branches:
- main
- dev
- '*'
pull_request:
branches:
- main
- dev
- '*'

jobs:
tests:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 20

- uses: pnpm/action-setup@v2
- uses: pnpm/action-setup@v3
name: Install pnpm
id: pnpm-install
with:
Expand All @@ -36,7 +34,7 @@ jobs:
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
Expand All @@ -55,19 +53,9 @@ jobs:

- name: Run shared unit tests
run: pnpm --filter shared test:cov
- name: Upload shared test coverage report
uses: actions/upload-artifact@v3
with:
name: shared-report
path: ./coverage/shared/lcov.info

- name: Run api unit tests
run: pnpm --filter api test:cov
- name: Upload api unit test coverage report
uses: actions/upload-artifact@v3
with:
name: api-unit-report
path: ./coverage/api/lcov.info

- name: Run api e2e tests
env:
Expand All @@ -78,25 +66,7 @@ jobs:
AUTH0_AUDIENCE: ${{ secrets.TEST_AUTH0_AUDIENCE }}
AUTH0_CLIENT_ID: ${{ secrets.TEST_AUTH0_CLIENT_ID }}
AUTH0_CLIENT_SECRET: ${{ secrets.TEST_AUTH0_CLIENT_SECRET }}
run: pnpm --filter api test:e2e
- name: Upload api E2E test coverage report
uses: actions/upload-artifact@v3
with:
name: api-e2e-report
path: ./coverage/api/lcov.info

sonarcloud:
name: SonarCloud Analysis
runs-on: ubuntu-latest
needs: [tests]
steps:

- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Download artifacts
uses: actions/download-artifact@v3
run: pnpm --filter api test-e2e:cov

- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
Expand Down
3 changes: 2 additions & 1 deletion api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"test:watch": "jest --watch",
"test:cov": "jest -i --verbose --coverage",
"test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand",
"test:e2e": "jest --verbose --config ./test/jest-e2e.json --coverage",
"test-e2e": "jest --verbose --config ./test/jest-e2e.json",
"test-e2e:cov": "jest --verbose --config ./test/jest-e2e.json --coverage --coverageDirectory=../coverage/api-e2e",
"typeorm": "typeorm-ts-node-commonjs",
"clean": "rimraf dist"
},
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"clean": "pnpm --filter frontend clean && pnpm --filter api clean",
"format": "pnpm --filter shared format & pnpm --filter frontend format & pnpm --filter api format",
"format-check": "pnpm --filter shared format-check && pnpm --filter frontend format-check && pnpm --filter api format-check",
"test": "pnpm --filter api test && pnpm --filter shared test"
"test": "pnpm --filter api test && pnpm --filter shared test && pnpm --filter api test-e2e"
},
"keywords": [],
"author": "",
Expand Down
4 changes: 2 additions & 2 deletions sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ sonar.projectKey=MuNuChapterHKN_HKrecruitment
sonar.organization=munuchapterhkn
sonar.projectName=HKrecruitment

sonar.javascript.lcov.reportPaths=./api-e2e-report/lcov.info, ./api-unit-report/lcov.info, ./shared-report/lcov.info
sonar.javascript.lcov.reportPaths=./coverage/shared/lcov.info, ./coverage/api/lcov.info, ./coverage/api-e2e/lcov.info
sonar.sources=api/, frontend/, shared/
sonar.coverage.exclusions=**/node_modules/**/*, **/*.spec.*, **/test/**/*, **/tests/**/*, **/*.json, **/*.yaml, **/*.yml, **/*.md
sonar.coverage.exclusions=**/node_modules/**/*, **/*.spec.*, **/test/**/*, **/tests/**/*, **/*.json, **/*.yaml, **/*.yml, **/*.md

0 comments on commit 80dcc59

Please sign in to comment.