From 763508d326fb65b3bb401fd862db1e29ef81864f Mon Sep 17 00:00:00 2001 From: Luc Perkins Date: Thu, 16 May 2024 15:52:18 -0300 Subject: [PATCH] Use matrix for build.yaml --- .github/workflows/build.yaml | 99 +++++++----------------------------- 1 file changed, 18 insertions(+), 81 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 653bc07..0cffe12 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -5,18 +5,30 @@ on: workflow_call: jobs: - build-artifacts-ARM64-macOS: - runs-on: macos-latest-xlarge + build-artifacts: + runs-on: ${{ matrix.systems.runner }} + strategy: + matrix: + systems: + - nix-system: x86_64-linux + system: X64-Linux + runner: ubuntu-22.04 + - nix-system: aarch64-linux + system: ARM64-Linux + runner: namespace-profile-default-arm64 + - nix-system: x86_64-darwin + system: X64-macOS + runner: macos-12 + - nix-system: aarch64-darwin + system: ARM64-macOS + runner: macos-latest-xlarge permissions: contents: read id-token: write steps: - uses: actions/checkout@v3 - - uses: DeterminateSystems/nix-installer-action@main - - uses: DeterminateSystems/magic-nix-cache-action@main - - name: Build package run: "nix build .# -L --fallback && nix-store --export $(nix-store -qR ./result) | xz -9 > magic-nix-cache.closure.xz" @@ -24,81 +36,6 @@ jobs: uses: actions/upload-artifact@v3.1.2 with: # Artifact name - name: magic-nix-cache-ARM64-macOS - path: magic-nix-cache.closure.xz - retention-days: 1 - - build-artifacts-X64-macOS: - runs-on: macos-12 - permissions: - contents: read - id-token: write - steps: - - uses: actions/checkout@v3 - - - uses: DeterminateSystems/flake-checker-action@main - - - uses: DeterminateSystems/nix-installer-action@main - - - uses: DeterminateSystems/magic-nix-cache-action@main - - - name: Build package - run: "nix build .# -L --fallback && nix-store --export $(nix-store -qR ./result) | xz -9 > magic-nix-cache.closure.xz" - - - name: Upload a Build Artifact - uses: actions/upload-artifact@v3.1.2 - with: - # Artifact name - name: magic-nix-cache-X64-macOS - path: magic-nix-cache.closure.xz - retention-days: 1 - - build-artifacts-X64-Linux: - runs-on: ubuntu-22.04 - permissions: - contents: read - id-token: write - steps: - - uses: actions/checkout@v3 - - - uses: DeterminateSystems/flake-checker-action@main - - - uses: DeterminateSystems/nix-installer-action@main - - - uses: DeterminateSystems/magic-nix-cache-action@main - - - name: Build package - run: "nix build .# -L --fallback && nix-store --export $(nix-store -qR ./result) | xz -9 > magic-nix-cache.closure.xz" - - - name: Upload a Build Artifact - uses: actions/upload-artifact@v3.1.2 - with: - # Artifact name - name: magic-nix-cache-X64-Linux - path: magic-nix-cache.closure.xz - retention-days: 1 - - build-artifacts-ARM64-Linux: - runs-on: namespace-profile-default-arm64 - permissions: - contents: read - id-token: write - steps: - - uses: actions/checkout@v3 - - - uses: DeterminateSystems/flake-checker-action@main - - - uses: DeterminateSystems/nix-installer-action@main - - - uses: DeterminateSystems/magic-nix-cache-action@main - - - name: Build package - run: "nix build .# -L --fallback && nix-store --export $(nix-store -qR ./result) | xz -9 > magic-nix-cache.closure.xz" - - - name: Upload a Build Artifact - uses: actions/upload-artifact@v3.1.2 - with: - # Artifact name - name: magic-nix-cache-ARM64-Linux + name: magic-nix-cache-${{ matrix.systems.system }} path: magic-nix-cache.closure.xz retention-days: 1