diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dafd4184..61f14934 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,10 +1,24 @@ name: CI +# 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] pull_request: branches: [main] + 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.ref }} + 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. @@ -19,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 @@ -87,8 +107,13 @@ 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. + # + # 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) + needs: check runs-on: ubuntu-latest strategy: fail-fast: false 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 }}