Files
logos-protocol/.github/workflows/ci.yml
Dario LipicarandClaude Opus 5 f4407ff485 ci: use logos-co/setup-nix-cache-action for Nix setup and caching (#60)
Replaces the per-repo installer + cachix pair with the shared action, which
installs Nix with the Logos Attic cache (cache.nix.logos.co) preconfigured and
publishes what the job builds — master to the public cache, every other ref to
ci.

Each converted job also gains

    environment: ${{ github.ref == 'refs/heads/master' && 'public-cache' || '' }}

because ATTIC_TOKEN_PUBLIC only exists inside that environment. Without it the
secret resolves empty on master and publishing is silently skipped — the job
still passes, so the omission would not show up as a failure.

The action installs Nix itself on every runner, macOS included. That is a
deliberate reversal of the workaround these files carried: the comments here
said cachix/install-nix-action collides with the runner's pre-existing _nixbld
users (eDSRecordAlreadyExists), so DeterminateSystems' installer was used
instead. It no longer reproduces — logos-delivery-module has already been
converted the plain way and its `build-and-test (macos-latest)` leg passes.
Keeping the workaround would have meant a second installer plus a duplicated
substituter/key block in ten files, guarding against something two green runs
say does not happen. If it ever recurs it fails loudly at install, which is
recoverable; the silent-skip above is the failure mode worth engineering
against.

One property is deliberately NOT carried over: the old cachix step ran with
`continue-on-error: true` so a failed cache push could not fail a job whose
tests passed. The action exposes no equivalent, and adding one here would also
swallow genuine setup failures now that the same step installs Nix rather than
only publishing at the end.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-18 23:41:49 -03:00

44 lines
1.3 KiB
YAML

name: CI
# pull_request is unfiltered: stacked PRs (based on other feature branches)
# must run CI too.
on:
push:
branches: [master, main]
pull_request:
workflow_dispatch:
jobs:
test:
# ATTIC_TOKEN_PUBLIC only exists in the public-cache environment; master
# jobs must opt into it to publish to the public cache.
environment: ${{ github.ref == 'refs/heads/master' && 'public-cache' || '' }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: logos-co/setup-nix-cache-action@v1
with:
attic-token-ci: ${{ secrets.ATTIC_TOKEN_CI }}
attic-token-public: ${{ secrets.ATTIC_TOKEN_PUBLIC }}
- name: Build tests
run: nix build '.#tests'
- name: Run protocol tests
run: ./result/bin/protocol_tests
env:
QT_QPA_PLATFORM: offscreen
# The Qt-loop-free half, in its own process because that is the whole
# point: QCoreApplication is a process-wide singleton and protocol_tests
# constructs one before its first test, so no test in that binary can
# reach the state a Qt-free host is permanently in.
- name: Run protocol tests (no Qt event loop)
run: ./result/bin/protocol_noqt_tests