install-nix-action/.github/workflows/test.yml
2024-06-20 15:56:32 +12:00

146 lines
3.9 KiB
YAML

name: "install-nix-action test"
on:
pull_request:
push:
branches:
- master
env:
nixpkgs_channel: nixpkgs=channel:nixos-23.11
oldest_supported_installer: nix-2.8.0
# Fetch new versions from the Nix CI run: https://github.com/NixOS/nix/blob/master/.github/workflows/ci.yml
# TODO: add pinning upstream or rethink this
pinned_installer_hash: zfzfrbb59jsqrfkldwj8drcr9nhhc49k
jobs:
simple-build:
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
- macos-13
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Install Nix
uses: ./
with:
nix_path: ${{ env.nixpkgs_channel }}
- run: nix-env -iA cachix -f https://cachix.org/api/v1/install
- run: cat /etc/nix/nix.conf
# cachix should be available and be able to configure a cache
- run: cachix use cachix
- run: nix-build test.nix
custom-nix-path:
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
- macos-13
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Install Nix
uses: ./
with:
nix_path: ${{ env.nixpkgs_channel }}
- run: test $NIX_PATH == '${{ env.nixpkgs_channel }}'
- run: nix-build test.nix
extra-nix-config:
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
- macos-13
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Install Nix
uses: ./
with:
nix_path: ${{ env.nixpkgs_channel }}
extra_nix_config: |
sandbox = relaxed
- run: cat /etc/nix/nix.conf
- run: nix-build test.nix --arg noChroot true
flakes:
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
- macos-13
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Install Nix
uses: ./
- run: nix flake show github:NixOS/nixpkgs
installer-options:
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
# - macos-latest missing installer for aarch64-darwin
- macos-13
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Install Nix
uses: ./
with:
nix_path: ${{ env.nixpkgs_channel }}
install_options: --tarball-url-prefix https://nixos-nix-install-tests.cachix.org/serve
install_url: https://nixos-nix-install-tests.cachix.org/serve/${{ env.pinned_installer_hash }}/install
- run: nix-build test.nix
oldest-supported-installer:
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- macos-latest
- macos-13
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Install Nix
uses: ./
with:
nix_path: ${{ env.nixpkgs_channel }}
install_url: https://releases.nixos.org/nix/${{ env.oldest_supported_installer }}/install
- run: nix-build test.nix
act-support:
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- run: curl https://raw.githubusercontent.com/nektos/act/master/install.sh | sudo bash
- run: docker pull ghcr.io/catthehacker/ubuntu:js-20.04
- run: ./bin/act -P ubuntu-latest=ghcr.io/catthehacker/ubuntu:js-20.04 push -j simple-build
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Nix
uses: ./
with:
nix_path: nixpkgs=channel:nixos-22.11
- run: nix-shell --packages cacert git nix nodejs pre-commit --pure --run 'pre-commit run --all-files'