From 80dcc599e6fada18d903902055a2cefda16e65c7 Mon Sep 17 00:00:00 2001 From: Vincenzo Pellegrini Date: Fri, 15 Mar 2024 21:48:51 +0100 Subject: [PATCH] Simplified workflow, single task, maximum gain --- .github/workflows/fullstack.yml | 44 ++++++--------------------------- api/package.json | 3 ++- package.json | 2 +- sonar-project.properties | 4 +-- 4 files changed, 12 insertions(+), 41 deletions(-) diff --git a/.github/workflows/fullstack.yml b/.github/workflows/fullstack.yml index 493b7fd..48e3293 100644 --- a/.github/workflows/fullstack.yml +++ b/.github/workflows/fullstack.yml @@ -3,12 +3,10 @@ name: Test on: push: branches: - - main - - dev + - '*' pull_request: branches: - - main - - dev + - '*' jobs: tests: @@ -16,14 +14,14 @@ jobs: 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: @@ -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 }} @@ -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: @@ -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 diff --git a/api/package.json b/api/package.json index a305c59..b4a347b 100644 --- a/api/package.json +++ b/api/package.json @@ -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" }, diff --git a/package.json b/package.json index 21fa9c6..4fbe562 100644 --- a/package.json +++ b/package.json @@ -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": "", diff --git a/sonar-project.properties b/sonar-project.properties index 610c687..895f2fc 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -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 \ No newline at end of file +sonar.coverage.exclusions=**/node_modules/**/*, **/*.spec.*, **/test/**/*, **/tests/**/*, **/*.json, **/*.yaml, **/*.yml, **/*.md