From 13f7a1bec71e4e829b4a0186b8c1f1ccbd33de5f Mon Sep 17 00:00:00 2001 From: uBlue Date: Wed, 18 Nov 2026 11:17:59 +1000 Subject: [PATCH 1/3] ci(codeql): scan pull requests and a weekly main, not every push GitHub's default setup analysed every push to main, so a merged pull request was scanned twice, and the Rust analysis alone runs ~18 minutes. This advanced setup scans the same four languages on pull requests, weekly on main, and on demand. The default setup has to be turned off once this runs, or GitHub rejects its results. --- .github/workflows/codeql.yml | 54 ++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .github/workflows/codeql.yml diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml new file mode 100644 index 00000000..9b8870c5 --- /dev/null +++ b/.github/workflows/codeql.yml @@ -0,0 +1,54 @@ +name: CodeQL + +# A pull request is scanned before it lands, and main itself on a weekly +# schedule, never per push: the merge commit holds code its pull request +# already had analysed, and the Rust analysis alone runs ~18 minutes. +# +# GitHub's "default setup" (Settings > Code security > CodeQL analysis) +# must stay off: while it is on, GitHub rejects the results of an +# advanced configuration like this one. + +on: + pull_request: + branches: [main] + paths-ignore: + - '**/*.md' + - 'resources/screen_*.png' + - 'resources/screen_*.gif' + schedule: + - cron: '23 4 * * 1' + workflow_dispatch: + +# A newer push to the same pull request makes the older scan moot. +concurrency: + group: codeql-${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: read + +jobs: + analyze: + name: Analyze (${{ matrix.language }}) + runs-on: ubuntu-latest + permissions: + contents: read + actions: read + security-events: write + strategy: + fail-fast: false + matrix: + language: [actions, javascript-typescript, python, rust] + steps: + - uses: actions/checkout@v5 + + # `none` reads the source without compiling it; Rust would otherwise + # need the full GTK toolchain the CI job installs. + - uses: github/codeql-action/init@v4 + with: + languages: ${{ matrix.language }} + build-mode: none + + - uses: github/codeql-action/analyze@v4 + with: + category: /language:${{ matrix.language }} From 8f159d4a7dc73198f00e59659095bad38851b887 Mon Sep 17 00:00:00 2001 From: uBlue Date: Wed, 18 Nov 2026 11:17:59 +1000 Subject: [PATCH 2/3] ci: skip docs-only changes, cancel stale PR runs, E2E on PRs only Markdown and screenshot changes no longer start a build. A newer push to a pull request cancels the run on the older commit; pushes to main are grouped per commit, so none is cancelled or dropped. The three E2E shards, three full builds, run on pull requests only. --- .github/workflows/ci.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dafd4184..7334acaa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,10 +1,27 @@ name: CI +# Docs and screenshots cannot change what compiles or what the tests see. on: push: branches: [main] + paths-ignore: + - '**/*.md' + - 'resources/screen_*.png' + - 'resources/screen_*.gif' pull_request: branches: [main] + paths-ignore: + - '**/*.md' + - 'resources/screen_*.png' + - 'resources/screen_*.gif' + +# A newer push to a pull request supersedes the run still testing the +# older commit. A push to main is grouped by its own commit instead, so +# nothing there is cancelled or dropped from the queue and every commit +# that lands keeps its own result. +concurrency: + group: ci-${{ github.event_name == 'pull_request' && github.ref || github.sha }} + cancel-in-progress: true # Build + test only: nothing here writes back to the repo, so the token # gets the read scope the checkout needs and nothing else. @@ -87,8 +104,14 @@ jobs: # # No network by design (see the note in font-pack.ice), and every test # runs on a freshly wiped sandbox HOME, never the runner's own. + # + # Pull requests only: each shard builds the app from scratch, so the + # suite costs three full builds, and a merged pull request has already + # passed it. A commit pushed straight to main gets the compile, test + # and clippy gate above but not this suite. e2e: name: Headless E2E (${{ matrix.shard }}/3) + if: github.event_name == 'pull_request' runs-on: ubuntu-latest strategy: fail-fast: false From 8845a34b5b947c6619a13b6469ddfeff38dadeb7 Mon Sep 17 00:00:00 2001 From: uBlue Date: Wed, 18 Nov 2026 12:17:37 +1000 Subject: [PATCH 3/3] ci: run build tests on demand, not on every push Build and test usually run locally before a push, so CI no longer starts on its own. It runs when a pull request carries the run-ci label (and on every later push to it), or from the Actions tab. The E2E shards wait for the compile gate, so a change that does not build costs one build instead of four. --- .github/workflows/ci.yml | 46 +++++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7334acaa..61f14934 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,26 +1,23 @@ name: CI -# Docs and screenshots cannot change what compiles or what the tests see. +# On demand only: the same checks run locally before a push, so a build +# here is something asked for, never a side effect of pushing. Two ways to +# ask: +# - add the `run-ci` label to a pull request; every later push to it +# re-runs until the label is removed +# - Actions tab > CI > Run workflow, on any branch +# Without the label a pull request still gets a CI run, but both jobs skip +# without starting a runner. on: - push: - branches: [main] - paths-ignore: - - '**/*.md' - - 'resources/screen_*.png' - - 'resources/screen_*.gif' pull_request: branches: [main] - paths-ignore: - - '**/*.md' - - 'resources/screen_*.png' - - 'resources/screen_*.gif' - -# A newer push to a pull request supersedes the run still testing the -# older commit. A push to main is grouped by its own commit instead, so -# nothing there is cancelled or dropped from the queue and every commit -# that lands keeps its own result. + types: [opened, synchronize, reopened, labeled] + workflow_dispatch: + +# A newer push to the same pull request supersedes the run still testing +# the older commit. concurrency: - group: ci-${{ github.event_name == 'pull_request' && github.ref || github.sha }} + group: ci-${{ github.ref }} cancel-in-progress: true # Build + test only: nothing here writes back to the repo, so the token @@ -36,6 +33,12 @@ env: jobs: check: name: Check & Test + # Adding any other label to a pull request that already carries + # `run-ci` must not start a second run. + if: >- + github.event_name == 'workflow_dispatch' || + (github.event.action == 'labeled' && github.event.label.name == 'run-ci') || + (github.event.action != 'labeled' && contains(github.event.pull_request.labels.*.name, 'run-ci')) runs-on: ubuntu-latest steps: - uses: actions/checkout@v5 @@ -105,13 +108,12 @@ jobs: # No network by design (see the note in font-pack.ice), and every test # runs on a freshly wiped sandbox HOME, never the runner's own. # - # Pull requests only: each shard builds the app from scratch, so the - # suite costs three full builds, and a merged pull request has already - # passed it. A commit pushed straight to main gets the compile, test - # and clippy gate above but not this suite. + # Runs only after the compile gate passes: each shard builds the app + # from scratch, so a change that does not compile would otherwise cost + # three more full builds to say so. Skipped whenever `check` is. e2e: name: Headless E2E (${{ matrix.shard }}/3) - if: github.event_name == 'pull_request' + needs: check runs-on: ubuntu-latest strategy: fail-fast: false