forked from AlexxIT/go2rtc
-
Notifications
You must be signed in to change notification settings - Fork 0
103 lines (96 loc) · 2.91 KB
/
test.yml
File metadata and controls
103 lines (96 loc) · 2.91 KB
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
name: Test Build and Run
on:
# push:
# branches:
# - '*'
# pull_request:
# merge_group:
workflow_dispatch:
jobs:
build-test:
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
arch: [amd64, arm64]
runs-on: ${{ matrix.os }}
continue-on-error: true
env:
GOARCH: ${{ matrix.arch }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.22'
- name: Build Go binary
run: go build -ldflags "-s -w" -trimpath -o ./go2rtc
- name: Test Go binary on linux
if: matrix.os == 'ubuntu-latest'
run: |
if [ "${{ matrix.arch }}" = "amd64" ]; then
./go2rtc -version
else
sudo apt-get update && sudo apt-get install -y qemu-user-static
sudo cp /usr/bin/qemu-aarch64-static .
sudo chown $USER:$USER ./qemu-aarch64-static
qemu-aarch64-static ./go2rtc -version
fi
- name: Test Go binary on macos
if: matrix.os == 'macos-latest'
run: |
if [ "${{ matrix.arch }}" = "amd64" ]; then
./go2rtc -version
else
echo "ARM64 architecture is not yet supported on macOS"
fi
- name: Test Go binary on windows
if: matrix.os == 'windows-latest'
run: |
if ("${{ matrix.arch }}" -eq "amd64") {
.\go2rtc* -version
} else {
Write-Host "ARM64 architecture is not yet supported on Windows"
}
docker-test:
strategy:
matrix:
platform:
- amd64
- "386"
- arm/v7
- arm64/v8
continue-on-error: true
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/${{ matrix.platform }}
push: false
load: true
tags: go2rtc-${{ matrix.platform }}
- name: test run
run: |
docker run --platform=linux/${{ matrix.platform }} --rm go2rtc-${{ matrix.platform }} go2rtc -version
- name: Build and push Hardware
if: matrix.platform == 'amd64'
uses: docker/build-push-action@v5
with:
context: .
file: hardware.Dockerfile
platforms: linux/amd64
push: false
load: true
tags: go2rtc-${{ matrix.platform }}-hardware
- name: test run
if: matrix.platform == 'amd64'
run: |
docker run --platform=linux/${{ matrix.platform }} --rm go2rtc-${{ matrix.platform }}-hardware go2rtc -version