fix: update complaint submission #183
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] | |
| permissions: | |
| contents: read | |
| actions: write | |
| checks: write | |
| pull-requests: write | |
| jobs: | |
| lint-test: | |
| name: Lint Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 24 | |
| cache: npm | |
| - name: Cache node modules | |
| uses: actions/cache@v5 | |
| with: | |
| path: ~/.npm | |
| key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-npm- | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run lint tests | |
| run: npm run test:lint | |
| mocha-test: | |
| name: Mocha Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 24 | |
| cache: npm | |
| - name: Cache node modules | |
| uses: actions/cache@v5 | |
| with: | |
| path: ~/.npm | |
| key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-npm- | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run tests | |
| run: npx mocha --reporter json --reporter-option output=reports/test-results.json | |
| - name: Upload test report | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: test-results | |
| path: 'reports/test-results.json' | |
| - uses: dorny/test-reporter@v3 | |
| if: always() | |
| with: | |
| artifact: test-results | |
| name: Mocha Tests | |
| path: 'test-results.json' | |
| reporter: mocha-json | |
| comment-pr: | |
| name: Comment on PR | |
| needs: mocha-test | |
| if: ${{ (success() || failure()) && github.event.pull_request.head.repo.full_name == github.repository}} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Comment on PR | |
| uses: marocchino/sticky-pull-request-comment@v3.0.4 | |
| with: | |
| GITHUB_TOKEN: ${{ github.token }} | |
| header: test-results | |
| message: | | |
| **Test Results:** [Open Results!](https://github.com/hasadna/open-bus-backend/actions/runs/${{ github.run_id }}#user-content-r0) | |
| coverage-test: | |
| name: Test Whit Coverage | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 24 | |
| cache: npm | |
| - name: Cache node modules | |
| uses: actions/cache@v5 | |
| with: | |
| path: ~/.npm | |
| key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-npm- | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Run Coverage Tests | |
| run: npm run test:coverage | |
| - name: Upload coverage report | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: coverage-report | |
| path: coverage/ | |
| - name: Upload to Coveralls | |
| if: always() | |
| uses: coverallsapp/github-action@v2 | |
| with: | |
| path-to-lcov: ./coverage/lcov.info |