Some final cleanup
This commit is contained in:
parent
03d4aa5f66
commit
66317827ea
28
.github/workflows/build.yaml
vendored
28
.github/workflows/build.yaml
vendored
|
@ -7,9 +7,12 @@ on:
|
||||||
jobs:
|
jobs:
|
||||||
build-artifacts:
|
build-artifacts:
|
||||||
runs-on: ${{ matrix.systems.runner }}
|
runs-on: ${{ matrix.systems.runner }}
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
id-token: write
|
||||||
env:
|
env:
|
||||||
CLOSURE_NAME: magic-nix-cache-${{ matrix.systems.system }}
|
ARTIFACT_KEY: magic-nix-cache-${{ matrix.systems.system }}
|
||||||
ARCHIVE: magic-nix-cache.closure.xz
|
ARCHIVE_NAME: magic-nix-cache.closure.xz
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
systems:
|
systems:
|
||||||
|
@ -25,27 +28,26 @@ jobs:
|
||||||
- nix-system: aarch64-darwin
|
- nix-system: aarch64-darwin
|
||||||
system: ARM64-macOS
|
system: ARM64-macOS
|
||||||
runner: macos-latest-xlarge
|
runner: macos-latest-xlarge
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
id-token: write
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- uses: DeterminateSystems/nix-installer-action@main
|
- name: Install Nix on ${{ matrix.systems.system }}
|
||||||
- uses: DeterminateSystems/magic-nix-cache-action@main
|
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: |
|
run: |
|
||||||
nix build ".#devShells.${{ matrix.systems.nix-system }}.default"
|
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: |
|
run: |
|
||||||
nix build .# -L --fallback && \
|
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
|
uses: actions/upload-artifact@v3.1.2
|
||||||
with:
|
with:
|
||||||
# Artifact name
|
# Artifact name
|
||||||
name: ${{ env.CLOSURE_NAME }}
|
name: ${{ env.ARTIFACT_KEY }}
|
||||||
path: ${{ env.ARCHIVE }}
|
path: ${{ env.ARCHIVE_NAME }}
|
||||||
retention-days: 1
|
retention-days: 1
|
||||||
|
|
20
.github/workflows/check-and-test.yaml
vendored
20
.github/workflows/check-and-test.yaml
vendored
|
@ -41,9 +41,8 @@ jobs:
|
||||||
runs-on: ${{ matrix.systems.runner }}
|
runs-on: ${{ matrix.systems.runner }}
|
||||||
needs: build
|
needs: build
|
||||||
env:
|
env:
|
||||||
CLOSURE_NAME: magic-nix-cache-${{ matrix.systems.system }}
|
ARTIFACT_KEY: magic-nix-cache-${{ matrix.systems.system }}
|
||||||
CLOSURE_PATH: magic-nix-cache
|
ARCHIVE_NAME: magic-nix-cache.closure.xz
|
||||||
ARCHIVE: magic-nix-cache.closure.xz
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
systems:
|
systems:
|
||||||
|
@ -59,25 +58,26 @@ jobs:
|
||||||
contents: read
|
contents: read
|
||||||
id-token: write
|
id-token: write
|
||||||
steps:
|
steps:
|
||||||
- name: Download artifact
|
- name: Download closure for ${{ matrix.systems.system }}
|
||||||
uses: actions/download-artifact@v3
|
uses: actions/download-artifact@v3
|
||||||
with:
|
with:
|
||||||
name: ${{ env.CLOSURE_NAME }}
|
name: ${{ env.ARTIFACT_KEY }}
|
||||||
path: ${{ env.CLOSURE_PATH }}
|
path: ${{ env.ARTIFACT_KEY }}
|
||||||
|
|
||||||
- name: Install Nix
|
- name: Install Nix on ${{ matrix.systems.system }}
|
||||||
uses: DeterminateSystems/nix-installer-action@main
|
uses: DeterminateSystems/nix-installer-action@main
|
||||||
|
|
||||||
- name: Extract
|
- name: Extract closure for ${{ matrix.systems.system }}
|
||||||
id: extract
|
id: extract
|
||||||
run: |
|
run: |
|
||||||
ARTIFACT="${{ env.CLOSURE_PATH }}/${{ env.ARCHIVE }}"
|
ARTIFACT="${{ env.ARTIFACT_KEY }}/${{ env.ARCHIVE_NAME }}"
|
||||||
OUTPUT=$(cat ${ARTIFACT} | xz -d | nix-store --import)
|
OUTPUT=$(cat ${ARTIFACT} | 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"
|
||||||
|
|
||||||
echo "mnc-path=${MAGIC_NIX_CACHE}" >> "$GITHUB_OUTPUT"
|
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:
|
with:
|
||||||
source-binary: "${{ steps.extract.outputs.mnc-path }}"
|
source-binary: "${{ steps.extract.outputs.mnc-path }}"
|
||||||
|
|
Loading…
Reference in a new issue