Build and populate cache #1569
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: Build and populate cache | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
- master | |
schedule: | |
- cron: 15 5 * * * | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
concurrency: | |
group: ${{ github.workflow }} | |
cancel-in-progress: true | |
steps: | |
- name: Free disk space | |
uses: jlumbroso/free-disk-space@v1.3.1 | |
with: | |
tool-cache: true | |
# https://github.com/jlumbroso/free-disk-space/issues/4 | |
large-packages: false | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Install Nix | |
uses: DeterminateSystems/nix-installer-action@main | |
- name: Magic Nix Cache | |
uses: DeterminateSystems/magic-nix-cache-action@main | |
- name: Show nixpkgs version | |
run: nix-instantiate --eval -E '(import <nixpkgs> {}).lib.version' | |
- name: Setup cachix | |
uses: cachix/cachix-action@v15 | |
with: | |
name: bandithedoge | |
signingKey: ${{ secrets.CACHIX_SIGNING_KEY }} | |
authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} | |
extraPullNames: berberman | |
- name: Update sources | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
nix flake update | |
echo -e '[keys]\ngithub = "${{ secrets.GITHUB_TOKEN }}"' > keyfile.toml | |
chmod +x fetch | |
nix develop -c ./fetch | |
rm keyfile.toml | |
git add -A | |
- name: Format code | |
run: nix fmt | |
- name: Check evaluation | |
run: | | |
nix-env -f . -qa \* --meta --xml \ | |
--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 -build-flags '--show-trace' ci.nix -A cacheOutputs | |
- name: Trigger NUR update | |
run: curl -XPOST "https://nur-update.nix-community.org/update?repo=bandithedoge" | |
- name: Commit changes | |
uses: EndBug/add-and-commit@v9 | |
with: | |
default_author: github_actions | |
message: Update sources |