Use matrix strategy
This commit is contained in:
parent
e85ce91771
commit
cce0d218c8
42
.github/workflows/test.yaml
vendored
42
.github/workflows/test.yaml
vendored
|
@ -6,11 +6,21 @@ on:
|
||||||
branches: [main]
|
branches: [main]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-linux:
|
build-closure:
|
||||||
runs-on: ubuntu-22.04
|
strategy:
|
||||||
|
matrix:
|
||||||
|
runner:
|
||||||
|
- ubuntu-22.04
|
||||||
|
- namespace-profile-default-arm64
|
||||||
|
- macos-12
|
||||||
|
- macos-latest-xlarge
|
||||||
|
runs-on: ${{ matrix.runner }}
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
id-token: write
|
id-token: write
|
||||||
|
env:
|
||||||
|
CLOSURE_FILE: magic-nix-cache.${{ matrix.runner }}.closure.xz
|
||||||
|
CLOSURE_KEY: magic-nix-cache-${{ matrix.runner }}-${{ github.sha }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
@ -20,26 +30,38 @@ jobs:
|
||||||
- uses: DeterminateSystems/magic-nix-cache-action@main
|
- uses: DeterminateSystems/magic-nix-cache-action@main
|
||||||
|
|
||||||
- name: Build package
|
- name: Build package
|
||||||
run: "nix build .# -L --fallback && nix-store --export $(nix-store -qR ./result) | xz -9 > magic-nix-cache.closure.xz"
|
run: |
|
||||||
|
nix build .# -L --fallback && \
|
||||||
|
nix-store --export $(nix-store -qR ./result) | xz -9 > "${{ env.CLOSURE_FILE }}"
|
||||||
|
|
||||||
- name: Cache magix-nix-cache closure
|
- name: Cache magix-nix-cache closure
|
||||||
uses: actions/cache/save@v4
|
uses: actions/cache/save@v4
|
||||||
with:
|
with:
|
||||||
path: magic-nix-cache.closure.xz
|
path: ${{ env.CLOSURE_FILE }}
|
||||||
key: magic-nix-cache-${{ github.sha }}
|
key: ${{ env.CLOSURE_KEY }}
|
||||||
|
|
||||||
test-magic-nix-cache-action:
|
test-magic-nix-cache-action:
|
||||||
needs: build-linux
|
needs: build-closure
|
||||||
runs-on: ubuntu-22.04
|
strategy:
|
||||||
|
matrix:
|
||||||
|
runner:
|
||||||
|
- ubuntu-22.04
|
||||||
|
- namespace-profile-default-arm64
|
||||||
|
- macos-12
|
||||||
|
- macos-latest-xlarge
|
||||||
|
runs-on: ${{ matrix.runner }}
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
id-token: write
|
id-token: write
|
||||||
|
env:
|
||||||
|
CLOSURE_FILE: magic-nix-cache.${{ matrix.runner }}.closure.xz
|
||||||
|
CLOSURE_KEY: magic-nix-cache-${{ matrix.runner }}-${{ github.sha }}
|
||||||
steps:
|
steps:
|
||||||
- name: Restore magix-nix-cache closure
|
- name: Restore magix-nix-cache closure
|
||||||
uses: actions/cache/restore@v4
|
uses: actions/cache/restore@v4
|
||||||
with:
|
with:
|
||||||
path: magic-nix-cache.closure.xz
|
path: ${{ env.CLOSURE_FILE }}
|
||||||
key: magic-nix-cache-${{ github.sha }}
|
key: ${{ env.CLOSURE_KEY }}
|
||||||
fail-on-cache-miss: true
|
fail-on-cache-miss: true
|
||||||
|
|
||||||
- name: Install Nix
|
- name: Install Nix
|
||||||
|
@ -48,7 +70,7 @@ jobs:
|
||||||
- name: Extract
|
- name: Extract
|
||||||
id: extract
|
id: extract
|
||||||
run: |
|
run: |
|
||||||
OUTPUT=$(cat magic-nix-cache.closure.xz | xz -d | nix-store --import)
|
OUTPUT=$(cat ${{ env.CLOSURE_FILE }} | xz -d | nix-store --import)
|
||||||
MNC_BIN_PATH=$(echo "${OUTPUT}" | tail -n 1)
|
MNC_BIN_PATH=$(echo "${OUTPUT}" | tail -n 1)
|
||||||
MAGIC_NIX_CACHE="${MNC_BIN_PATH}/bin/magic-nix-cache"
|
MAGIC_NIX_CACHE="${MNC_BIN_PATH}/bin/magic-nix-cache"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue