1414
1515 strategy :
1616 matrix :
17+ arch :
18+ - x64
19+ - armv7
20+ - aarch64
1721 go :
1822 - ' 1.13'
1923 - ' 1.14'
@@ -30,18 +34,58 @@ jobs:
3034 go-version : ' ${{ matrix.go }}'
3135
3236 - name : ' Build'
37+ if : ${{ matrix.arch == 'x64' }}
3338 run : go build -v ./...
3439
3540 - name : ' Test'
41+ if : ${{ matrix.arch == 'x64' }}
3642 run : go test -v ./...
3743
44+ - name : ' TestRace'
45+ if : ${{ matrix.arch == 'x64' }}
46+ run : go test -race -v ./...
47+
48+ - name : ' Bench'
49+ if : ${{ matrix.arch == 'x64' }}
50+ run : go test -run=- -bench=. -benchtime=1x -v ./...
51+
52+ - name : ' BenchRace'
53+ if : ${{ matrix.arch == 'x64' }}
54+ run : go test -run=- -bench=. -benchtime=1x -race -v ./...
55+
3856 - name : ' Vet'
57+ if : ${{ matrix.arch == 'x64' }}
3958 # -unsafeptr=false is needed because of the noescape function in bigint.go.
4059 run : go vet -unsafeptr=false ./...
4160
4261 - name : ' Staticcheck'
4362 # staticcheck requires go1.14.
44- if : ${{ matrix.go != '1.13' }}
63+ if : ${{ matrix.arch == 'x64' && matrix. go != '1.13' }}
4564 run : |
4665 go get honnef.co/go/tools/cmd/staticcheck
4766 staticcheck ./...
67+
68+ - name : ' BuildTest for armv7'
69+ if : ${{ matrix.arch == 'armv7' }}
70+ env :
71+ GOARCH : arm
72+ GOARM : 7
73+ run : go test -c ./...
74+
75+ - name : ' BuildTest for aarch64'
76+ if : ${{ matrix.arch == 'aarch64' }}
77+ env :
78+ GOARCH : arm64
79+ run : go test -c ./...
80+
81+ - name : ' Test and Bench on ${{ matrix.arch }}'
82+ # arch != 'x64': we already tested on x86 above.
83+ # go != '1.13': go1.13 + arm is significantly slower, so don't run test suite.
84+ if : ${{ matrix.arch != 'x64' && matrix.go != '1.13' }}
85+ uses : uraimo/run-on-arch-action@v2.1.1
86+ with :
87+ arch : ${{ matrix.arch }}
88+ distro : ubuntu20.04
89+ dockerRunArgs : --mount type=bind,source="$(pwd)",target=/checkout,readonly
90+ run : |
91+ find /checkout -name '*.test' -type f -executable -print0 | xargs -0 -I '{}' sh -c '{} -test.run=. -test.bench=. -test.benchtime=1x -test.v'
0 commit comments