run cross compile of headscale as part of build (#2270)

This commit is contained in:
Kristoffer Dalby 2024-12-10 16:26:53 +01:00 committed by GitHub
parent 64fd1f9483
commit 757defa2f2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 59 additions and 15 deletions

View file

@ -13,7 +13,7 @@ concurrency:
cancel-in-progress: true
jobs:
build:
build-nix:
runs-on: ubuntu-latest
permissions: write-all
steps:
@ -36,7 +36,7 @@ jobs:
- uses: DeterminateSystems/magic-nix-cache-action@main
if: steps.changed-files.outputs.files == 'true'
- name: Run build
- name: Run nix build
id: build
if: steps.changed-files.outputs.files == 'true'
run: |
@ -69,3 +69,27 @@ jobs:
with:
name: headscale-linux
path: result/bin/headscale
build-cross:
runs-on: ubuntu-latest
strategy:
matrix:
env:
- "GOARCH=arm GOOS=linux GOARM=5"
- "GOARCH=arm GOOS=linux GOARM=6"
- "GOARCH=arm GOOS=linux GOARM=7"
- "GOARCH=arm64 GOOS=linux"
- "GOARCH=386 GOOS=linux"
- "GOARCH=amd64 GOOS=linux"
- "GOARCH=arm64 GOOS=darwin"
- "GOARCH=amd64 GOOS=darwin"
steps:
- uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- name: Run go cross compile
run: env ${{ matrix.env }} nix develop --command -- go build -o "headscale" ./cmd/headscale
- uses: actions/upload-artifact@v4
with:
name: "headscale-${{ matrix.env }}"
path: "headscale"