Build and populate cache #42
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: | |
workflow_dispatch: | |
pull_request: | |
push: | |
branches: | |
- main | |
schedule: | |
# rebuild everyday at 3:35 | |
# TIP: Choose a random time here so not all repositories are build at once: | |
# https://www.random.org/clock-times/?num=1&earliest=01%3A00&latest=08%3A00&interval=5&format=html&rnd=new | |
- cron: '35 3 * * *' | |
jobs: | |
build-packages: | |
strategy: | |
fail-fast: false | |
matrix: | |
system: | |
- x86_64-linux | |
# - aarch64-linux | |
runs-on: ubuntu-latest | |
env: | |
GIT_SSL_NO_VERIFY: 'true' | |
steps: | |
- name: Maximize build space | |
uses: easimon/maximize-build-space@master | |
with: | |
root-reserve-mb: 512 | |
swap-size-mb: 1024 | |
build-mount-path: '/nix' | |
remove-dotnet: 'true' | |
remove-android: 'true' | |
remove-haskell: 'true' | |
remove-codeql: 'true' | |
remove-docker-images: 'true' | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
id: qemu | |
uses: docker/setup-qemu-action@v3 | |
with: | |
image: tonistiigi/binfmt:latest | |
platforms: all | |
- name: Install nix | |
uses: cachix/install-nix-action@v24 | |
with: | |
nix_path: nixpkgs=channel:nixos-unstable | |
extra_nix_config: | | |
experimental-features = nix-command flakes | |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} | |
extra-platforms = i686-linux aarch64-linux arm-linux | |
- name: Setup cachix | |
uses: cachix/cachix-action@v13 | |
with: | |
name: moraxyc | |
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}' | |
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}' | |
- name: Set nix daemon tmpdir path | |
run: | | |
sudo mkdir -p /nix/tmpdir | |
sudo chown $(whoami) /nix/tmpdir | |
cat > override.conf <<EOF | |
[Service] | |
Environment="TMPDIR=/nix/tmpdir" | |
EOF | |
sudo mkdir /etc/systemd/system/nix-daemon.service.d/ | |
sudo mv override.conf /etc/systemd/system/nix-daemon.service.d/override.conf | |
sudo systemctl daemon-reload | |
sudo systemctl restart nix-daemon | |
- name: Build nix packages | |
run: | | |
nix flake update | |
env TMPDIR=/nix/tmpdir nix run .#ci -- ${{ matrix.system }} | |
test-nur-eval: | |
strategy: | |
fail-fast: false | |
matrix: | |
system: | |
- x86_64-linux | |
# - aarch64-linux | |
runs-on: ubuntu-latest | |
env: | |
GIT_SSL_NO_VERIFY: 'true' | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
id: qemu | |
uses: docker/setup-qemu-action@v3 | |
with: | |
image: tonistiigi/binfmt:latest | |
platforms: all | |
- name: Install nix | |
uses: cachix/install-nix-action@v24 | |
with: | |
nix_path: nixpkgs=channel:nixos-unstable | |
extra_nix_config: | | |
experimental-features = nix-command flakes | |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} | |
extra-platforms = i686-linux aarch64-linux arm-linux | |
- name: Build nix packages | |
run: | | |
nix run .#nur-check | |
# update-nur: | |
# runs-on: ubuntu-latest | |
# needs: | |
# - build-packages | |
# - test-nur-eval | |
# steps: | |
# - name: Trigger NUR update | |
# run: curl -XPOST "https://nur-update.nix-community.org/update?repo=moraxyc" |