Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/publish-to-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ on:

jobs:
publish:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '20'
node-version: '24'
registry-url: 'https://registry.npmjs.org'
cache: npm
- run: npm ci
Expand All @@ -30,7 +30,7 @@ jobs:

changelog:
needs: publish
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
permissions:
contents: write
steps:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@ on:
jobs:
unit:
name: Unit (Node ${{ matrix.node-version }})
runs-on: ubuntu-latest
runs-on: ubuntu-24.04
strategy:
fail-fast: false
matrix:
# Matches engines.node: ">=18" in package.json
node-version: [18, 20, 22, 24]
node-version: [18, 20, 22, 24, 26]

steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -55,7 +55,7 @@ jobs:
# 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
runs-on: ubuntu-24.04

steps:
- uses: actions/checkout@v4
Expand Down
9 changes: 4 additions & 5 deletions tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -410,18 +410,18 @@ The configuration is [.github/workflows/tests.yml](../.github/workflows/tests.ym
| Job | Command | When it runs | Secrets |
|---|---|---|---|
| `unit` | `npm run test:unit -- --coverage` | push to `main`, any pull request, schedule, manual dispatch | none |
| `integration` | `npm run test:integration` | **only** on schedule (daily at 03:00 UTC) and manually via workflow_dispatch | `CAPTCHA_API_KEY` |
| `integration` | `npm run test:integration` | push to `main`, any pull request, schedule (daily at 03:00 UTC), manual dispatch | `CAPTCHA_API_KEY` |

### Why the jobs are split

- **Unit tests are the mandatory blocking step.** Deterministic, no network, no secrets, a couple of seconds. Safe on any PR, forks included. They run on a Node `18 / 20 / 22` matrix, matching `engines.node: ">=18"`.
- **Integration tests deliberately do not run on pull requests.** They spend real account balance and depend on an external API being up. More importantly, secrets are unavailable in a PR from a fork, so the tests would skip themselves and produce a **false green** instead of an honest "not checked".
- **Unit tests are the mandatory blocking step.** Deterministic, no network, no secrets, a couple of seconds. Safe on any PR, forks included. They run on a Node `18 / 20 / 22 / 24 / 26` matrix, matching `engines.node: ">=18"`.
- **Integration tests also run on pull requests**, so a change that breaks the real API flow is caught before merge. The cost is real account balance on every run and a dependency on the external API being up. Secrets are unavailable in a PR from a fork, so there the job **fails** at the fail-early step (see below) instead of skipping the tests and producing a false green.

### What the nightly run actually checks

The `integration` job passes only `CAPTCHA_API_KEY` to the tests. It has no target variables, so among the paid suites everything skips except the three image-based ones — `image_to_text.test.js`, `coordinates.test.js` and `yandex_smartcaptcha_image.test.js`: they need no targets, and with a live key they **really do hit the API and spend balance**. `recaptcha_v2.test.js` used to work off a hard-coded Google demo page; after targets were dropped from the repository (see [above](#why-the-repository-carries-no-targets)) that is no longer the case.

So **every night costs two tasks**, one per image. That is the price of the nightly run checking `solve()` at all, rather than the balance alone, which is all it used to check. If that spend is unwanted, the simplest fix is to narrow the step to specific files: `npm test -- tests/integration/balance.test.js`.
So **every run costs two tasks**, one per image - nightly, on every push to `main` and on every push to a pull request. That is the price of CI checking `solve()` at all, rather than the balance alone, which is all it used to check. If that spend is unwanted, the simplest fix is to narrow the step to specific files: `npm test -- tests/integration/balance.test.js`.

The remaining target-driven solve tests are not planned for CI yet. When they are wanted, the order is:

Expand Down Expand Up @@ -450,5 +450,4 @@ Without it a missing key would look like a successful run: the tests skip themse
### What the pipeline does not have yet

- A lint step — no linter is configured in the project.
- Publishing to npm.
- Badges in the README — tracked in [todo.md](../todo.md) together with wiring up Coveralls (which needs action in a web UI).
Loading