Some final cleanup

This commit is contained in:
Luc Perkins 2024-05-18 17:21:03 -03:00
parent 03d4aa5f66
commit 66317827ea
No known key found for this signature in database
GPG key ID: 16DB1108FB591835
2 changed files with 25 additions and 23 deletions

View file

@ -7,9 +7,12 @@ on:
jobs:
build-artifacts:
runs-on: ${{ matrix.systems.runner }}
permissions:
contents: read
id-token: write
env:
CLOSURE_NAME: magic-nix-cache-${{ matrix.systems.system }}
ARCHIVE: magic-nix-cache.closure.xz
ARTIFACT_KEY: magic-nix-cache-${{ matrix.systems.system }}
ARCHIVE_NAME: magic-nix-cache.closure.xz
strategy:
matrix:
systems:
@ -25,27 +28,26 @@ jobs:
- 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: Install Nix on ${{ matrix.systems.system }}
uses: DeterminateSystems/nix-installer-action@main
- name: Magic Nix Cache
uses: DeterminateSystems/magic-nix-cache-action@main
- name: Build and cache dev shell
- name: Build and cache dev shell for ${{ matrix.systems.nix-system }}
run: |
nix build ".#devShells.${{ matrix.systems.nix-system }}.default"
- name: Build package and create closure
- name: Build package and create closure for ${{ matrix.systems.system }}
run: |
nix build .# -L --fallback && \
nix-store --export $(nix-store -qR ./result) | xz -9 > "${{ env.ARCHIVE }}"
nix-store --export $(nix-store -qR ./result) | xz -9 > "${{ env.ARCHIVE_NAME }}"
- name: Upload a Build Artifact
- name: Upload magic-nix-cache closure for ${{ matrix.systems.system }}
uses: actions/upload-artifact@v3.1.2
with:
# Artifact name
name: ${{ env.CLOSURE_NAME }}
path: ${{ env.ARCHIVE }}
name: ${{ env.ARTIFACT_KEY }}
path: ${{ env.ARCHIVE_NAME }}
retention-days: 1

View file

@ -41,9 +41,8 @@ jobs:
runs-on: ${{ matrix.systems.runner }}
needs: build
env:
CLOSURE_NAME: magic-nix-cache-${{ matrix.systems.system }}
CLOSURE_PATH: magic-nix-cache
ARCHIVE: magic-nix-cache.closure.xz
ARTIFACT_KEY: magic-nix-cache-${{ matrix.systems.system }}
ARCHIVE_NAME: magic-nix-cache.closure.xz
strategy:
matrix:
systems:
@ -59,25 +58,26 @@ jobs:
contents: read
id-token: write
steps:
- name: Download artifact
- name: Download closure for ${{ matrix.systems.system }}
uses: actions/download-artifact@v3
with:
name: ${{ env.CLOSURE_NAME }}
path: ${{ env.CLOSURE_PATH }}
name: ${{ env.ARTIFACT_KEY }}
path: ${{ env.ARTIFACT_KEY }}
- name: Install Nix
- name: Install Nix on ${{ matrix.systems.system }}
uses: DeterminateSystems/nix-installer-action@main
- name: Extract
- name: Extract closure for ${{ matrix.systems.system }}
id: extract
run: |
ARTIFACT="${{ env.CLOSURE_PATH }}/${{ env.ARCHIVE }}"
ARTIFACT="${{ env.ARTIFACT_KEY }}/${{ env.ARCHIVE_NAME }}"
OUTPUT=$(cat ${ARTIFACT} | xz -d | nix-store --import)
MNC_BIN_PATH=$(echo "${OUTPUT}" | tail -n 1)
MAGIC_NIX_CACHE="${MNC_BIN_PATH}/bin/magic-nix-cache"
echo "mnc-path=${MAGIC_NIX_CACHE}" >> "$GITHUB_OUTPUT"
- uses: DeterminateSystems/magic-nix-cache-action@main
- name: Test magic-nix-cache-action@main on ${{ matrix.systems.runner }}
uses: DeterminateSystems/magic-nix-cache-action@main
with:
source-binary: "${{ steps.extract.outputs.mnc-path }}"