Skip to content

Commit f9acdea

Browse files
authored
Added arch i386 support (#3)
* feat: added arch i386 support * fix: using another actions for i386 according to uraimo/run-on-arch-action#58 * fix: using refs for actions link * fix: refs to full commit version hash * fix: changed base action image to own fork * fix: arch typo 386 => i386
1 parent 11eaac0 commit f9acdea

File tree

3 files changed

+36
-1
lines changed

3 files changed

+36
-1
lines changed

.github/workflows/test.yml

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ jobs:
1818
fail-fast: false
1919
matrix:
2020
arch:
21+
- i386
2122
- arm64
2223
- amd64
2324
go:
@@ -44,6 +45,25 @@ jobs:
4445
if: ${{ matrix.arch == 'amd64' }}
4546
run: go test -bench=. -benchmem -race -v ./...
4647

48+
# 386
49+
- name: 'Build with ${{ matrix.go }} for i386'
50+
if: ${{ matrix.arch == 'i386' }}
51+
env:
52+
GOARCH: 386
53+
run: |
54+
go test -c *.go && cd goid && go test -c ./...
55+
56+
- name: 'Test and Bench with ${{ matrix.go }} on i386'
57+
if: ${{ matrix.arch == 'i386' }}
58+
uses: vxcontrol/[email protected]
59+
with:
60+
arch: i386
61+
distro: bullseye
62+
dockerRunArgs: --mount type=bind,source="$(pwd)",target=/checkout,readonly
63+
run: |
64+
find /checkout -name '*.test' -type f -executable -print0 | \
65+
xargs -t -0 -I '{}' sh -c '{} -test.v && {} -test.bench=. -test.benchmem -test.v'
66+
4767
# arm64
4868
- name: 'Build with ${{ matrix.go }} for arm64'
4969
if: ${{ matrix.arch == 'arm64' }}
@@ -54,7 +74,7 @@ jobs:
5474
5575
- name: 'Test and Bench with ${{ matrix.go }} on arm64'
5676
if: ${{ matrix.arch == 'arm64' }}
57-
uses: uraimo/run-on-arch-action@v2
77+
uses: vxcontrol/run-on-arch-action@0.9.0
5878
with:
5979
arch: aarch64
6080
distro: bullseye

goid/goid_386.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package goid
2+
3+
func getg() *g
4+
5+
func Get() int64 {
6+
return getg().goid
7+
}

goid/goid_386.s

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#include "go_asm.h"
2+
#include "textflag.h"
3+
4+
TEXT ·getg(SB), NOSPLIT, $0-4
5+
MOVL TLS, CX
6+
MOVL 0(CX)(TLS*1), AX
7+
MOVL AX, ret+0(FP)
8+
RET

0 commit comments

Comments
 (0)