|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + branches: |
| 6 | + - develop |
| 7 | + - main |
| 8 | + push: |
| 9 | + branches: |
| 10 | + - develop |
| 11 | + - main |
| 12 | + |
| 13 | +jobs: |
| 14 | + test: |
| 15 | + name: Test and Coverage |
| 16 | + runs-on: ubuntu-latest |
| 17 | + |
| 18 | + steps: |
| 19 | + - name: Checkout code |
| 20 | + uses: actions/checkout@v4 |
| 21 | + |
| 22 | + - name: Setup Node.js |
| 23 | + uses: actions/setup-node@v4 |
| 24 | + with: |
| 25 | + node-version: '20.19.1' |
| 26 | + cache: 'yarn' |
| 27 | + |
| 28 | + - name: Install dependencies |
| 29 | + run: yarn install --frozen-lockfile |
| 30 | + |
| 31 | + - name: Run linter |
| 32 | + run: yarn lint |
| 33 | + |
| 34 | + - name: Build project |
| 35 | + run: yarn build:prod |
| 36 | + |
| 37 | + - name: Run tests with coverage |
| 38 | + run: yarn test:coverage |
| 39 | + |
| 40 | + - name: Check coverage thresholds |
| 41 | + run: | |
| 42 | + if [ -f coverage/lcov.info ]; then |
| 43 | + echo "Coverage report generated successfully" |
| 44 | + # You can add coverage threshold checks here if needed |
| 45 | + # For example, using a tool like nyc or custom scripts |
| 46 | + else |
| 47 | + echo "Warning: Coverage report not found" |
| 48 | + exit 1 |
| 49 | + fi |
| 50 | +
|
| 51 | + # Uncomment to upload coverage to Codecov |
| 52 | + # - name: Upload coverage to Codecov |
| 53 | + # uses: codecov/codecov-action@v4 |
| 54 | + # with: |
| 55 | + # file: ./coverage/lcov.info |
| 56 | + # fail_ci_if_error: true |
| 57 | + # token: ${{ secrets.CODECOV_TOKEN }} |
| 58 | + |
| 59 | + # Uncomment to upload coverage to Coveralls |
| 60 | + # - name: Upload coverage to Coveralls |
| 61 | + # uses: coverallsapp/github-action@v2 |
| 62 | + # with: |
| 63 | + # github-token: ${{ secrets.GITHUB_TOKEN }} |
| 64 | + # path-to-lcov: ./coverage/lcov.info |
0 commit comments