Files
doona/.github/workflows/check.yml
T
Zakk 09a3ea3e46 feat(changelog): collect per-pr release fragments
Keep pull requests out of the shared Unreleased section. Resolve PR numbers from fragment-adding commits, collect release notes with comparison links, and require fragments in the existing CI lane.
2026-10-03 22:47:03 +10:00

274 lines
11 KiB
YAML

name: Check
on:
push:
branches: [main]
pull_request:
types: [opened, synchronize, reopened, labeled, unlabeled]
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-24.04-arm
timeout-minutes: 3
outputs:
lane: ${{ steps.route.outputs.lane }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- id: route
name: Select checks and require changelog fragments
run: node tools/ci-changes.mjs
check-lite:
needs: [changes]
if: needs.changes.outputs.lane == 'docs'
runs-on: ubuntu-24.04-arm
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-24.04-arm
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-24.04-arm
timeout-minutes: 15
# Update the tag and digest together with @playwright/test.
container:
image: mcr.microsoft.com/playwright:v1.63.0-noble@sha256:eff16c30e6f3f4af0a03fa4b706120d5e9b0891c344a27d64559aff5900a4a27
options: --ipc=host
strategy:
fail-fast: false
matrix:
shard: [1, 2, 3, 4, 5, 6, 7, 8, 9]
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: pnpm e2e --shard=${{ matrix.shard }}/${{ strategy.job-total }} --reporter=list,github,blob,json
env:
DOONA_E2E_WEBKIT: '1'
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-24.04-arm
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-24.04-arm
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 &&
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-24.04-arm
timeout-minutes: 25
container:
image: mcr.microsoft.com/playwright:v1.63.0-noble@sha256:eff16c30e6f3f4af0a03fa4b706120d5e9b0891c344a27d64559aff5900a4a27
options: --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-24.04-arm
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});
}