Update .github/workflows/holonix-cache.yaml #6
Workflow file for this run
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
name: "Holonix cache" | ||
Check failure on line 1 in .github/workflows/holonix-cache.yaml GitHub Actions / .github/workflows/holonix-cache.yamlInvalid workflow file
|
||
on: | ||
# Assume pushes to these branches imply changes that should be cached. If not then the workflow run will be | ||
# idempotent, so it won't do any harm. | ||
push: | ||
branches: | ||
- main | ||
- main-0.2 | ||
- main-0.3 | ||
# Because other things use the same cache, run once a day to make sure that the cache is up to date. | ||
schedule: | ||
- cron: "@daily" # run once a day | ||
# Allow the cache update to be run manually. | ||
workflow_dispatch: | ||
inputs: {} | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref_name }} | ||
cancel-in-progress: true | ||
jobs: | ||
# ensures the cache is regularly updated for the supported versions on multiple platforms | ||
cache-update: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ ubuntu-latest, macos-latest, macos-13 ] | ||
branch: [ main, main-0.2, main-0.3 ] | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: cachix/install-nix-action@v27 | ||
with: | ||
install_url: https://releases.nixos.org/nix/nix-2.22.1/install | ||
- uses: cachix/cachix-action@v15 | ||
with: | ||
name: holochain-ci | ||
- name: Cache default Holonix flake on [${{ matrix.branch }}] | ||
env: | ||
# NIX_CONFIG: "access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}" | ||
CACHIX_AUTH_TOKEN: "${{ secrets.CACHIX_AUTH_TOKEN }}" | ||
run: | | ||
# Create a workspace and initialise a new default Holonix flake | ||
cd $(mktemp -d) | ||
nix flake init -t "github:holochain/holonix/${{ matrix.branch }} | ||
# See https://docs.cachix.org/pushing#id1 | ||
nix develop --build -L --profile result-develop | ||
nix build -L --profile result-build | ||
# Push both results to the cache | ||
for i in result-*; do | ||
cachix push holochain-ci $i | ||
done | ||
cache-check: | ||
needs: | ||
- cache-update | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ ubuntu-latest, macos-latest, macos-13 ] | ||
branch: [ main, main-0.2, main-0.3 ] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: cachix/install-nix-action@v27 | ||
with: | ||
install_url: https://releases.nixos.org/nix/nix-2.22.1/install | ||
- uses: cachix/cachix-action@v15 | ||
with: | ||
name: holochain-ci | ||
- name: Check the Holonix cache | ||
uses: holochain/nix-cache-check@v1 | ||
# env: | ||
# NIX_CONFIG: "access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}" | ||
with: | ||
derivation: "github:holochain/holonix/${{ matrix.branch }}" # The default shell in the Holonix flake |