VPR-48 Effort Reports #12
This file contains hidden or 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
| name: Tests | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| frontend: | |
| name: Frontend Tests | |
| runs-on: ubuntu-latest | |
| env: | |
| HAS_CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN != '' }} | |
| defaults: | |
| run: | |
| working-directory: VueApp | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: npm | |
| cache-dependency-path: VueApp/package-lock.json | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build with bundle analysis | |
| run: npx vite build --mode test | |
| env: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| - name: Run tests with coverage | |
| run: npx vitest run --coverage --reporter=junit --outputFile=test-report.junit.xml | |
| - name: Upload coverage to Codecov | |
| if: ${{ !cancelled() && env.HAS_CODECOV_TOKEN == 'true' }} | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: ./VueApp/coverage/cobertura-coverage.xml | |
| flags: frontend | |
| - name: Upload test results to Codecov | |
| if: ${{ !cancelled() && env.HAS_CODECOV_TOKEN == 'true' }} | |
| uses: codecov/test-results-action@v1 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: ./VueApp/test-report.junit.xml | |
| flags: frontend | |
| backend: | |
| name: Backend Tests | |
| runs-on: ubuntu-latest | |
| env: | |
| HAS_CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN != '' }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 8.0.x | |
| - name: Run tests with coverage | |
| run: >- | |
| dotnet test test/ | |
| --collect:"XPlat Code Coverage" | |
| --results-directory ./coverage | |
| --logger "junit;LogFilePath=../test-report.junit.xml" | |
| - name: Upload coverage to Codecov | |
| if: ${{ !cancelled() && env.HAS_CODECOV_TOKEN == 'true' }} | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: ./coverage/**/coverage.cobertura.xml | |
| flags: backend | |
| - name: Upload test results to Codecov | |
| if: ${{ !cancelled() && env.HAS_CODECOV_TOKEN == 'true' }} | |
| uses: codecov/test-results-action@v1 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: ./test-report.junit.xml | |
| flags: backend |