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: Test Suite | |
| on: | |
| push: | |
| branches: [ main, develop ] | |
| pull_request: | |
| branches: [ main, develop ] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| node-version: [18.x, 20.x] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run linter (if configured) | |
| run: npm run lint --if-present | |
| continue-on-error: true | |
| - name: Run tests | |
| run: npm test | |
| - name: Generate coverage report | |
| run: npm run test:coverage || true | |
| - name: Upload coverage reports | |
| uses: codecov/codecov-action@v4 | |
| if: matrix.node-version == '20.x' | |
| with: | |
| files: ./coverage/coverage-final.json | |
| flags: unittests | |
| name: codecov-umbrella | |
| continue-on-error: true | |
| - name: Archive test results | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: test-results-${{ matrix.node-version }} | |
| path: | | |
| coverage/ | |
| tests/ | |
| - name: Comment PR with coverage | |
| if: github.event_name == 'pull_request' && matrix.node-version == '20.x' | |
| uses: romeovs/[email protected] | |
| with: | |
| lcov-file: ./coverage/lcov.info | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| continue-on-error: true | |
| lint: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20.x' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Check code formatting | |
| run: npm run format:check --if-present | |
| continue-on-error: true | |
| - name: Check for security vulnerabilities | |
| run: npm audit --production --audit-level=moderate | |
| continue-on-error: true | |
| build: | |
| runs-on: ubuntu-latest | |
| needs: [test, lint] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20.x' | |
| cache: 'npm' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build project (if configured) | |
| run: npm run build --if-present | |
| - name: Archive build artifacts | |
| uses: actions/upload-artifact@v4 | |
| if: success() | |
| with: | |
| name: build-artifacts | |
| path: | | |
| dist/ | |
| retention-days: 7 |