2022-12-16 18:25:12 +05:30
|
|
|
name: Test Nix Flakes project
|
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_call:
|
2022-12-18 20:49:59 +05:30
|
|
|
inputs:
|
|
|
|
extra-targets:
|
|
|
|
type: string
|
|
|
|
required: false
|
|
|
|
default: ""
|
2023-07-25 12:49:17 +05:30
|
|
|
extra-nix-flags:
|
|
|
|
type: string
|
|
|
|
required: false
|
|
|
|
default: ""
|
2022-12-16 18:25:12 +05:30
|
|
|
secrets:
|
|
|
|
cachix-token:
|
|
|
|
required: true
|
|
|
|
github-token:
|
|
|
|
required: true
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
check:
|
2022-12-23 14:43:20 +05:30
|
|
|
name: Build and check
|
2022-12-16 18:25:12 +05:30
|
|
|
runs-on: ubuntu-22.04
|
|
|
|
steps:
|
|
|
|
- name: Checkout repository
|
2024-04-25 21:43:26 +05:30
|
|
|
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
|
2024-04-16 12:50:54 +05:30
|
|
|
with:
|
|
|
|
submodules: 'recursive'
|
2022-12-16 18:25:12 +05:30
|
|
|
|
|
|
|
- name: Install Nix
|
2024-03-14 01:07:10 +05:30
|
|
|
uses: DeterminateSystems/nix-installer-action@de22e16c4711fca50c816cc9081563429d1cf563 # v10
|
2022-12-16 18:25:12 +05:30
|
|
|
|
2023-09-06 02:01:33 +05:30
|
|
|
- name: Set up Magic Nix Cache
|
2024-03-13 22:48:59 +05:30
|
|
|
uses: DeterminateSystems/magic-nix-cache-action@fc6aaceb40b9845a02b91e059ec147e78d1b4e41 # v4
|
2023-09-06 02:01:33 +05:30
|
|
|
|
2022-12-16 18:25:12 +05:30
|
|
|
- name: Set up Cachix (msfjarvis)
|
2024-01-12 22:00:52 +05:30
|
|
|
uses: cachix/cachix-action@18cf96c7c98e048e10a83abd92116114cd8504be # v14
|
2022-12-16 18:25:12 +05:30
|
|
|
with:
|
|
|
|
name: msfjarvis
|
|
|
|
authToken: ${{ secrets.cachix-token }}
|
|
|
|
cachixArgs: -c9 --omit-deriver
|
|
|
|
|
2022-12-18 20:49:59 +05:30
|
|
|
- name: Run default check
|
|
|
|
shell: bash
|
2023-07-25 12:49:17 +05:30
|
|
|
env:
|
|
|
|
NIX_FLAGS: ${{ inputs.extra-nix-flags }}
|
2022-12-16 18:25:12 +05:30
|
|
|
run: |
|
2023-07-25 12:49:17 +05:30
|
|
|
read -ra FLAGS <<<"$NIX_FLAGS"
|
2024-04-15 17:57:02 +05:30
|
|
|
nix flake check '.?submodules=1#' --print-build-logs "${FLAGS[@]}"
|
2022-12-18 20:49:59 +05:30
|
|
|
|
|
|
|
- name: Run additional checks
|
|
|
|
shell: bash
|
|
|
|
if: ${{ inputs.extra-targets != '' }}
|
|
|
|
env:
|
|
|
|
TARGET_STRING: ${{ inputs.extra-targets }}
|
2023-07-25 12:49:17 +05:30
|
|
|
NIX_FLAGS: ${{ inputs.extra-nix-flags }}
|
2022-12-18 20:49:59 +05:30
|
|
|
run: |
|
|
|
|
read -ra TARGETS <<<"$TARGET_STRING"
|
2023-07-25 12:49:17 +05:30
|
|
|
read -ra FLAGS <<<"$NIX_FLAGS"
|
2022-12-18 20:49:59 +05:30
|
|
|
for TARGET in "${TARGETS[@]}"; do
|
2023-07-25 12:49:17 +05:30
|
|
|
nix build --print-build-logs "${FLAGS[@]}" "${TARGET}"
|
2022-12-18 20:49:59 +05:30
|
|
|
done
|