-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upload mac ARM build artifacts to cachix (#96)
For the Mac Arm self-hosted runners, cachix is already installed. Instead of using the cachix-install action, which uses bash to execute commands, we add our own scripts that use zsh to do upload the build artifacts to cachix after building.
- Loading branch information
Showing
4 changed files
with
75 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,11 +28,21 @@ jobs: | |
strategy: | ||
fail-fast: false | ||
matrix: | ||
package: [fuel, fuel-beta-1, fuel-beta-2, fuel-beta-3, fuel-beta-4-rc, fuel-nightly, sway-vim] | ||
package: | ||
[ | ||
fuel, | ||
fuel-beta-1, | ||
fuel-beta-2, | ||
fuel-beta-3, | ||
fuel-beta-4-rc, | ||
fuel-nightly, | ||
sway-vim, | ||
] | ||
os: [ubuntu-latest, macos-latest, macos-arm] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/[email protected] | ||
# Since the self-hosted runners already have nix and cachix installed, we skip these steps. | ||
- if: matrix.os != 'macos-arm' | ||
uses: cachix/install-nix-action@v22 | ||
with: | ||
|
@@ -42,7 +52,15 @@ jobs: | |
with: | ||
name: fuellabs | ||
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' | ||
# Copy the nix store to a tmp directory for later comparison. | ||
- if: matrix.os == 'macos-arm' | ||
run: ./script/list-nix-store.sh > /tmp/store-path-pre-build | ||
- run: nix build --print-build-logs --no-update-lock-file .#${{ matrix.package }} | ||
# Since we skipped the cachix action, we must manually update the cachix cache. | ||
- if: matrix.os == 'macos-arm' | ||
env: | ||
CACHIX_AUTH_TOKEN: ${{ secrets.CACHIX_AUTH_TOKEN }} | ||
run: ./script/cachix-push-paths.sh | ||
|
||
nix-develop: | ||
needs: nix-build | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/usr/bin/env zsh | ||
set -euo pipefail | ||
|
||
# Based on https://github.com/cachix/cachix-action/blob/master/dist/main/push-paths.sh | ||
|
||
pathsToPush=$(comm -13 <(sort /tmp/store-path-pre-build) <("$(dirname "$0")"/list-nix-store.sh)) | ||
|
||
echo "$pathsToPush" | cachix push "fuellabs" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/usr/bin/env zsh | ||
# Small utility to replace `nix path-info --all` | ||
set -euo pipefail | ||
|
||
# Borrowed from https://github.com/cachix/cachix-action/blob/master/dist/main/list-nix-store.sh | ||
|
||
for file in /nix/store/*; do | ||
case "$file" in | ||
*.drv) | ||
# Avoid .drv as they are not generally useful | ||
continue | ||
;; | ||
*.drv.chroot) | ||
# Avoid .drv.chroot as they are not generally useful | ||
continue | ||
;; | ||
*.check) | ||
# Skip .check file produced by --keep-failed | ||
continue | ||
;; | ||
*.lock) | ||
# Skip .lock files | ||
continue | ||
;; | ||
*) | ||
echo "$file" | ||
;; | ||
esac | ||
done |