v0.11.0-alpha.5 5faf54b

test.yml RawHistoryFolder

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