...
1name: Tests
2on: [push, pull_request]
3jobs:
4 test-linux:
5 strategy:
6 fail-fast: false
7 matrix:
8 target:
9 - linux-amd64-unit-test-1-cpu
10 - linux-amd64-unit-test-2-cpu
11 - linux-amd64-unit-test-4-cpu
12 - linux-amd64-unit-test-4-cpu-race
13 runs-on: ubuntu-latest
14 steps:
15 - uses: actions/checkout@v3
16 - uses: actions/setup-go@v3
17 with:
18 go-version: "1.17.13"
19 - run: make fmt
20 - env:
21 TARGET: ${{ matrix.target }}
22 run: |
23 case "${TARGET}" in
24 linux-amd64-unit-test-1-cpu)
25 CPU=1 make test
26 ;;
27 linux-amd64-unit-test-2-cpu)
28 CPU=2 make test
29 ;;
30 linux-amd64-unit-test-4-cpu)
31 CPU=4 make test
32 ;;
33 linux-amd64-unit-test-4-cpu-race)
34 # XXX: By default, the Github Action runner will terminate the process
35 # if it has high resource usage. Try to use GOGC to limit memory and
36 # cpu usage here to prevent unexpected terminating. It can be replaced
37 # with GOMEMLIMIT=2048MiB if the go-version is updated to >=1.19.x.
38 #
39 # REF: https://github.com/actions/runner-images/issues/6680#issuecomment-1335778010
40 GOGC=30 CPU=4 ENABLE_RACE=true make test
41 ;;
42 *)
43 echo "Failed to find target"
44 exit 1
45 ;;
46 esac
47 - name: golangci-lint
48 uses: golangci/golangci-lint-action@08e2f20817b15149a52b5b3ebe7de50aff2ba8c5 # v3.4.0
49
50 test-windows:
51 strategy:
52 fail-fast: false
53 matrix:
54 target:
55 - windows-amd64-unit-test-4-cpu
56 # FIXME(fuweid):
57 #
58 # The windows will throws the following error when enable race.
59 # We skip it until we have solution.
60 #
61 # ThreadSanitizer failed to allocate 0x000200000000 (8589934592) bytes at 0x0400c0000000 (error code: 1455)
62 #
63 #- windows-amd64-unit-test-4-cpu-race
64 runs-on: windows-latest
65 steps:
66 - uses: actions/checkout@v3
67 - uses: actions/setup-go@v3
68 with:
69 go-version: "1.17.13"
70 - run: make fmt
71 - env:
72 TARGET: ${{ matrix.target }}
73 run: |
74 case "${TARGET}" in
75 windows-amd64-unit-test-4-cpu)
76 CPU=4 make test
77 ;;
78 *)
79 echo "Failed to find target"
80 exit 1
81 ;;
82 esac
83 shell: bash
84 - name: golangci-lint
85 uses: golangci/golangci-lint-action@08e2f20817b15149a52b5b3ebe7de50aff2ba8c5 # v3.4.0
86
87 coverage:
88 needs: ["test-linux", "test-windows"]
89 strategy:
90 matrix:
91 os: [ubuntu-latest, windows-latest]
92 runs-on: ${{ matrix.os }}
93 steps:
94 - uses: actions/checkout@v3
95 - uses: actions/setup-go@v3
96 with:
97 go-version: "1.17.13"
98 - run: make coverage
99
View as plain text