Enhance Jest configuration and CI workflow for improved coverage reporting #408
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: Continuous Integration | |
| on: pull_request | |
| jobs: | |
| linter: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "22" | |
| - name: Install Dependencies | |
| run: npm ci | |
| - name: Run Linter | |
| run: npm run lint | |
| tests: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| node-version: [20, 22, 24] | |
| test: ["unit", "integration:orkes-v5", "integration:orkes-v4"] | |
| name: Node.js v${{ matrix.node-version }} - ${{ matrix.test }} tests | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| - name: Install Dependencies | |
| run: npm ci | |
| - name: Run ${{ matrix.test }} Tests and Add Annotations | |
| id: tests | |
| continue-on-error: true | |
| run: npm run test:${{ matrix.test }} -- --ci --coverage --reporters=default --reporters=github-actions --reporters=jest-junit | |
| env: | |
| CONDUCTOR_SERVER_URL: ${{ matrix.test == 'integration:v4' && vars.SERVER_URL_V4 || vars.SERVER_URL }} | |
| CONDUCTOR_AUTH_KEY: ${{ matrix.test == 'integration:v4' && secrets.AUTH_KEY_V4 || secrets.AUTH_KEY }} | |
| CONDUCTOR_AUTH_SECRET: ${{ matrix.test == 'integration:v4' && secrets.AUTH_SECRET_V4 || secrets.AUTH_SECRET }} | |
| JEST_JUNIT_OUTPUT_NAME: ${{ matrix.test }}-test-results.xml | |
| - name: Publish ${{ matrix.test }} Test Results | |
| uses: dorny/test-reporter@v2 | |
| if: ${{ !cancelled() }} | |
| with: | |
| name: ${{ matrix.test }} Test Report | |
| path: reports/${{ matrix.test }}-test-results.xml | |
| reporter: jest-junit | |
| - name: Upload coverage to Codecov | |
| if: always() | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| files: ./coverage/lcov.info | |
| flags: ${{ matrix.test }} | |
| name: codecov-${{ matrix.test }}-node-${{ matrix.node-version }} | |
| fail_ci_if_error: false | |
| - name: Check Tests Status | |
| if: steps.tests.outcome == 'failure' | |
| run: exit 1 |