-
Notifications
You must be signed in to change notification settings - Fork 169
49 lines (48 loc) · 1.5 KB
/
test_template.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
name: Workflow Test Template
on:
workflow_call:
inputs:
runs-on:
required: false
type: string
default: ubuntu-latest
targets:
required: false
type: string
default: "[]"
permissions: read-all
jobs:
run:
runs-on: ${{ inputs.runs-on }}
# this is to prevent arm64 jobs from running at forked projects
if: inputs.arch != 'arm64' || github.repository == 'etcd-io/raft'
strategy:
fail-fast: false
matrix:
target: ${{ fromJSON(inputs.targets) }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- id: goversion
run: echo "goversion=$(cat .go-version)" >> "$GITHUB_OUTPUT"
- uses: actions/setup-go@3041bf56c941b39c61721a86cd11f3bb1338122a # v5.2.0
with:
go-version: ${{ steps.goversion.outputs.goversion }}
- env:
TARGET: ${{ matrix.target }}
run: |
go clean -testcache
case "${TARGET}" in
linux-amd64-unit-4-cpu-race)
GOARCH=amd64 PASSES='unit' RACE='true' CPU='4' ./scripts/test.sh -p=2
;;
linux-386-unit-1-cpu)
GOARCH=386 PASSES='unit' RACE='false' CPU='1' ./scripts/test.sh -p=4
;;
linux-arm64-unit-4-cpu-race)
GOARCH=arm64 PASSES='unit' RACE='true' CPU='4' ./scripts/test.sh -p=2
;;
*)
echo "Failed to find target"
exit 1
;;
esac