mirror of https://github.com/tikv/migration.git
133 lines
4.8 KiB
YAML
133 lines
4.8 KiB
YAML
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*
|