diff --git a/.github/workflows/_macos.yaml b/.github/workflows/_macos.yaml index 57fc1f89..fa67e790 100644 --- a/.github/workflows/_macos.yaml +++ b/.github/workflows/_macos.yaml @@ -30,13 +30,14 @@ jobs: 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 + # the whole test suite of the recorder, 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. Its tests are platform-neutral by module but worded in `cfg!(target_os = "macos")` branches + # (the options of a recording, the keys of the viewer, the frames), and a Linux or Windows run takes + # the other side of each: only a Mac takes this one. A filter of the macOS modules selected 36 of the 731 + - name: The recorder's 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)"' + nix develop .#native --command cargo nextest run --locked -p komorebi-recorder # 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 @@ -45,6 +46,15 @@ jobs: run: | # shellcheck disable=SC2016 nix develop .#native --command bash -c 'cargo nextest run --locked $(tools/test-partition packages os_sensitive)' + # the programs of the e2e guests (class `tool`): the test window and the agent have macOS sources + # (AppKit, the accessibility API) that no other job compiles, and the tests of the test window's + # command line; clippy sees the sources the tests do not run + - name: The e2e tools + run: | + nix develop .#native --command bash -euo pipefail -c ' + cargo nextest run --locked -p komorebi-testwin -p komorebi-e2e-agent --no-tests=pass + cargo clippy --locked --all-targets -p komorebi-testwin -p komorebi-e2e-agent -- -D warnings + ' - name: The binaries run: | nix build -L --no-link --print-out-paths .#komorebi .#komorebic .#komorebi-bar | diff --git a/docs/dev/ci.md b/docs/dev/ci.md index 21ccd6ac..3b27ecbb 100644 --- a/docs/dev/ci.md +++ b/docs/dev/ci.md @@ -27,7 +27,7 @@ each is `success` or `skipped`: it is the only check a ruleset needs to require. | 3 | `test` (4 legs) | ubuntu-24.04, nix | `checkSets.{linux-test,windows-test,recorder-test,nixgen-test}`: Linux tests, the Windows test executables cross-built (not run), the recorder's and nixgen's tests | always | | 3 | `windows-native-test` | windows-latest | `cargo nextest` of the `windows` and `os_sensitive` classes of `tools/test-partition` | Windows or shared paths | | 3 | `windows-native-test-arm` | windows-11-arm | the same on ARM | label `ci:win-arm`; a push to master with Windows paths; by hand | -| 3 | `macos-hosted` | macos-latest (`_macos.yaml`) | the macOS checks, the recorder's macOS tests and the `os_sensitive` packages of `tools/test-partition` (both in `nix develop .#native`: the default shell builds for Windows), the binaries, the schemas | macOS paths | +| 3 | `macos-hosted` | macos-latest (`_macos.yaml`) | the macOS checks, the whole test suite of the recorder, the `os_sensitive` packages of `tools/test-partition` and the tests and clippy of the e2e tools (all in `nix develop .#native`: the default shell builds for Windows), the binaries, the schemas | macOS paths | | 4 | `discover`, `vm-fast` | ubuntu-24.04, KVM | the fast tier of the KDE VM suites, one machine each (`max-parallel: 8`, 45 minutes), a machine with no KVM drawn again (`_vm.yaml`, see KVM) | Linux paths; label `ci:vm`; every push to master | Beside the ladder: @@ -69,7 +69,7 @@ installs nextest on the Windows runners, which have no nix, and `windows.yaml` ( |---|---|---|---| | format | `fmt`, `checkSets.fmt` | the same | the same | | clippy | `lint` (cross build) | `lint` | `macos-hosted` only (`macos-lint`); `mac-typecheck` type-checks on Linux | -| unit tests | `windows-native-test` on Windows, and `windows.yaml` on every event | `test` (`linux-test`) | `macos-hosted` only (the macOS packages, and the `os_sensitive` ones natively) | +| unit tests | `windows-native-test` on Windows, and `windows.yaml` on every event | `test` (`linux-test`) | `macos-hosted` only (the macOS packages, the `os_sensitive` ones and the whole recorder natively, and the e2e tools) | | integration | none (the guest is experimental: `windows-guest.yaml`) | `vm-fast`, `vm-slow` | none in CI; by hand on a Mac: `nix run .#e2e-macos` (a Tart guest, `e2e/platforms/tart_macos`) | | options and schemas | `linux-options`, `macos-options` on Linux; the Windows schemas are checked by the Windows e2e Python | `linux-options` | `macos-options` on Linux; the schemas by `macos-hosted` | @@ -98,7 +98,7 @@ workflows do not publish anything, use no `write-all`, and use their own concurr it has been green for a while, the test step of `windows.yaml` can be removed by the owner of that file. - The partition (`tools/test-partition.json`) puts `komorebi-windows` in the class `windows` and `komorebi-config`, `-protocol`, `-transport` and `komorebic-core` in `os_sensitive`: those are what `windows-native-test` runs, and what `macos-hosted` runs on macOS: a test that renders text worded per platform (`docs_cli` of `komorebic-core` checks the pages of `docs/macos/cli`, and - skips on every host but a Mac) can only pass on the host whose wording it checks, so it is not covered by the `linux-test` run of the same package. `komorebi-client`, `komorebi-bar` and `komorebi-recorder` are `mixed`, so a platform job names them with `-p`. The nix set `windows-test` builds the + skips on every host but a Mac) can only pass on the host whose wording it checks, so it is not covered by the `linux-test` run of the same package. `komorebi-client`, `komorebi-bar` and `komorebi-recorder` are `mixed`, so a platform job names them with `-p`: `macos-hosted` runs the whole recorder (its tests are worded in `cfg!(target_os = "macos")` branches, and a Linux or Windows run takes the other side of each; a filter of the macOS modules once selected 36 of 731). The e2e tools (`tool`: the test window and the agent of the guests) have macOS sources that only that job compiles, so it runs their tests and clippy. The nix set `windows-test` builds the same subset; the whole suite is the set `windows-test-full` (not in the default sets, so not in `ci`) and `just test-windows-full`. - Both run `cargo-deny`; `ci / deny` is the cheaper copy and stops the ladder first. - `actionlint` in `hygiene` leaves `windows.yaml` out: it reads the PowerShell of that file as bash. `just lint` runs it on every workflow and fails on that file. diff --git a/tools/README.md b/tools/README.md index e54f579b..7fa00861 100644 --- a/tools/README.md +++ b/tools/README.md @@ -133,9 +133,10 @@ justfile and the Nix check sets (`nix/windows/flake-module.nix`) read it, so the `tools/test-partition check` fails when a member is in no class or in two, when a name is not a member, and when a `neutral` package is not neutral. `packages CLASS` prints `-p a -p b`; `expr CLASS` prints the nextest filterset -`package(a) | package(b)`. `expr recorder-macos` is the filterset of the recorder tests that run on macOS (the macOS -flavoured modules `sources::oslog`, `av`, `capture::sck`, `platform`, `power`, `system_state`: 36 tests); run it with -`cargo nextest run -p komorebi-recorder -E "$(tools/test-partition expr recorder-macos)"`. `komorebi-bar` has one +`package(a) | package(b)`. The recorder is `mixed`, and its tests are worded in `cfg!(target_os = "macos")` branches +as much as in modules, so a macOS run takes the whole suite (`cargo nextest run -p komorebi-recorder`, 731 tests, about +30 s): a filter of the macOS modules once selected 36 of them and left the macOS side of the rest untested. +`komorebi-bar` has one Windows-only test and `komorebi-client` Linux-only ones: their jobs name the package with `-p`, the partition says only that the package is in no platform's default list. `tools/test-partition --self-test` (`just test-partition-check`) runs `check` on the tree and on deliberately broken copies of the classification. diff --git a/tools/test-partition b/tools/test-partition index b44739eb..5f594669 100755 --- a/tools/test-partition +++ b/tools/test-partition @@ -4,8 +4,6 @@ # tools/test-partition check fail when the classification and the workspace disagree # tools/test-partition packages print `-p a -p b` for cargo # tools/test-partition expr print a nextest filterset: `package(a) | package(b)` -# tools/test-partition expr recorder-macos -# the filterset of the recorder tests that run on macOS # tools/test-partition --self-test run `check` against the tree and against deliberately broken copies # # The classification is tools/test-partition.json (class -> package names); it is the single source of truth @@ -23,10 +21,6 @@ classes="neutral os_sensitive windows linux macos mixed tool none" # the crates a `neutral` package must not depend on, directly platform_crates='["komorebi-windows","komorebi-macos","komorebi-linux"]' -# the tests of the recorder that run on macOS, by their module path: the macOS flavoured sources, which -# the recorder's other tests (the platform-neutral ones) share a binary with -recorder_macos_filter='package(komorebi-recorder) & test(/^(sources::oslog|av|capture::sck|platform|power|system_state)::/)' - die() { echo "test-partition: $*" >&2 exit 1 @@ -106,10 +100,6 @@ case "$cmd" in ;; expr) class=${2:-} - if [ "$class" = recorder-macos ]; then - echo "$recorder_macos_filter" - exit 0 - fi valid_class "$class" || die "unknown class '$class' (one of: $classes)" members_of "$class" | sed 's/.*/package(&)/' | paste -sd'|' - | sed 's/|/ | /g' ;; @@ -117,7 +107,7 @@ case "$cmd" in exec "$root/tools/test-partition.test" "$root/tools/test-partition" ;; *) - sed -n '2,9p' "$0" | sed 's/^# \{0,1\}//' >&2 + sed -n '2,7p' "$0" | sed 's/^# \{0,1\}//' >&2 exit 2 ;; esac