forked from wildeyedskies/stmp
-
Notifications
You must be signed in to change notification settings - Fork 7
82 lines (71 loc) · 2.22 KB
/
build-linux.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
name: Build+Test Linux
on:
push:
paths-ignore:
- "*.md"
workflow_dispatch:
jobs:
build:
strategy:
fail-fast: false
matrix:
os:
- ubuntu-20.04
- ubuntu-22.04
- ubuntu-latest
go:
- "1.22"
- "1.23"
architecture:
- amd64
- arm64
- arm
- riscv64
runs-on: ${{ matrix.os }}
steps:
- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y libmpv-dev libglx-dev libgl-dev \
gcc-aarch64-linux-gnu g++-aarch64-linux-gnu \
gcc-arm-linux-gnueabi g++-arm-linux-gnueabi \
gcc-riscv64-linux-gnu g++-riscv64-linux-gnu
- uses: actions/checkout@v4
- name: Install Go ${{ matrix.go }}
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
- name: Set Environment Variables for Cross-Compilation
run: |
export CGO_ENABLED=1
if [ "${{ matrix.architecture }}" == "amd64" ]; then
export GOARCH=amd64
export GOOS=linux
elif [ "${{ matrix.architecture }}" == "arm64" ]; then
export GOARCH=arm64
export GOOS=linux
export CC=aarch64-linux-gnu-gcc
export CXX=aarch64-linux-gnu-g++
elif [ "${{ matrix.architecture }}" == "arm" ]; then
export GOARCH=arm
export GOOS=linux
export CC=arm-linux-gnueabi-gcc
export CXX=arm-linux-gnueabi-g++
elif [ "${{ matrix.architecture }}" == "riscv64" ]; then
export GOARCH=riscv64
export GOOS=linux
export CC=riscv64-linux-gnu-gcc
export CXX=riscv64-linux-gnu-g++
fi
- name: Get Go deps
run: go get .
- name: Run tests
run: go test -v ./...
- name: Compile
run: go build -o stmps-linux-${{ matrix.architecture }}
- name: Upload binary as artifact
if: matrix.go == 'stable' && matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v4
with:
path: stmps-linux-${{ matrix.architecture }}
name: stmps-linux-${{ matrix.architecture }}