Files
doona/.github/workflows/check.yml
T
Zakk 70d27588bf chore(deps): bump github actions to their current majors
Apply the adjacent Dependabot updates together to avoid workflow conflicts:
- actions/upload-artifact v4 -> v7.0.1
- actions/setup-node v4 -> v7.0.0
- actions/checkout v4 -> v7.0.1
- pnpm/action-setup v4 -> v6.1.0
- softprops/action-gh-release v2.5.0 -> v3.0.3
- actions/download-artifact v4 -> v8.0.1 for upload-artifact v7 compatibility
- actions/github-script v7 -> v9.0.0 for the Node 24 runtime

Pin every action to its release SHA and retain exact version comments.
Keep pnpm sourced from packageManager, explicit pnpm caching, unique shard
artifact names, zipped uploads and merge-multiple report extraction.
Keep gh-release's draft, prerelease, files and unmatched-file inputs.
Group release environment writes and separate SOURCE_DATE_EPOCH assignment
from export so shellcheck passes without masking git failures.
2026-10-02 04:02:11 +10:00

281 lines
11 KiB
YAML

name: Check
on:
push:
branches: [main]
pull_request:
schedule:
- cron: '23 16 * * *'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.event.pull_request.number || github.run_id }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
permissions:
contents: read
jobs:
changes:
runs-on: ubuntu-latest
timeout-minutes: 3
outputs:
lane: ${{ steps.route.outputs.lane }}
matrix: ${{ steps.route.outputs.matrix }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- id: route
run: node tools/ci-changes.mjs
check-lite:
needs: [changes]
if: needs.changes.outputs.lane == 'docs'
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 22
cache: pnpm
- run: pnpm install --frozen-lockfile
- run: pnpm format:check
- run: pnpm check:i18n
# Static checks, unit tests and the bundle budget: a few minutes, independent of the browsers.
check:
needs: [changes]
if: needs.changes.outputs.lane == 'full'
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 22
cache: pnpm
- run: pnpm install --frozen-lockfile
- run: pnpm typecheck
- run: pnpm lint
- run: pnpm check:i18n
- run: pnpm format:check
- run: pnpm test:coverage
- run: pnpm check:gen
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: coverage
path: coverage/lcov.info
if-no-files-found: error
- run: pnpm build
- run: pnpm check:size
# The browser suite is most of the run's time, so it is split over parallel runners; each builds its own dist.
e2e:
needs: [changes]
if: needs.changes.outputs.lane == 'full'
runs-on: ubuntu-latest
timeout-minutes: 15
# The image ships the browsers and their OS packages; installing those per run took up to 21 minutes on some runners.
# Bump the tag together with @playwright/test (the step below fails on a mismatch).
container:
image: mcr.microsoft.com/playwright:v1.63.0-noble
options: --init --ipc=host
strategy:
fail-fast: false
matrix:
shard: [1, 2, 3, 4]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 22
cache: pnpm
- run: pnpm install --frozen-lockfile
- name: Match the container to @playwright/test
run: test "$(node -p "require('./package.json').devDependencies['@playwright/test']")" = "${PLAYWRIGHT_VERSION}"
env:
PLAYWRIGHT_VERSION: 1.63.0
- name: Run the browser shard
run: |
if [ "$RUN_MATRIX" = true ]; then
pnpm e2e --shard=${{ matrix.shard }}/4 --reporter=list,github,blob,json
else
pnpm e2e --shard=${{ matrix.shard }}/4 --reporter=list,github,blob,json --grep-invert '@matrix'
fi
env:
DOONA_E2E_WEBKIT: '1'
RUN_MATRIX: ${{ needs.changes.outputs.matrix }}
PLAYWRIGHT_JSON_OUTPUT_FILE: ${{ runner.temp }}/e2e-${{ matrix.shard }}.json
- name: Summarize the shard
if: always()
env:
REPORT: ${{ runner.temp }}/e2e-${{ matrix.shard }}.json
SHARD: ${{ matrix.shard }}
run: |
node <<'JS'
const fs = require('node:fs');
const heading = `### Browser shard ${process.env.SHARD}\n\n`;
let summary = 'Report unavailable; see the failed or cancelled steps.\n';
if (fs.existsSync(process.env.REPORT)) {
const {stats} = JSON.parse(fs.readFileSync(process.env.REPORT, 'utf8'));
summary = `Duration: ${(stats.duration / 1000).toFixed(1)} s\n\n` +
`| Passed | Failed | Flaky | Skipped |\n| --- | --- | --- | --- |\n` +
`| ${stats.expected} | ${stats.unexpected} | ${stats.flaky} | ${stats.skipped} |\n`;
}
fs.appendFileSync(process.env.GITHUB_STEP_SUMMARY, heading + summary);
JS
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
if: always()
with:
name: test-results-${{ matrix.shard }}
path: test-results/
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
if: ${{ !cancelled() }}
with:
name: blob-report-${{ matrix.shard }}
path: blob-report/
if-no-files-found: ignore
retention-days: 1
merge-reports:
if: ${{ !cancelled() && needs.e2e.result != 'skipped' }}
needs: [e2e]
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 22
cache: pnpm
- run: pnpm install --frozen-lockfile
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
path: all-blob-reports
pattern: blob-report-*
merge-multiple: true
- name: Require blob reports from the browser shards
run: |
shopt -s nullglob
blobs=(all-blob-reports/*.zip)
if [ "${#blobs[@]}" -eq 0 ]; then
echo '::error::The browser jobs ran but produced no blob reports; inspect the failed e2e steps.'
exit 1
fi
- run: pnpm exec playwright merge-reports --reporter html ./all-blob-reports
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: playwright-report
path: playwright-report/
if-no-files-found: error
retention-days: 14
ci-ok:
needs: [changes, check-lite, check, e2e, merge-reports]
if: always()
runs-on: ubuntu-latest
timeout-minutes: 3
steps:
- name: Require the selected lane
env:
NEEDS: ${{ toJSON(needs) }}
run: |
node <<'JS'
const needs = JSON.parse(process.env.NEEDS);
const lane = needs.changes.outputs.lane;
const selected = lane === 'docs' ? ['check-lite'] : lane === 'full' ? ['check', 'e2e', 'merge-reports'] : [];
const lanes = ['check-lite', 'check', 'e2e', 'merge-reports'];
const ok = needs.changes.result === 'success' && selected.length > 0 &&
['true', 'false'].includes(needs.changes.outputs.matrix) &&
lanes.every(job => needs[job].result === (selected.includes(job) ? 'success' : 'skipped'));
if (!ok) {
console.error('CI lane did not complete successfully', needs);
process.exit(1);
}
JS
nightly:
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
timeout-minutes: 25
container:
image: mcr.microsoft.com/playwright:v1.63.0-noble
options: --init --ipc=host --user 1001
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 22
cache: pnpm
- run: pnpm install --frozen-lockfile
- name: Match the container to @playwright/test
run: test "$(node -p "require('./package.json').devDependencies['@playwright/test']")" = "${PLAYWRIGHT_VERSION}"
env:
PLAYWRIGHT_VERSION: 1.63.0
- name: Run Firefox connections and router
env:
DOONA_E2E_FIREFOX: '1'
run: |
cat > playwright.firefox.config.ts <<'TS'
import config from './playwright.config';
export default {
...config,
projects: config.projects.filter(project => project.name === 'firefox').map(project => ({
...project, testMatch: ['connections.spec.ts', 'router.spec.ts']
}))
};
TS
pnpm build
pnpm exec playwright test --config=playwright.firefox.config.ts
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
if: ${{ !cancelled() }}
with:
name: firefox-test-results
path: test-results/
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
if: ${{ !cancelled() }}
with:
name: firefox-blob-report
path: blob-report/
if-no-files-found: ignore
retention-days: 1
notify-nightly:
needs: [ci-ok, nightly]
if: ${{ always() && (github.event_name == 'schedule' || github.event_name == 'workflow_dispatch') && (needs.ci-ok.result != 'success' || needs.nightly.result != 'success') }}
runs-on: ubuntu-latest
timeout-minutes: 3
permissions:
contents: read
issues: write
concurrency:
group: nightly-failure-issue
cancel-in-progress: false
steps:
- uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
env:
RESULTS: ${{ toJSON(needs) }}
with:
script: |
const marker = '<!-- doona-nightly-failure -->';
const title = 'CI nightly failures';
const results = JSON.parse(process.env.RESULTS);
const url = `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
const body = `${marker}\nLatest failing nightly: ${url}\n\n` +
Object.entries(results).map(([job, value]) => `- ${job}: ${value.result}`).join('\n');
const issues = await github.paginate(github.rest.search.issuesAndPullRequests, {
q: `repo:${context.repo.owner}/${context.repo.repo} is:issue in:title "${title}"`,
sort: 'created', order: 'asc', per_page: 100
});
const issue = issues.find(issue => issue.title === title);
if (issue) {
await github.rest.issues.update({...context.repo, issue_number: issue.number, body, state: 'open'});
} else {
await github.rest.issues.create({...context.repo, title, body});
}