v0.11.0-alpha.1 1d88bcc

test.yml RawHistoryFolder

1name: Test
2
3on: [push, pull_request]
4
5jobs:
6  test:
7    strategy:
8      matrix:
9        os: [ubuntu-latest, ubuntu-24.04-arm, 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', '1.25.x', '1.26.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@v5
25
26      - name: Setup Go
27        uses: actions/setup-go@v6
28        with:
29          go-version: ${{ matrix.go }}
30
31      - name: Set up the prerequisites
32        if: runner.os == 'Windows'
33        uses: msys2/setup-msys2@v2
34
35      - name: go vet
36        run: |
37          env CGO_ENABLED=0 go vet -v ./...
38
39      - name: gofmt
40        run: test -z "$(gofmt -s -l .)"
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=arm64 go build -v ./...
54
55          # Check cross-compiling macOS binaries.
56          env GOOS=darwin GOARCH=amd64 go build -v ./...
57          env GOOS=darwin GOARCH=arm64 go build -v ./...
58
59          # Check cross-compiling Linux binaries.
60          env GOOS=linux GOARCH=amd64 go build -v ./...
61          env GOOS=linux GOARCH=arm64 go build -v ./...
62
63          # Check cross-compiling FreeBSD binaries.
64          # gcflags -std is necessary to make fakecgo the Cgo for
65          # FreeBSD to add the symbols that libc.so depends on.
66          env GOOS=freebsd GOARCH=amd64 go build -gcflags="github.com/ebitengine/purego/internal/fakecgo=-std" -v ./...
67          env GOOS=freebsd GOARCH=arm64 go build -gcflags="github.com/ebitengine/purego/internal/fakecgo=-std" -v ./...          
68          
69          # Check cross-compiling NetBSD binaries.
70          env GOOS=netbsd GOARCH=amd64 go build -v ./...
71          env GOOS=netbsd GOARCH=arm64 go build -v ./...
72
73      - name: go build (Linux minor architectures)
74        # Test them only on the latest Go to reduce CI time.
75        # s390x cannot be tested here as it requires Cgo.
76        if: startsWith(matrix.go, '1.26.')
77        run: |
78          # Check cross-compiling Linux binaries for minor architectures.
79          env GOOS=linux GOARCH=loong64 go build -v ./...
80          env GOOS=linux GOARCH=ppc64le go build -v ./...
81          env GOOS=linux GOARCH=riscv64 go build -v ./...
82
83      - name: go build (plugin)
84        if: runner.os == 'Linux' || runner.os == 'macOS'
85        run:
86          # Make sure that plugin buildmode works since we save the R15 register (#254)
87          go build -buildmode=plugin ./examples/libc
88
89      - name: go mod vendor
90        if: runner.os != 'Linux'
91        run: |
92          mkdir /tmp/vendoring
93          cd /tmp/vendoring
94          go mod init foo
95          echo 'package main' > main.go
96          echo 'import (' >> main.go
97          echo '  _ "github.com/ebitengine/purego"' >> main.go
98          echo ')' >> main.go
99          echo 'func main() {}' >> main.go
100          go mod edit -replace github.com/ebitengine/purego=$GITHUB_WORKSPACE
101          go mod tidy
102          go mod vendor
103          go build -v .
104
105      - name: go test
106        run: |
107          env CGO_ENABLED=0 go test -shuffle=on -v -count=10 ./...
108          env CGO_ENABLED=1 go test -shuffle=on -v -count=10 ./...
109          # Compile without optimization to check potential stack overflow.
110          # The option '-gcflags=all=-N -l' is often used at Visual Studio Code.
111          # See also https://go.googlesource.com/vscode-go/+/HEAD/docs/debugging.md#launch.
112          env CGO_ENABLED=0 go test "-gcflags=all=-N -l" -v ./...
113          env CGO_ENABLED=1 go test "-gcflags=all=-N -l" -v ./...
114
115      - name: go test (Windows 386)
116        if: runner.os == 'Windows'
117        run: |
118          env CGO_ENABLED=0 GOARCH=386 go test -shuffle=on -v -count=10 ./...
119          env CGO_ENABLED=1 GOARCH=386 go test -shuffle=on -v -count=10 ./...
120
121      - name: go test (Linux 386)
122        if: ${{ runner.os == 'Linux' && runner.arch != 'ARM64' }}
123        run: |
124           sudo apt-get update
125           sudo apt-get install gcc-multilib
126           sudo apt-get install g++-multilib
127           env CGO_ENABLED=0 GOARCH=386 go test -shuffle=on -v -count=10 ./...
128           env CGO_ENABLED=1 GOARCH=386 go test -shuffle=on -v -count=10 ./...
129      
130      - name: go test (Linux arm)
131        if: ${{ runner.os == 'Linux' && runner.arch == 'ARM64' }}
132        run: |
133           sudo apt-get update
134           sudo apt-get install -y gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf libc6-armhf-cross
135
136           # Install QEMU 10.x from Debian trixie. Ubuntu 24.04 ships QEMU 8.2
137           # which has a bug where inter-thread signal delivery (tgkill) hangs,
138           # causing TestSetuidEtc to deadlock.
139           wget -q http://ftp.debian.org/debian/pool/main/q/qemu/qemu-user_10.0.7+ds-0+deb13u1+b1_arm64.deb -O /tmp/qemu-user.deb
140           wget -q http://ftp.debian.org/debian/pool/main/q/qemu/qemu-user-binfmt_10.0.7+ds-0+deb13u1+b1_arm64.deb -O /tmp/qemu-user-binfmt.deb
141           sudo dpkg --force-depends -i /tmp/qemu-user.deb /tmp/qemu-user-binfmt.deb
142
143           # Create symlink for the dynamic linker that QEMU expects
144           sudo ln -sf /usr/arm-linux-gnueabihf/lib/ld-linux-armhf.so.3 /lib/ld-linux.so.3
145           go env -w CC=arm-linux-gnueabihf-gcc
146           go env -w CXX=arm-linux-gnueabihf-g++
147           env GOOS=linux GOARCH=arm CGO_ENABLED=0 go test -c -o=purego-test-nocgo .
148           env QEMU_LD_PREFIX=/usr/arm-linux-gnueabihf qemu-arm ./purego-test-nocgo -test.shuffle=on -test.v -test.count=10
149           env GOOS=linux GOARCH=arm CGO_ENABLED=1 go test -c -o=purego-test-cgo .
150           env QEMU_LD_PREFIX=/usr/arm-linux-gnueabihf qemu-arm ./purego-test-cgo -test.shuffle=on -test.v -test.count=10
151           go env -u CC
152           go env -u CXX
153
154      - name: go test race (no Cgo)
155        if: ${{ runner.os == 'macOS' &&  !startsWith(matrix.go, '1.18.') && !startsWith(matrix.go, '1.19.') }}
156        run: |
157          # -race usually requires Cgo, but macOS is an exception. See https://go.dev/doc/articles/race_detector#Requirements
158          env CGO_ENABLED=0 go test -race -shuffle=on -v -count=10 ./...
159
160      - name: go test race (Cgo)
161        if: ${{ !startsWith(matrix.go, '1.18.') && !startsWith(matrix.go, '1.19.') }}
162        run: |
163          env CGO_ENABLED=1 go test -race -shuffle=on -v -count=10 ./...
164
165  minor-arches:
166    strategy:
167      matrix:
168        # Test only the latest two Go versions to save CI time.
169        # See https://go.dev/doc/devel/release#policy
170        go: ['1.25.x', '1.26.x']
171    name: Test with Go ${{ matrix.go }} on Linux minor architectures
172    runs-on: ubuntu-latest
173    defaults:
174      run:
175        shell: bash
176    steps:
177      - name: Checkout
178        uses: actions/checkout@v5
179
180      - name: Setup Go
181        uses: actions/setup-go@v6
182        with:
183          go-version: ${{ matrix.go }}
184
185      - name: Set up the prerequisites
186        run: |
187          sudo apt-get update
188          sudo apt-get install -y \
189            gcc-14-loongarch64-linux-gnu g++-14-loongarch64-linux-gnu \
190            gcc-powerpc64le-linux-gnu g++-powerpc64le-linux-gnu \
191            gcc-riscv64-linux-gnu g++-riscv64-linux-gnu \
192            gcc-s390x-linux-gnu g++-s390x-linux-gnu
193
194          # Install QEMU 10.x from Debian trixie. Ubuntu 24.04 ships QEMU 8.2
195          # which has a bug where inter-thread signal delivery (tgkill) hangs,
196          # causing TestSetuidEtc to deadlock.
197          wget -q http://ftp.debian.org/debian/pool/main/q/qemu/qemu-user_10.0.7+ds-0+deb13u1+b1_amd64.deb -O /tmp/qemu-user.deb
198          wget -q http://ftp.debian.org/debian/pool/main/q/qemu/qemu-user-binfmt_10.0.7+ds-0+deb13u1+b1_amd64.deb -O /tmp/qemu-user-binfmt.deb
199          sudo dpkg --force-depends -i /tmp/qemu-user.deb /tmp/qemu-user-binfmt.deb
200          sudo apt-get -f install -y
201
202          # Verify that the expected QEMU binaries are installed and usable.
203          qemu-loongarch64 --version
204          qemu-ppc64le --version
205          qemu-riscv64 --version
206          qemu-s390x --version
207
208      - name: go test (Linux loong64)
209        run: |
210          go env -w CC=loongarch64-linux-gnu-gcc-14
211          go env -w CXX=loongarch64-linux-gnu-g++-14
212          env GOOS=linux GOARCH=loong64 CGO_ENABLED=0 go test -c -o=purego-test-nocgo .
213          env QEMU_LD_PREFIX=/usr/loongarch64-linux-gnu qemu-loongarch64 ./purego-test-nocgo -test.shuffle=on -test.v -test.count=10
214          env GOOS=linux GOARCH=loong64 CGO_ENABLED=1 go test -c -o=purego-test-cgo .
215          env QEMU_LD_PREFIX=/usr/loongarch64-linux-gnu qemu-loongarch64 ./purego-test-cgo -test.shuffle=on -test.v -test.count=10
216          go env -u CC
217          go env -u CXX
218
219      - name: go test (Linux ppc64le)
220        run: |
221          go env -w CC=powerpc64le-linux-gnu-gcc
222          go env -w CXX=powerpc64le-linux-gnu-g++
223          env GOOS=linux GOARCH=ppc64le CGO_ENABLED=0 go test -c -o=purego-test-nocgo .
224          env QEMU_LD_PREFIX=/usr/powerpc64le-linux-gnu qemu-ppc64le ./purego-test-nocgo -test.shuffle=on -test.v -test.count=10
225          env GOOS=linux GOARCH=ppc64le CGO_ENABLED=1 go test -c -o=purego-test-cgo .
226          env QEMU_LD_PREFIX=/usr/powerpc64le-linux-gnu qemu-ppc64le ./purego-test-cgo -test.shuffle=on -test.v -test.count=10
227          go env -u CC
228          go env -u CXX
229
230      - name: go test (Linux riscv64)
231        run: |
232          go env -w CC=riscv64-linux-gnu-gcc
233          go env -w CXX=riscv64-linux-gnu-g++
234          # Create symlink for the dynamic linker that QEMU expects
235          sudo ln -sf /usr/riscv64-linux-gnu/lib/ld-linux-riscv64-lp64d.so.1 /lib/ld.so.1
236          env GOOS=linux GOARCH=riscv64 CGO_ENABLED=0 go test -c -o=purego-test-nocgo .
237          env QEMU_LD_PREFIX=/usr/riscv64-linux-gnu qemu-riscv64 ./purego-test-nocgo -test.shuffle=on -test.v -test.count=10
238          env GOOS=linux GOARCH=riscv64 CGO_ENABLED=1 go test -c -o=purego-test-cgo .
239          env QEMU_LD_PREFIX=/usr/riscv64-linux-gnu qemu-riscv64 ./purego-test-cgo -test.shuffle=on -test.v -test.count=10
240          go env -u CC
241          go env -u CXX
242
243      - name: go test (Linux s390x)
244        run: |
245          go env -w CC=s390x-linux-gnu-gcc
246          go env -w CXX=s390x-linux-gnu-g++
247          env GOOS=linux GOARCH=s390x CGO_ENABLED=1 go test -c -o=purego-test-cgo .
248          env QEMU_LD_PREFIX=/usr/s390x-linux-gnu qemu-s390x ./purego-test-cgo -test.shuffle=on -test.v -test.count=10
249          go env -u CC
250          go env -u CXX
251
252  bsd:
253    strategy:
254      matrix:
255        os: ['FreeBSD', 'NetBSD']
256        # Test only the latest two Go versions to save CI time.
257        # See https://go.dev/doc/devel/release#policy
258        go: ['1.25.8', '1.26.1']
259    name: Test with Go ${{ matrix.go }} on ${{ matrix.os }}
260    runs-on: ubuntu-22.04
261    defaults:
262      run:
263        shell: bash
264    steps:
265      - uses: actions/checkout@v5
266      - name: Run in FreeBSD
267        if: matrix.os == 'FreeBSD'
268        uses: vmactions/freebsd-vm@v1
269        with:
270          usesh: true
271          prepare: |
272            fetch https://go.dev/dl/go${{matrix.go}}.freebsd-amd64.tar.gz
273            rm -fr /usr/local/go && tar -C /usr/local -xf go${{matrix.go}}.freebsd-amd64.tar.gz
274            chmod +x $GITHUB_WORKSPACE/.github/scripts/bsd_tests.sh
275          run: $GITHUB_WORKSPACE/.github/scripts/bsd_tests.sh
276      - name: Run in NetBSD
277        if: matrix.os == 'NetBSD'
278        uses: vmactions/netbsd-vm@v1
279        with:
280          usesh: true
281          prepare: |
282            ftp https://go.dev/dl/go${{matrix.go}}.netbsd-amd64.tar.gz
283            mkdir /usr/local
284            rm -fr /usr/local/go && tar -C /usr/local -xf go${{matrix.go}}.netbsd-amd64.tar.gz
285            chmod +x $GITHUB_WORKSPACE/.github/scripts/bsd_tests.sh
286          run: $GITHUB_WORKSPACE/.github/scripts/bsd_tests.sh

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 102

↑↓ moveenter openesc close