|
| 1 | +--- |
| 2 | +name: Reusable Tests Workflow |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + arch: |
| 7 | + required: true |
| 8 | + type: string |
| 9 | + runs-on: |
| 10 | + required: true |
| 11 | + type: string |
| 12 | + targets: |
| 13 | + required: false |
| 14 | + type: string |
| 15 | + |
| 16 | +jobs: |
| 17 | + test: |
| 18 | + runs-on: ${{ inputs.runs-on }} |
| 19 | + # this is to prevent arm64 jobs from running at forked projects |
| 20 | + if: inputs.arch == 'amd64' || github.repository == 'etcd-io/etcd' |
| 21 | + strategy: |
| 22 | + fail-fast: false |
| 23 | + matrix: |
| 24 | + target: ${{ fromJSON(inputs.targets) }} |
| 25 | + steps: |
| 26 | + - uses: actions/checkout@v2 |
| 27 | + - id: goversion |
| 28 | + run: echo "goversion=$(cat .go-version)" >> "$GITHUB_OUTPUT" |
| 29 | + - uses: actions/setup-go@v2 |
| 30 | + with: |
| 31 | + go-version: ${{ steps.goversion.outputs.goversion }} |
| 32 | + - run: date |
| 33 | + - env: |
| 34 | + TARGET: ${{ matrix.target }} |
| 35 | + run: | |
| 36 | + set -euo pipefail |
| 37 | +
|
| 38 | + echo "${TARGET}" |
| 39 | + case "${TARGET}" in |
| 40 | + linux-test-smoke) |
| 41 | + GOARCH=${{ inputs.arch }} CPU=4 RACE='false' make test-smoke |
| 42 | + ;; |
| 43 | + linux-integration-1-cpu) |
| 44 | + make install-gofail |
| 45 | + GOARCH=${{ inputs.arch }} CPU=1 RACE='false' FAILPOINTS='true' make test-integration |
| 46 | + ;; |
| 47 | + linux-integration-2-cpu) |
| 48 | + make install-gofail |
| 49 | + GOARCH=${{ inputs.arch }} CPU=2 RACE='false' FAILPOINTS='true' make test-integration |
| 50 | + ;; |
| 51 | + linux-integration-4-cpu) |
| 52 | + make install-gofail |
| 53 | + GOARCH=${{ inputs.arch }} CPU=4 RACE='false' FAILPOINTS='true' make test-integration |
| 54 | + ;; |
| 55 | + linux-unit-4-cpu-race) |
| 56 | + GOARCH=${{ inputs.arch }} RACE='true' CPU='4' GO_TEST_FLAGS='-p=2' make test-unit |
| 57 | + ;; |
| 58 | + linux-386-unit-1-cpu) |
| 59 | + GOOS=linux GOARCH=386 CPU=1 GO_TEST_FLAGS='-p=4' make test-unit |
| 60 | + ;; |
| 61 | + all-build) |
| 62 | + GOARCH=amd64 PASSES='build' ./test.sh |
| 63 | + GOARCH=386 PASSES='build' ./test.sh |
| 64 | + GO_BUILD_FLAGS='-v -mod=readonly' GOOS=darwin GOARCH=amd64 ./build.sh |
| 65 | + GO_BUILD_FLAGS='-v -mod=readonly' GOOS=darwin GOARCH=arm64 ./build.sh |
| 66 | + GO_BUILD_FLAGS='-v -mod=readonly' GOOS=windows GOARCH=amd64 ./build.sh |
| 67 | + GO_BUILD_FLAGS='-v -mod=readonly' GOARCH=arm ./build.sh |
| 68 | + GO_BUILD_FLAGS='-v -mod=readonly' GOARCH=arm64 ./build.sh |
| 69 | + GO_BUILD_FLAGS='-v -mod=readonly' GOARCH=ppc64le ./build.sh |
| 70 | + GO_BUILD_FLAGS='-v -mod=readonly' GOARCH=s390x ./build.sh |
| 71 | + ;; |
| 72 | + *) |
| 73 | + echo "Failed to find target" |
| 74 | + exit 1 |
| 75 | + ;; |
| 76 | + esac |
0 commit comments