Skip to content

docs: retire the docsify site, now built by brazilian-utils/docs #1080

docs: retire the docsify site, now built by brazilian-utils/docs

docs: retire the docsify site, now built by brazilian-utils/docs #1080

Workflow file for this run

name: Tests
on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]
push:
branches: [main]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
# A newer push to a pull request supersedes its run; a push to main always finishes, so the
# badges never show a cancelled run as failing.
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
permissions:
contents: read
jobs:
test-node:
name: Test on Node.js (${{ matrix.node-version }})
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
matrix:
node-version: [20, 22, 24, 26]
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Setup
uses: ./.github/actions/setup
with:
node-version: ${{ matrix.node-version }}
- name: Print the Node.js version in use
run: node --version
- name: Run tests
if: matrix.node-version != 24
run: vp test
- name: Run tests with coverage
if: matrix.node-version == 24
run: vp test run --coverage
- name: Upload coverage to Codecov
if: matrix.node-version == 24
uses: codecov/codecov-action@0fb7174895f61a3b6b78fc075e0cd60383518dac # v5.5.5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage/lcov.info
fail_ci_if_error: true
flags: node
test-bun:
name: Test on Bun
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Setup
uses: ./.github/actions/setup
- name: Setup Bun
uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
- name: Run tests
run: bun test src
test-deno:
name: Test on Deno
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Setup
uses: ./.github/actions/setup
- name: Setup Deno
uses: denoland/setup-deno@22d081ff2d3a40755e97629de92e3bcbfa7cf2ed # v2.0.5
with:
deno-version: v2.x
- name: Run tests
run: deno test --unstable-sloppy-imports --allow-net --allow-env src
# What JSR would reject at release time fails here instead: slow types in the public API,
# an export of jsr.json that does not resolve, a file outside the publish list.
- name: Dry-run the JSR publication
run: deno publish --dry-run
test-browsers:
name: Test on Browsers (${{ matrix.browser }})
runs-on: ubuntu-latest
timeout-minutes: 25
strategy:
# A flake in one browser must not cancel the others, or its cause is lost.
fail-fast: false
matrix:
browser: [edge, chrome, firefox]
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Setup
uses: ./.github/actions/setup
# Chromium under the webdriverio provider loses a test iframe when many test files load at
# once: the run either fails at once with "Cannot connect to the iframe" / "Failed to fetch
# dynamically imported module", or prints nothing more until it is killed. With test files in
# parallel that happened on most Chrome and Edge runs, which then sat silent until the timeout
# before retrying; one file at a time they finish in about a minute, faster than Firefox in
# parallel. So Chrome and Edge run one file at a time from the start. An attempt that still
# times out, or fails with one of those two errors, is run again one file at a time, up to
# three attempts. Any other failure, including a failing assertion, fails the step at once.
- name: Run tests in ${{ matrix.browser }}
env:
BROWSER: ${{ matrix.browser }}
run: |
attempt() {
timeout "$1" vp test --browser.enabled --browser.name="$BROWSER" "${@:2}" 2>&1 | tee browser-tests.log
return "${PIPESTATUS[0]}"
}
lost_iframe() {
[ "$1" -eq 124 ] || grep -qE "Cannot connect to the iframe|Failed to fetch dynamically imported module" browser-tests.log
}
first_attempt=()
case "$BROWSER" in
chrome | edge) first_attempt=(--no-file-parallelism) ;;
esac
attempt 240 "${first_attempt[@]}" && exit 0
status=$?
for retry in 1 2; do
lost_iframe "$status" || exit "$status"
echo "::warning::The $BROWSER test run lost a test iframe (exit $status); retry $retry of 2, one file at a time."
attempt 300 --no-file-parallelism && exit 0
status=$?
done
exit "$status"
test-safari:
name: Test on Browsers (safari)
runs-on: macos-latest
timeout-minutes: 25
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Setup
uses: ./.github/actions/setup
- name: Run tests in Safari
run: vp test --browser.enabled --browser.name=safari --browser.headless=false