forked from tikv/pd
-
Notifications
You must be signed in to change notification settings - Fork 0
90 lines (90 loc) · 2.95 KB
/
pd-tests.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
on:
push:
branches:
- master
- release-4.0
- release-5.0
pull_request:
branches:
- master
- release-4.0
- release-5.0
name: PD Tests
jobs:
chunks:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
worker_id: [1, 2, 3, 4]
outputs:
job-total: ${{ strategy.job-total }}
steps:
- uses: actions/setup-go@v2
with:
go-version: 1.14
- name: Checkout code
uses: actions/checkout@v2
- name: Restore cache
uses: actions/cache@v2
with:
path: |
~/go/pkg/mod
~/.cache/go-build
**/.tools
**/.dashboard_asset_cache
key: ${{ runner.os }}-go-${{ matrix.worker_id }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-${{ matrix.worker_id }}
${{ runner.os }}-go-
- name: Dispatch Packages
id: packages-units
env:
WORKER_ID: ${{ matrix.worker_id }}
run: |
go list ./... |grep -v -E "github.com/tikv/pd/tests/client|github.com/tikv/pd/server/api" > packages.list
total=$(expr ${{ strategy.job-total }} - 1)
echo "Dispatched ${total} normal chunks"
split packages.list -n r/${total} packages_unit_ -a 1 --numeric-suffixes=1
echo "Dispatched 2 special task to the last chunk(the special test takes a long time)"
echo github.com/tikv/pd/tests/client > packages_unit_${{ strategy.job-total }}
echo github.com/tikv/pd/server/api >> packages_unit_${{ strategy.job-total }}
packages="{$(cat packages_unit_${WORKER_ID} |tr "\n" ",")}"
echo "This worker will test the chunk - ${packages}"
echo "::set-output name=list::${packages}"
- name: Make Test
env:
WORKER_ID: ${{ matrix.worker_id }}
run: |
make test-with-cover TEST_PKGS="${{ steps.packages-units.outputs.list }}"
mv covprofile covprofile_$WORKER_ID
sed -i "/failpoint_binding/d" covprofile_$WORKER_ID
- name: Upload coverage result ${{ matrix.worker_id }}
uses: actions/upload-artifact@v2
with:
name: cover-reports
path: covprofile_${{ matrix.worker_id }}
report-coverage:
needs: chunks
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Download chunk report
uses: actions/download-artifact@v2
with:
name: cover-reports
- name: Merge
env:
TOTAL_JOBS: ${{needs.chunks.outputs.job-total}}
run: |
echo ${TOTAL_JOBS}
for i in $(seq 1 $TOTAL_JOBS); do cat covprofile_$i >> covprofile; done
cat covprofile
- name: Send coverage
uses: codecov/codecov-action@v1
with:
token: ${{ secrets.CODECOV }}
file: ./covprofile
flags: unittests
name: codecov-umbrella