@@ -3,153 +3,19 @@ name: Test
3
3
on : [push, pull_request]
4
4
5
5
jobs :
6
- test :
7
- strategy :
8
- matrix :
9
- os : [ubuntu-latest, macos-latest, windows-latest]
10
- go : ['1.18.x', '1.19.x', '1.20.x', '1.21.x', '1.22.x', '1.23.x', '1.24.x']
11
- name : Test with Go ${{ matrix.go }} on ${{ matrix.os }}
12
- runs-on : ${{ matrix.os }}
13
- defaults :
14
- run :
15
- shell : bash
16
- steps :
17
- - name : Git
18
- run : |
19
- # See actions/checkout#135
20
- git config --global core.autocrlf false
21
- git config --global core.eol lf
22
-
23
- - name : Checkout
24
- uses : actions/checkout@v4
25
-
26
- - name : Setup Go
27
- uses : actions/setup-go@v5
28
- with :
29
- go-version : ${{ matrix.go }}
30
-
31
- - name : Set up the prerequisites
32
- if : runner.os == 'Linux'
33
- run : |
34
- sudo apt-get update
35
- sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu qemu-user
36
-
37
- - name : go vet
38
- if : runner.os != 'Windows' && runner.os != 'macOS'
39
- run : |
40
- go vet -v ./...
41
-
42
- - name : go build
43
- run : |
44
- go build -v ./...
45
- # Compile without optimization to check potential stack overflow.
46
- # The option '-gcflags=all=-N -l' is often used at Visual Studio Code.
47
- # See also https://go.googlesource.com/vscode-go/+/HEAD/docs/debugging.md#launch and the issue hajimehoshi/ebiten#2120.
48
- go build "-gcflags=all=-N -l" -v ./...
49
-
50
- # Check cross-compiling Windows binaries.
51
- env GOOS=windows GOARCH=386 go build -v ./...
52
- env GOOS=windows GOARCH=amd64 go build -v ./...
53
- env GOOS=windows GOARCH=arm go build -v ./...
54
- env GOOS=windows GOARCH=arm64 go build -v ./...
55
-
56
- # Check cross-compiling macOS binaries.
57
- env GOOS=darwin GOARCH=amd64 go build -v ./...
58
- env GOOS=darwin GOARCH=arm64 go build -v ./...
59
-
60
- # Check cross-compiling Linux binaries.
61
- env GOOS=linux GOARCH=amd64 go build -v ./...
62
- env GOOS=linux GOARCH=arm64 go build -v ./...
63
-
64
- # Check cross-compiling FreeBSD binaries.
65
- # gcflags -std is necessary to make fakecgo the Cgo for
66
- # FreeBSD to add the symbols that libc.so depends on.
67
- env GOOS=freebsd GOARCH=amd64 go build -gcflags="github.com/ebitengine/purego/internal/fakecgo=-std" -v ./...
68
- env GOOS=freebsd GOARCH=arm64 go build -gcflags="github.com/ebitengine/purego/internal/fakecgo=-std" -v ./...
69
-
70
- # Check cross-compiling NetBSD binaries.
71
- env GOOS=netbsd GOARCH=amd64 go build -v ./...
72
- env GOOS=netbsd GOARCH=arm64 go build -v ./...
73
-
74
- - name : go build (plugin)
75
- if : runner.os == 'Linux' || runner.os == 'macOS'
76
- run :
77
- # Make sure that plugin buildmode works since we save the R15 register (#254)
78
- go build -buildmode=plugin ./examples/libc
79
-
80
- - name : go mod vendor
81
- if : runner.os != 'Linux'
82
- run : |
83
- mkdir /tmp/vendoring
84
- cd /tmp/vendoring
85
- go mod init foo
86
- echo 'package main' > main.go
87
- echo 'import (' >> main.go
88
- echo ' _ "github.com/ebitengine/purego"' >> main.go
89
- echo ')' >> main.go
90
- echo 'func main() {}' >> main.go
91
- go mod edit -replace github.com/ebitengine/purego=$GITHUB_WORKSPACE
92
- go mod tidy
93
- go mod vendor
94
- go build -v .
95
-
96
- - name : go test
97
- run : |
98
- env CGO_ENABLED=0 go test -shuffle=on -v -count=10 ./...
99
- env CGO_ENABLED=1 go test -shuffle=on -v -count=10 ./...
100
- # Compile without optimization to check potential stack overflow.
101
- # The option '-gcflags=all=-N -l' is often used at Visual Studio Code.
102
- # See also https://go.googlesource.com/vscode-go/+/HEAD/docs/debugging.md#launch.
103
- env CGO_ENABLED=0 go test "-gcflags=all=-N -l" -v ./...
104
- env CGO_ENABLED=1 go test "-gcflags=all=-N -l" -v ./...
105
-
106
- - name : go test (Linux arm64)
107
- if : runner.os == 'Linux'
108
- run : |
109
- go env -w CC=aarch64-linux-gnu-gcc
110
- go env -w CXX=aarch64-linux-gnu-g++
111
- env GOOS=linux GOARCH=arm64 CGO_ENABLED=0 go test -c -o=purego-test-nocgo .
112
- env QEMU_LD_PREFIX=/usr/aarch64-linux-gnu qemu-aarch64 ./purego-test-nocgo -test.shuffle=on -test.v -test.count=10
113
- env GOOS=linux GOARCH=arm64 CGO_ENABLED=1 go test -c -o=purego-test-cgo .
114
- env QEMU_LD_PREFIX=/usr/aarch64-linux-gnu qemu-aarch64 ./purego-test-cgo -test.shuffle=on -test.v -test.count=10
115
-
116
- echo "=> go build (plugin)"
117
- # Make sure that plugin buildmode works since we save the R15 register (#254)
118
- env GOOS=linux GOARCH=arm64 CGO_ENABLED=1 go build -buildmode=plugin ./examples/libc
119
-
120
- go env -u CC
121
- go env -u CXX
122
-
123
- - name : go test (Windows 386)
124
- if : runner.os == 'Windows'
125
- run : |
126
- env CGO_ENABLED=0 GOARCH=386 go test -shuffle=on -v -count=10 ./...
127
- env CGO_ENABLED=1 GOARCH=386 go test -shuffle=on -v -count=10 ./...
128
-
129
- - name : go test (Linux 386)
130
- if : runner.os == 'Linux'
131
- run : |
132
- sudo apt-get install gcc-multilib
133
- sudo apt-get install g++-multilib
134
- env CGO_ENABLED=1 GOARCH=386 go test -shuffle=on -v -count=10 ./...
135
-
136
- - name : go test race
137
- if : ${{ !startsWith(matrix.go, '1.18.') && !startsWith(matrix.go, '1.19.') }}
138
- run : |
139
- go test -race -shuffle=on -v -count=10 ./...
140
-
141
6
bsd :
142
7
strategy :
143
8
matrix :
144
9
os : ['FreeBSD', 'NetBSD']
145
- go : ['1.18.10', '1.19.13', '1.20.14', '1.21.13', '1.22.12', '1.23.6', '1. 24.0']
10
+ go : ['1.24.0']
146
11
name : Test with Go ${{ matrix.go }} on ${{ matrix.os }}
147
12
runs-on : ubuntu-22.04
148
13
defaults :
149
14
run :
150
15
shell : bash
151
16
steps :
152
- - uses : actions/checkout@v4
17
+ - name : Chckout
18
+ uses : actions/checkout@v4
153
19
- name : Run in freebsd
154
20
if : matrix.os == 'FreeBSD'
155
21
uses : vmactions/freebsd-vm@v1
@@ -159,10 +25,9 @@ jobs:
159
25
fetch https://go.dev/dl/go${{matrix.go}}.freebsd-amd64.tar.gz
160
26
rm -fr /usr/local/go && tar -C /usr/local -xf go${{matrix.go}}.freebsd-amd64.tar.gz
161
27
ln -s /usr/local/go/bin/go /usr/local/bin
162
- ls -a -R
163
28
chmod +x $GITHUB_WORKSPACE/.github/scripts/bsd_tests.sh
164
29
run : |
165
- ls -a -R
30
+ cat $GITHUB_WORKSPACE/.github/scripts/bsd_tests.sh
166
31
$GITHUB_WORKSPACE/.github/scripts/bsd_tests.sh
167
32
- name : Run in netbsd
168
33
# there are no prebuilt download links for these versions of Go for NetBSD
178
43
ln -s /usr/local/go/bin/go /usr/local/bin
179
44
export PATH=$PATH:/usr/local/go/bin/
180
45
chmod +x $GITHUB_WORKSPACE/.github/scripts/bsd_tests.sh
181
- run : $GITHUB_WORKSPACE/.github/scripts/bsd_tests.sh
46
+ run :
47
+ cat $GITHUB_WORKSPACE/.github/scripts/bsd_tests.sh
48
+ $GITHUB_WORKSPACE/.github/scripts/bsd_tests.sh
0 commit comments