Skip to content

Commit

Permalink
Added arch i386 support (#3)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
asdek committed May 5, 2023
1 parent 11eaac0 commit f9acdea
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 1 deletion.
22 changes: 21 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
fail-fast: false
matrix:
arch:
- i386
- arm64
- amd64
go:
Expand All @@ -44,6 +45,25 @@ jobs:
if: ${{ matrix.arch == 'amd64' }}
run: go test -bench=. -benchmem -race -v ./...

# 386
- name: 'Build with ${{ matrix.go }} for i386'
if: ${{ matrix.arch == 'i386' }}
env:
GOARCH: 386
run: |
go test -c *.go && cd goid && go test -c ./...
- name: 'Test and Bench with ${{ matrix.go }} on i386'
if: ${{ matrix.arch == 'i386' }}
uses: vxcontrol/run-on-arch-action@0.9.0
with:
arch: i386
distro: bullseye
dockerRunArgs: --mount type=bind,source="$(pwd)",target=/checkout,readonly
run: |
find /checkout -name '*.test' -type f -executable -print0 | \
xargs -t -0 -I '{}' sh -c '{} -test.v && {} -test.bench=. -test.benchmem -test.v'
# arm64
- name: 'Build with ${{ matrix.go }} for arm64'
if: ${{ matrix.arch == 'arm64' }}
Expand All @@ -54,7 +74,7 @@ jobs:
- name: 'Test and Bench with ${{ matrix.go }} on arm64'
if: ${{ matrix.arch == 'arm64' }}
uses: uraimo/run-on-arch-action@v2
uses: vxcontrol/run-on-arch-action@0.9.0
with:
arch: aarch64
distro: bullseye
Expand Down
7 changes: 7 additions & 0 deletions goid/goid_386.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package goid

func getg() *g

func Get() int64 {
return getg().goid
}
8 changes: 8 additions & 0 deletions goid/goid_386.s
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#include "go_asm.h"
#include "textflag.h"

TEXT ·getg(SB), NOSPLIT, $0-4
MOVL TLS, CX
MOVL 0(CX)(TLS*1), AX
MOVL AX, ret+0(FP)
RET

0 comments on commit f9acdea

Please sign in to comment.