forked from DGNum/colmena
51 lines
1.4 KiB
YAML
51 lines
1.4 KiB
YAML
name: Build
|
|
on:
|
|
pull_request:
|
|
push:
|
|
jobs:
|
|
build:
|
|
strategy:
|
|
matrix:
|
|
include:
|
|
- label: x86_64-linux
|
|
image: ubuntu-latest
|
|
- label: aarch64-linux
|
|
image: ubuntu-latest
|
|
system: aarch64-linux
|
|
- label: x86_64-darwin
|
|
image: macos-12
|
|
|
|
name: ${{ matrix.label }}
|
|
runs-on: ${{ matrix.image }}
|
|
steps:
|
|
- uses: actions/checkout@v3.3.0
|
|
|
|
- name: Install Nix
|
|
uses: DeterminateSystems/nix-installer-action@9b252454a8d70586c4ee7f163bf4bb1e9de3d763 # v2
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v2.1.0
|
|
if: matrix.system != ''
|
|
|
|
- name: Generate System Flags
|
|
run: |
|
|
LOCAL_SYSTEM=$(nix-instantiate --eval --json -E 'builtins.currentSystem' | jq -r)
|
|
HOST_SYSTEM=${HOST_SYSTEM:-$LOCAL_SYSTEM}
|
|
if [[ "$LOCAL_SYSTEM" != "$HOST_SYSTEM" ]]; then
|
|
echo "system_flags=--system $HOST_SYSTEM" >>"$GITHUB_ENV"
|
|
echo "extra-platforms = $HOST_SYSTEM" | sudo tee -a /etc/nix/nix.conf
|
|
fi
|
|
env:
|
|
HOST_SYSTEM: '${{ matrix.system }}'
|
|
|
|
- name: Enable Binary Cache
|
|
uses: cachix/cachix-action@v12
|
|
with:
|
|
name: colmena
|
|
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
|
|
|
- name: Build Colmena
|
|
run: nix build -L $system_flags
|
|
|
|
- name: Build manual
|
|
run: nix build .#manual -L
|