forked from wildeyedskies/stmp
-
Notifications
You must be signed in to change notification settings - Fork 6
118 lines (100 loc) · 3.26 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
name: Build+Test Linux
on:
push:
paths-ignore:
- "*.md"
workflow_dispatch:
env:
TERMSHOT_VERSION: "0.2.10"
jobs:
build:
strategy:
fail-fast: false
matrix:
os:
- ubuntu-20.04
- ubuntu-22.04
- ubuntu-latest
go:
- "1.22"
- "stable"
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.os == 'ubuntu-latest' && matrix.go == 'stable' && matrix.architecture == 'amd64'
uses: actions/upload-artifact@v4
with:
path: stmps-linux-${{ matrix.architecture }}
name: stmps-linux-${{ matrix.architecture }}
screenshot:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download and unpack termshot
run: |
wget https://github.com/homeport/termshot/releases/download/v${{ env.TERMSHOT_VERSION }}/termshot_${{ env.TERMSHOT_VERSION }}_linux_amd64.tar.gz
tar -xzf termshot_${{ env.TERMSHOT_VERSION }}_linux_amd64.tar.gz
chmod +x termshot
- name: Download binary from build job
uses: actions/download-artifact@v4
with:
name: stmps-linux-amd64
path: .
- name: Make binary executable and rename it
run: |
chmod +x stmps-linux-amd64
mv stmps-linux-amd64 ./stmps
- name: Run and screenshot STMPS
run: |
./termshot ./stmps --output stmps_screenshot.png
continue-on-error: true
- name: Upload screenshot
uses: actions/upload-artifact@v4
with:
name: stmps_screenshot
path: stmps_screenshot.png