Use nothing-but-nix on linux and `rm -rf` on darwin Move nix's build-dir into /nix to workaround https://github.com/wimpysworld/nothing-but-nix/issues/18 Co-authored-by: Matt Sturgeon <matt@sturgeon.me.uk>
94 lines
2.8 KiB
YAML
94 lines
2.8 KiB
YAML
name: build
|
|
run-name: "build ${{ inputs.packages }}"
|
|
|
|
permissions: {}
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
packages:
|
|
description: "Packages"
|
|
required: false
|
|
type: string
|
|
x86_64-linux:
|
|
description: "Build on x86_64-linux"
|
|
required: true
|
|
type: boolean
|
|
default: true
|
|
aarch64-linux:
|
|
description: "Build on aarch64-linux"
|
|
required: true
|
|
type: boolean
|
|
default: true
|
|
x86_64-darwin:
|
|
description: "Build on x86_64-darwin"
|
|
required: true
|
|
type: choice
|
|
default: yes_sandbox_true
|
|
options:
|
|
- 'no'
|
|
- yes_sandbox_false
|
|
- yes_sandbox_relaxed
|
|
- yes_sandbox_true
|
|
aarch64-darwin:
|
|
description: "Build on aarch64-darwin"
|
|
required: true
|
|
type: choice
|
|
default: yes_sandbox_true
|
|
options:
|
|
- 'no'
|
|
- yes_sandbox_false
|
|
- yes_sandbox_relaxed
|
|
- yes_sandbox_true
|
|
upterm:
|
|
description: "Start upterm session after nix build"
|
|
required: true
|
|
type: boolean
|
|
default: false
|
|
|
|
jobs:
|
|
build:
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
system:
|
|
- x86_64-linux
|
|
- aarch64-linux
|
|
- x86_64-darwin
|
|
- aarch64-darwin
|
|
exclude:
|
|
- system: ${{ !inputs.x86_64-linux && 'x86_64-linux' || '' }}
|
|
- system: ${{ !inputs.aarch64-linux && 'aarch64-linux' || '' }}
|
|
- system: ${{ inputs.x86_64-darwin == 'no' && 'x86_64-darwin' || '' }}
|
|
- system: ${{ inputs.aarch64-darwin == 'no' && 'aarch64-darwin' || '' }}
|
|
runs-on: >-
|
|
${{ (matrix.system == 'x86_64-linux' && 'ubuntu-latest')
|
|
|| (matrix.system == 'aarch64-linux' && 'ubuntu-24.04-arm')
|
|
|| (matrix.system == 'x86_64-darwin' && 'macos-latest')
|
|
|| (matrix.system == 'aarch64-darwin' && 'macos-latest') }}
|
|
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
sparse-checkout: .github/actions
|
|
|
|
- name: setup nix
|
|
uses: ./.github/actions/setup-nix
|
|
with:
|
|
system: ${{ matrix.system }}
|
|
sandbox: ${{
|
|
(matrix.system == 'x86_64-darwin' && inputs.x86_64-darwin == 'yes_sandbox_false'
|
|
|| matrix.system == 'aarch64-darwin' && inputs.aarch64-darwin == 'yes_sandbox_false') && 'false'
|
|
|| (matrix.system == 'x86_64-darwin' && inputs.x86_64-darwin == 'yes_sandbox_relaxed'
|
|
|| matrix.system == 'aarch64-darwin' && inputs.aarch64-darwin == 'yes_sandbox_relaxed') && 'relaxed'
|
|
|| 'true' }}
|
|
|
|
- name: nix build
|
|
run: nix build --keep-going -L ${{ inputs.packages }}
|
|
if: ${{ inputs.packages != '' }}
|
|
|
|
- name: start upterm session
|
|
if: ${{ inputs.upterm }}
|
|
uses: owenthereal/action-upterm@v1
|
|
with:
|
|
limit-access-to-actor: true
|