Repository navigation
chore: add Dependabot version updates config #145
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: | |
| schedule: | |
| # Nightly run of the integration tests against the real API | |
| - cron: '0 3 * * *' | |
| workflow_dispatch: | |
| jobs: | |
| unit: | |
| name: Unit (Node ${{ matrix.node-version }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| # Matches engines.node: ">=18" in package.json | |
| node-version: [18, 20, 22, 24] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| cache: npm | |
| - run: npm ci | |
| - name: Run unit tests with coverage | |
| run: npm run test:unit -- --coverage | |
| # Coverage is uploaded once, not per Node version -- the figure | |
| # doesn't depend on the version, and duplicates would only clutter | |
| # the report. | |
| # | |
| # fail-on-error: false -- the coverage upload is a secondary step, and | |
| # its failure shouldn't turn a job red when all tests passed. Otherwise | |
| # Coveralls being down or the repo not being connected would block | |
| # merging an otherwise working PR. A stale badge is noticeable on its | |
| # own anyway. | |
| - name: Upload coverage to Coveralls | |
| if: matrix.node-version == 20 | |
| uses: coverallsapp/github-action@v2 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| file: coverage/lcov.info | |
| fail-on-error: false | |
| integration: | |
| name: Integration (real API) | |
| # Run for same-repository pull requests as well as scheduled and manual | |
| # checks. GitHub does not expose repository secrets to pull requests from | |
| # forks, so those runs fail at the explicit secret check below instead of | |
| # producing a false-green result. | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: npm | |
| - run: npm ci | |
| - name: Fail early if the API key is missing | |
| # Without a key the integration tests skip themselves and the job | |
| # goes green having checked nothing. Better to fail explicitly. | |
| env: | |
| CAPTCHA_API_KEY: ${{ secrets.CAPTCHA_API_KEY }} | |
| run: | | |
| if [ -z "$CAPTCHA_API_KEY" ]; then | |
| echo "::error::secrets.CAPTCHA_API_KEY is not set -- integration tests would silently skip" | |
| exit 1 | |
| fi | |
| - name: Run integration tests | |
| env: | |
| CAPTCHA_API_KEY: ${{ secrets.CAPTCHA_API_KEY }} | |
| run: npm run test:integration |