Skip to content

Commit

Permalink
Merge pull request #107 from DeterminateSystems/matrix-build
Browse files Browse the repository at this point in the history
Use matrix build for artifacts
  • Loading branch information
lucperkins authored May 18, 2024
2 parents d334364 + d871bec commit b74afe2
Showing 1 changed file with 31 additions and 63 deletions.
94 changes: 31 additions & 63 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,84 +2,52 @@ name: Build fh artifacts

on:
workflow_call:
workflow_dispatch:
pull_request:
push:
branches: [main]

jobs:
build-artifacts-ARM64-macOS:
runs-on: macos-latest-xlarge
build-artifacts:
runs-on: ${{ matrix.systems.runner }}
permissions:
id-token: "write"
contents: "read"
strategy:
matrix:
systems:
- nix-system: "aarch64-darwin"
runner: "macos-latest-xlarge"
artifact: "fh-ARM64-macOS"
- nix-system: "x86_64-darwin"
runner: "macos-12"
artifact: "fh-X64-macOS"
- nix-system: "aarch64-linux"
runner: "namespace-profile-default-arm64"
artifact: "fh-X64-Linux"
- nix-system: "x86_64-linux"
runner: "ubuntu-22.04"
artifact: "fh-ARM64-linux"
steps:
- uses: actions/checkout@v3
- name: git checkout
uses: actions/checkout@v4

- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main

- name: Build package
run: |
nix build .# -L
- name: Upload a Build Artifact
uses: actions/[email protected]
with:
name: fh-ARM64-macOS
path: result/bin/fh
retention-days: 1

build-artifacts-X64-macOS:
runs-on: macos-12
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
- name: Upload a Build Artifact
uses: actions/[email protected]
- name: Set up Nix cache
uses: DeterminateSystems/magic-nix-cache-action@main
with:
name: fh-X64-macOS
path: result/bin/fh
retention-days: 1

build-artifacts-X64-Linux:
runs-on: UbuntuLatest32Cores128G
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
- name: Upload a Build Artifact
uses: actions/[email protected]
with:
name: fh-X64-Linux
path: result/bin/fh
retention-days: 1

build-artifacts-ARM64-Linux:
runs-on: namespace-profile-default-arm64
steps:
- uses: actions/checkout@v3

- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
use-flakehub: true

- name: Build package
- name: Build package for ${{ matrix.systems.nix-system }}
run: |
nix build .# -L
nix build -L ".#packages.${{ matrix.systems.nix-system }}.default"
- name: Upload a Build Artifact
uses: actions/[email protected]
with:
# Artifact name
name: fh-ARM64-Linux
name: ${{ matrix.systems.artifact }}
path: result/bin/fh
retention-days: 1

0 comments on commit b74afe2

Please sign in to comment.