forked from etcd-io/raft
-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (48 loc) · 1.5 KB
/
test_template.yaml
File metadata and controls
49 lines (48 loc) · 1.5 KB
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@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
- id: goversion
run: echo "goversion=$(cat .go-version)" >> "$GITHUB_OUTPUT"
- uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5 # v5.5.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