-
Notifications
You must be signed in to change notification settings - Fork 203
71 lines (64 loc) · 1.66 KB
/
test.yaml
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
name: test
on:
push:
branches:
- master
pull_request:
jobs:
native-os-build:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.22"
- name: Setup CGO Environment
run: |
if [ ${{ matrix.os }} == 'macOS-latest' ] ; then
echo "CGO_ENABLED=1" >> "$GITHUB_ENV"
fi
shell: bash
- name: Build AMD64
run: GOARCH=amd64 go build -v ./...
shell: bash
- name: Build ARM64
run: GOARCH=arm64 go build -v ./...
shell: bash
- name: Install socat
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get install socat
shell: bash
- name: Run unit tests
run: go test -v -race ./...
shell: bash
- name: Cross-build for 386
if: matrix.os != 'macOS-latest'
run: GOARCH=386 go build -v ./...
shell: bash
- name: Cross-build for arm
if: matrix.os != 'macOS-latest'
run: GOARCH=arm go build -v ./...
shell: bash
cross-os-build:
strategy:
matrix:
go-os-pairs:
- "freebsd amd64"
- "openbsd amd64"
- "openbsd 386"
- "openbsd arm"
- "linux ppc64le"
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: "1.22"
- name: Cross-build
run: |
set ${{ matrix.go-os-pairs }}
GOOS=$1 GOARCH=$2 go build -v ./...
shell: bash