From f7472c37bc7ee3192c2e99b3e88bf172f75ffaee Mon Sep 17 00:00:00 2001 From: amusingimpala75 <69653100+amusingimpala75@users.noreply.github.com> Date: Tue, 19 May 2026 21:27:40 -0700 Subject: [PATCH] gha: maybe fix multi-runner actions? --- .github/workflows/#runner-package-list.nix# | 1 + .github/workflows/flake-check.yml | 19 ++++++++++--------- 2 files changed, 11 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/#runner-package-list.nix# diff --git a/.github/workflows/#runner-package-list.nix# b/.github/workflows/#runner-package-list.nix# new file mode 100644 index 0000000..a24cbfb --- /dev/null +++ b/.github/workflows/#runner-package-list.nix# @@ -0,0 +1 @@ +map (platform: map (package: ) platform)(builtins.getFlake ./.).packages \ No newline at end of file diff --git a/.github/workflows/flake-check.yml b/.github/workflows/flake-check.yml index 47af332..cf40e3d 100644 --- a/.github/workflows/flake-check.yml +++ b/.github/workflows/flake-check.yml @@ -22,12 +22,8 @@ jobs: run: nix -Lv flake check discover: - strategy: - matrix: - runner: [ ubuntu-latest, macos-latest ] - runs-on: ${{ matrix.runner }} + runs-on: ubuntu-latest outputs: - runner: ${{ matrix.runner }} matrix: ${{ steps.set.outputs.matrix }} steps: - uses: actions/checkout@v6 @@ -36,14 +32,18 @@ jobs: extra-conf: experimental-features = flakes nix-command pipe-operators - id: set run: | - matrix=$(nix eval --json .#packages.$(nix eval --impure --raw --expr 'builtins.currentSystem') | nix run nixpkgs#jq -- -c '{input: keys}') + matrix-macos=$(nix eval --json .#packages.aarch64-darwin | nix run nixpkgs#jq -- -c 'keys | map_values({key: ., value: "macos-latest"}) | from_entries') + matrix-linux=$(nix eval --json .#packages.x86_64-linux | nix run nixpkgs#jq -- -c 'keys | map_values({key: ., value: "ubuntu-latest"}) | from_entries') + matrix=$(echo "$matrix-macos\n$matrix-linux" | nix run nixpkgs#jq -s 'map(to_entries) | flatten | group_by(.key) | map({name: .[0].key, runners: [.[] | .value]})') echo "matrix=$matrix" >> "$GITHUB_OUTPUT" builds: needs: discover strategy: - matrix: ${{ fromJson(needs.discover.outputs.matrix) }} - runs-on: ${{ needs.discover.outputs.runner }} + matrix: + - package: ${{ fromJson(needs.discover.outputs.matrix) }} + - runner: [ ubuntu-latest, macos-latest ] + runs-on: ${{ matrix.runner }} steps: - uses: actions/checkout@v6 @@ -52,4 +52,5 @@ jobs: extra-conf: experimental-features = flakes nix-command pipe-operators - name: Build package - run: nix build .#${{ matrix.input }} + run: nix build .#${{ matrix.package.name }} + if: ${{ contains(matrix.package.runners, matrix.runner) }} -- knotmirror 0.0.1