-
Notifications
You must be signed in to change notification settings - Fork 26
132 lines (129 loc) · 4.83 KB
/
ci-br.yml
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
name: TiKV-BR
on:
push:
branches: main
paths: br/**
pull_request:
branches: main
paths: br/**
permissions:
contents: read
env:
GO_VERSION: 1.21.4
jobs:
br-check-tidy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '${{ env.GO_VERSION }}'
- name: make check/tidy
shell: bash
run: |
cd br
make check/tidy
br-check-golangci-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '${{ env.GO_VERSION }}'
- name: make check/golangci-lint
shell: bash
run: |
cd br
make check/golangci-lint
br-check-gosec:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '${{ env.GO_VERSION }}'
- name: make check/gosec
shell: bash
run: |
cd br
make check/gosec
br-unit-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '${{ env.GO_VERSION }}'
- name: make test_coverage
shell: bash
run: |
cd br
make test
make report_coverage
br-integration-test:
name: br-integration-test-${{ matrix.tikv_version }}-apiv${{ matrix.api_version }}-tls_${{ matrix.with_tls }}
runs-on: ubuntu-latest
strategy:
matrix:
tikv_version: [v6.1.7, v6.5.3, v7.1.2, nightly]
api_version: [1, 2]
with_tls: [false, true]
include:
- tikv_version: v5.0.6
api_version: 1
with_tls: true
- tikv_version: v5.4.3
api_version: 1
with_tls: true
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: '${{ env.GO_VERSION }}'
- name: install tiup
run: curl --proto '=https' --tlsv1.2 -sSf https://tiup-mirrors.pingcap.com/install.sh | sh
- name: download tikv binary
run: |
/home/runner/.tiup/bin/tiup install tikv:${{ matrix.tikv_version }} pd:${{ matrix.tikv_version }}
- name: start tikv cluster
run: |
# start tikv
# Output the api version
echo "API_VERSION=${{ matrix.api_version }}" >> $GITHUB_ENV
echo "CLUSTER_VERSION=${{ matrix.tikv_version }}" >> $GITHUB_ENV
# TODO: different deploy method for tls enabled and disabled, may use same one.
if ${{ matrix.with_tls }}; then
echo "TLS_PD_PORT=2579" >> $GITHUB_ENV
echo "PD_ADDR=127.0.0.1:2579" >> $GITHUB_ENV
cd /home/runner/work/migration/migration/br/tests/utils
# copy binary
cp /home/runner/.tiup/components/tikv/*${{ matrix.tikv_version }}*/tikv-server .
cp /home/runner/.tiup/components/pd/*${{ matrix.tikv_version }}*/pd-server .
mkdir /tmp/tikv_cluster
./start_tls_tikv_cluster --workdir /tmp/tikv_cluster --tlsdir /home/runner/work/migration/migration/cdc/tests/integration_tests/_certificates --api_version ${{ matrix.api_version }}
echo "TLS_CA=/home/runner/work/migration/migration/cdc/tests/integration_tests/_certificates/ca.pem" >> $GITHUB_ENV
echo "TLS_CERT=/home/runner/work/migration/migration/cdc/tests/integration_tests/_certificates/client.pem" >> $GITHUB_ENV
echo "TLS_KEY=/home/runner/work/migration/migration/cdc/tests/integration_tests/_certificates/client-key.pem" >> $GITHUB_ENV
echo "start tikv for apiversion ${{ matrix.with_tls }} and tls enabled"
else
echo -e "\napi-version = ${{ matrix.api_version }}\n" >> /home/runner/work/migration/migration/.github/config/br_rawkv.toml
/home/runner/.tiup/bin/tiup playground ${{ matrix.tikv_version }} --mode tikv-slim --host 127.0.0.1 --kv 1 --without-monitor --kv.config /home/runner/work/migration/migration/.github/config/br_rawkv.toml --pd.port 2379 --pd.config /home/runner/work/migration/migration/.github/config/br_pd.toml &> raw.out 2>&1 &
# The first run of `tiup` has to download all components so it'll take longer.
timeout 180 tail -f raw.out | grep -q 'PD Endpoints'
if [ $? -ne 0 ]; then
echo "Failed to start TiKV cluster"
exit 1
fi
# Parse PD address from `tiup` output
echo "PD_ADDR=127.0.0.1:2379" >> $GITHUB_ENV
# Log the output
echo "$(cat raw.out)" >&2
fi
- name: run integration test
run: |
cd br
make test/integration
make report_coverage
- name: display backup log
run: |
cat /tmp/br.log*