jj/.github/workflows/build-nix.yml
Austin Seipp 6fec006405 github: don't run build workflows twice on push to main
The new `merge_group` event will already attach all the CI events from the
various workflows where it applies. If the merge queue is drained and merges to
`main`, having `push` on these workflows will cause them to be run again, doubling
the number of CI checks. We don't need `push` anymore, basically.

Also, because checks can be cancelled now, the current double running can
probably lead to an awkward setup like:

- Merge Queue merges A to main, starts `push` workflows
- Merge Queue then merges B and C to main, starts `push` workflows
- `A`'s workflows get cancelled if it's not yet done
- This makes it look like `A` has failing tests somehow, but it doesn't

Therefore, just removing the double builds is the first step to cut down on the
CI times for our repo.

We also run the build workflows on all pushes to NOT main, because that will
help people who want to run CI before opening an actual PR.

Signed-off-by: Austin Seipp <aseipp@pobox.com>
2025-01-08 22:54:14 +00:00

33 lines
947 B
YAML

name: nix
on:
push:
branches:
- '**'
- '!main' # Don't build on main, because merge_group will do that already.
pull_request:
merge_group:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
permissions: read-all
jobs:
nix:
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04, macos-14]
runs-on: ${{ matrix.os }}
timeout-minutes: 15 # NOTE (aseipp): keep in-sync with the build.yml timeout limit
name: flake check
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
fetch-depth: 0
- uses: DeterminateSystems/nix-installer-action@e50d5f73bfe71c2dd0aa4218de8f4afa59f8f81d
- uses: DeterminateSystems/magic-nix-cache-action@87b14cf437d03d37989d87f0fa5ce4f5dc1a330b
- run: nix flake check -L --show-trace