Merge pull request #3 from kaedwen/multi-arch

try matrix
This commit is contained in:
kaedwen
2023-07-09 11:29:27 +02:00
committed by GitHub
2 changed files with 48 additions and 13 deletions
+46 -11
View File
@@ -15,7 +15,7 @@ on:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
build:
build-static:
runs-on: ubuntu-latest
container: "debian:stable-slim"
steps:
@@ -25,20 +25,55 @@ jobs:
node-version: 18
cache-dependency-path: static
cache: npm
- name: Build Frontend
run: npm --prefix static ci && npm --prefix static run build
- run: npm --prefix static ci && npm --prefix static run build
- uses: actions/upload-artifact@v3
with:
name: static
path: static/dist
build:
needs: build-static
runs-on: ubuntu-latest
container: "debian:stable-slim"
strategy:
matrix:
target:
- os: linux
arch: amd64
goarch: amd64
deps: gcc
prefix: ''
- os: linux
arch: armhf
goarch: arm
deps: gcc-arm-linux-gnueabihf libc6-dev-armhf-cross
prefix: arm-linux-gnueabihf
- os: linux
arch: arm64
goarch: arm64
deps: gcc-aarch64-linux-gnu libc6-dev-arm64-cross
prefix: aarch64-linux-gnu
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: 'stable'
- name: Prepare Backend
run: |
- run: |
dpkg --add-architecture ${{ matrix.target.arch }}
apt-get update
apt-get install --yes --no-install-recommends make gcc libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
- name: Build Backend
run: make build-static
- name: Archive artifacts
uses: actions/upload-artifact@v3
apt-get install --yes --no-install-recommends make libgstreamer1.0-dev:${{ matrix.target.arch }} libgstreamer-plugins-base1.0-dev:${{ matrix.target.arch }} ${{ matrix.target.deps }}
- uses: actions/download-artifact@master
with:
name: binary
name: static
path: static/dist
- run: |
PREFIX="${{ matrix.target.prefix }}"
echo "GOOS=${{ matrix.target.os }}" >> $GITHUB_ENV
echo "GOARCH=${{ matrix.target.goarch }}" >> $GITHUB_ENV
echo "PKG_CONFIG_PATH=/usr/lib/${{ matrix.target.prefix }}/pkgconfig" >> $GITHUB_ENV
echo "CC=${PREFIX:+$PREFIX-}gcc" >> $GITHUB_ENV
- run: make build-static
- uses: actions/upload-artifact@v3
with:
name: service-${{ matrix.target.os }}-${{ matrix.target.goarch }}
path: service
retention-days: 5
+2 -2
View File
@@ -1,6 +1,6 @@
build:
go build -mod=vendor -o service main.go
CGO_ENABLED=1 go build -mod=vendor -o service main.go
build-static:
go build -mod=vendor -tags=embed -o service main.go
CGO_ENABLED=1 go build -mod=vendor -tags=embed -o service main.go