Skip to content

Build and populate cache #157

Build and populate cache

Build and populate cache #157

Workflow file for this run

name: "Build and populate cache"
on:
pull_request:
push:
branches:
- main
- master
schedule:
- cron: '35 6 * * *'
jobs:
tests:
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest, macos-latest]
# Set this to notify the global nur package registry that changes are
# available.
#
# The repo name as used in
# https://github.com/nix-community/NUR/blob/master/repos.json
nurRepo:
- <YOUR_REPO_NAME>
nixPath:
- nixpkgs=https://github.com/NixOS/nixpkgs/archive/refs/heads/nixos-unstable.tar.gz
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@main
with:
extra-conf: |
experimental-features = nix-command flakes
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }}
nix-path = "${{ matrix.nixPath }}"
- uses: DeterminateSystems/magic-nix-cache-action@main
- name: Show nixpkgs version
run: nix-instantiate --eval -E '(import <nixpkgs> {}).lib.version'
# - name: Connect to home tailnet
# uses: tailscale/github-action@v2
# with:
# authkey: ${{ secrets.TAILSCALE_AUTHKEY }}
- name: Setup Attic cache
uses: ryanccn/attic-action@v0
with:
endpoint: ${{ secrets.ATTIC_ENDPOINT }}
cache: ${{ secrets.ATTIC_CACHE }}
token: ${{ secrets.ATTIC_TOKEN }}
- name: Check evaluation
run: |
nix-env -f . -qa \* --meta --xml \
--allowed-uris https://static.rust-lang.org \
--option restrict-eval true \
--option allow-import-from-derivation true \
--drv-path --show-trace \
-I nixpkgs=$(nix-instantiate --find-file nixpkgs) \
-I $PWD
- name: Build nix packages
run: nix shell -f '<nixpkgs>' nix-build-uncached -c nix-build-uncached ci.nix -A cacheOutputs
- name: Trigger NUR update
# Don't replace <YOUR_REPO_NAME> here!
if: ${{ matrix.nurRepo != '<YOUR_REPO_NAME>' }}
run: curl -XPOST "https://nur-update.nix-community.org/update?repo=${{ matrix.nurRepo }}"