Skip to content

chore: update nix versions #289

chore: update nix versions

chore: update nix versions #289

Workflow file for this run

name: CI/CD
on:
pull_request:
push:
branches:
- master
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
strategy:
fail-fast: true
matrix:
os: [ubuntu-22.04, macos-12]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: ./
with:
nix_archives_url: https://github.com/nixbuild/nix-quick-install-action/releases/download/v26
nix_version: 2.16.2
- uses: cachix/cachix-action@v12
with:
name: nixbuild
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
- name: Build nix archives
id: build-nix-archives
run: |
nix build .#nix-archives
echo "result=$(readlink result)" >> "$GITHUB_OUTPUT"
- uses: actions/upload-artifact@v3
with:
name: nix-archives-${{ runner.os }}
path: ${{ steps.build-nix-archives.outputs.result }}/
test:
needs: build
strategy:
fail-fast: true
matrix:
os:
- ubuntu-22.04
- ubuntu-20.04
- macos-12
- macos-11
nix_version:
- 2.19.3
- 2.18.1
- 2.17.1
- 2.16.2
- 2.15.3
- 2.14.1
- 2.13.6
- 2.12.1
- 2.11.1
- 2.10.3
- 2.9.2
- 2.8.1
- 2.7.0
- 2.6.1
- 2.5.1
- 2.4
- 2.3.17
- 2.2.2
- 2.1.3
- 2.0.4
exclude:
- os: macos-11
nix_version: 2.0.4
- os: macos-12
nix_version: 2.0.4
runs-on: ${{ matrix.os }}
steps:
- uses: divnix/nix-cache-action@v3.0.11-nix
with:
key: test-${{matrix.os}}-nix-${{matrix.nix_version}}-${{github.run_id}}-${{github.run_attempt}}
path: |
/nix
~/.cache/nix
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
id: nix-archives
with:
name: nix-archives-${{ runner.os }}
- uses: ./
with:
nix_archives_url: file://${{steps.nix-archives.outputs.download-path}}
nix_version: ${{ matrix.nix_version }}
nix_on_tmpfs: true
- name: Test nix
run: nix-build -v --version
- name: Add to store
run: |
file="$(mktemp)"
echo "$RANDOM" > "$file"
path="$(nix-store --add "$file")"
mkdir -p ~/.cache/nix
ln -s "$path" ~/.cache/nix/test-path
test-cachix:
needs: build
strategy:
fail-fast: true
matrix:
os:
- ubuntu-22.04
- ubuntu-20.04
- macos-12
- macos-11
nix_version:
- 2.19.3
- 2.18.1
- 2.17.1
- 2.16.2
- 2.15.3
- 2.14.1
- 2.13.6
- 2.12.1
- 2.11.1
- 2.10.3
- 2.9.2
- 2.8.1
- 2.7.0
- 2.6.1
- 2.5.1
- 2.4
- 2.3.17
- 2.2.2
include:
- nix_version: 2.12.1
nix_conf: experimental-features = nix-command
- nix_version: 2.11.1
nix_conf: experimental-features = nix-command
- nix_version: 2.10.3
nix_conf: experimental-features = nix-command
- nix_version: 2.9.2
nix_conf: experimental-features = nix-command
- nix_version: 2.8.1
nix_conf: experimental-features = nix-command
- nix_version: 2.7.0
nix_conf: experimental-features = nix-command
- nix_version: 2.6.1
nix_conf: experimental-features = nix-command
- nix_version: 2.5.1
nix_conf: experimental-features = nix-command
- nix_version: 2.4
nix_conf: experimental-features = nix-command
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
id: nix-archives
with:
name: nix-archives-${{ runner.os }}
- uses: ./
with:
nix_archives_url: file://${{steps.nix-archives.outputs.download-path}}
nix_version: ${{ matrix.nix_version }}
nix_conf: ${{ matrix.nix_conf }}
- uses: cachix/cachix-action@v12
with:
name: nixbuild
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
skipPush: true
- name: Verify nix config
run: |
if ! egrep -q "^substituters = https://cache.nixos.org https://nixbuild.cachix.org$" "$HOME/.config/nix/nix.conf"; then
echo "Invalid substituters config"
exit 1
fi
- name: Push to Cachix
if: github.event_name == 'push' && github.repository_owner == 'nixbuild'
run: |
dd if=/dev/urandom of=random count=1
cachix push nixbuild "$(nix add-to-store random)"
test-overwrite-nix-dir:
needs: test
strategy:
fail-fast: true
matrix:
os:
- ubuntu-22.04
- ubuntu-20.04
- macos-12
- macos-11
nix_version:
- 2.19.3
- 2.18.1
- 2.17.1
- 2.16.2
- 2.15.3
- 2.14.1
- 2.13.6
- 2.12.1
- 2.11.1
- 2.10.3
- 2.9.2
- 2.8.1
- 2.7.0
- 2.6.1
- 2.5.1
- 2.4
- 2.3.17
- 2.2.2
- 2.1.3
- 2.0.4
exclude:
- os: macos-11
nix_version: 2.0.4
- os: macos-12
nix_version: 2.0.4
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
id: nix-archives
with:
name: nix-archives-${{ runner.os }}
# For MacOS, we'll run our action before restoring the cache, in order
# to create the /nix directory, so the cache can be restored. Then we run
# the action again after the cache has been restored. I guess
# divnix/nix-cache-action could be changed to create the /nix directory
# on MacOS.
- name: Create /nix on MacOS
if: ${{ startsWith(matrix.os, 'macos-') }}
uses: ./
with:
nix_archives_url: file://${{steps.nix-archives.outputs.download-path}}
nix_version: ${{ matrix.nix_version }}
- name: Restore cache
uses: divnix/nix-cache-action@v3.0.11-nix
with:
key: test-${{matrix.os}}-nix-${{matrix.nix_version}}-${{github.run_id}}-${{github.run_attempt}}
path: |
/nix
~/.cache/nix
- uses: ./
with:
nix_archives_url: file://${{steps.nix-archives.outputs.download-path}}
nix_version: ${{ matrix.nix_version }}
nix_on_tmpfs: true
- name: Test nix
run: nix-build -v --version
- name: Verify store path
run: |
stat ~/.cache/nix/test-path
nix-store --verify-path ~/.cache/nix/test-path
test-nix-config-eval:
needs: build
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
id: nix-archives
with:
name: nix-archives-${{ runner.os }}
- uses: ./
with:
nix_archives_url: file://${{steps.nix-archives.outputs.download-path}}
- name: Verify Nix config
run: |
nix build --version # check if new style command is enabled
nix show-config | grep -q 'stalled-download-timeout = 333'
release:
runs-on: ubuntu-latest
needs:
- build
- test
- test-cachix
- test-overwrite-nix-dir
- test-nix-config-eval
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: nix-archives-Linux
path: /tmp/archives
- uses: actions/download-artifact@v3
with:
name: nix-archives-macOS
path: /tmp/archives
- uses: ./
with:
nix_archives_url: file:///tmp/archives
nix_version: 2.16.2
- uses: cachix/cachix-action@v12
with:
name: nixbuild
signingKey: '${{ secrets.CACHIX_SIGNING_KEY }}'
- name: Build release script
run: nix build .#release
- name: Release if needed
run: ./result/bin/release /tmp/archives ./RELEASE
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}