Files
komorebi/.github/workflows/_macos.yaml
T
LGUG2Z 5df5c5c3c5 fix(ci): run the os_sensitive packages on the macOS runner, as on the Windows one
Packages whose tests depend on the OS are in the class os_sensitive of
tools/test-partition.json, and a test of one can only pass on the host whose
behaviour it checks. windows-native-test runs them on Windows because the
Linux run cannot stand in for it. macos-hosted did not: macos-nextest builds
with -p of the macOS packages, so komorebic-core, whose docs_cli test
compares docs/macos/cli with what the macOS command line renders, ran on
no Mac in CI, and relied on the Linux run until the wording of Class
differed per platform (run 42311003287).

macos-hosted now runs `cargo nextest run` of the os_sensitive packages in the
native dev shell (92 tests; they pass on a Mac, checked locally). The cost is
macOS minutes on a public repository, which are free, and a compile of four
crates and their dependencies, a few minutes without a cache. docs/dev/ci.md
says so.
2026-11-06 16:07:50 -08:00

70 lines
2.9 KiB
YAML

# The macOS jobs, called by ci.yaml on a hosted runner.
name: macos
on:
workflow_call:
inputs:
runs-on:
description: The runner, as JSON, for example '"macos-latest"'
type: string
required: true
permissions:
contents: read
jobs:
macos:
runs-on: ${{ fromJSON(inputs.runs-on) }}
timeout-minutes: 120
env:
# a symlinked TMPDIR (/var/folders -> /private/var/folders) breaks a test of the recorder: the
# cargo steps run in a canonical one
TMPDIR: /private/tmp/komorebi-ci-${{ github.run_id }}-${{ github.run_attempt }}
steps:
- run: mkdir -p "$TMPDIR"
- uses: actions/checkout@v6
- uses: ./.github/actions/nix
with:
cachix-cache: ${{ vars.CACHIX_CACHE }}
cachix-auth-token: ${{ secrets.CACHIX_AUTH_TOKEN }}
- name: The macOS checks
run: nix build -L --no-link .#checkSets.macos-lint .#checkSets.macos-test .#checkSets.macos-options
# the recorder's tests of the macOS sources (oslog, av, capture, platform, power, system state): the
# filterset is tools/test-partition's. It runs in the native shell: the default one exports
# CARGO_BUILD_TARGET=x86_64-pc-windows-msvc, and nextest cannot list the tests of a Windows .exe on a Mac
- name: The recorder's macOS tests
run: |
# shellcheck disable=SC2016
nix develop .#native --command bash -c 'cargo nextest run --locked -p komorebi-recorder -E "$(tools/test-partition expr recorder-macos)"'
# the packages whose tests depend on the OS (tools/test-partition.json, class os_sensitive: the wording
# of the identifiers, the schemas, the pages of the cli) run on each platform they describe, as
# windows-native-test does on Windows: the checked-in pages of docs/macos/cli are what only a macOS
# host renders. macos-nextest above runs the macOS packages only
- name: The OS-sensitive tests
run: |
# shellcheck disable=SC2016
nix develop .#native --command bash -c 'cargo nextest run --locked $(tools/test-partition packages os_sensitive)'
- name: The binaries
run: |
nix build -L --no-link --print-out-paths .#komorebi .#komorebic .#komorebi-bar |
while read -r out; do
for bin in "$out"/bin/*; do "$bin" --version; done
done
- name: The schemas are current
run: |
nix develop --command just jsonschema
git diff --exit-code schemas/macos
- name: Logs of a failed run
if: failure()
run: |
mkdir -p "$RUNNER_TEMP/logs"
cp -R "$TMPDIR"/. "$RUNNER_TEMP/logs/" 2>/dev/null || true
- if: failure()
uses: actions/upload-artifact@v7
with:
name: ci-macos-logs-${{ github.run_id }}-${{ github.run_attempt }}
path: ${{ runner.temp }}/logs
if-no-files-found: ignore
retention-days: 7