magic-nix-cache/.github/workflows/build.yaml

80 lines
2.2 KiB
YAML

name: Build artifacts
on:
pull_request:
push:
workflow_dispatch:
jobs:
build-artifacts-macOS:
runs-on: macos-12
steps:
- uses: actions/checkout@v3
- uses: DeterminateSystems/nix-installer-action-cache@main
- name: "Build something"
run: "nix develop -c cargo build --release"
- name: Upload a Build Artifact
uses: actions/upload-artifact@v3.1.2
with:
# Artifact name
name: nix-actions-cache-macOS
path: target/release/nix-actions-cache
retention-days: 1
check-artifacts-macOS:
runs-on: macos-12
needs: build-artifacts-macOS
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: nix-actions-cache-macOS
path: cache-binary
- name: Make the binary executable
run: chmod +x ./cache-binary/nix-actions-cache
- uses: DeterminateSystems/nix-installer-action-cache@main
with:
cache-binary: ./cache-binary/nix-actions-cache
- name: "Build something"
run: "nix develop -c date"
build-artifacts-Linux:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: DeterminateSystems/nix-installer-action-cache@main
- name: "Build something"
run: "nix develop -c cargo build --release --target x86_64-unknown-linux-musl"
- name: Upload a Build Artifact
uses: actions/upload-artifact@v3.1.2
with:
# Artifact name
name: nix-actions-cache-Linux
path: target/x86_64-unknown-linux-musl/release/nix-actions-cache
retention-days: 1
check-artifacts-Linux:
runs-on: ubuntu-22.04
needs: build-artifacts-Linux
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: nix-actions-cache-Linux
path: cache-binary
- name: Make the binary executable
run: chmod +x ./cache-binary/nix-actions-cache
- uses: DeterminateSystems/nix-installer-action-cache@main
with:
cache-binary: ./cache-binary/nix-actions-cache
- name: "Build something"
run: "nix develop -c date"