Skip to content

go/vt/mysqlctl: run backup init sql after catchup, disable super read… #19675

go/vt/mysqlctl: run backup init sql after catchup, disable super read…

go/vt/mysqlctl: run backup init sql after catchup, disable super read… #19675

Workflow file for this run

name: Code Coverage
on:
schedule:
- cron: '0 0 * * 6' # Saturday midnight UTC
push:
branches:
- "main"
- "release-[0-9]+.[0-9]"
tags: '**'
pull_request:
branches: '**'
concurrency:
group: format('{0}-{1}-{2}', ${{ github.ref }}, ${{ github.event_name }}, 'Code Coverage')
cancel-in-progress: true
permissions: read-all
jobs:
test:
if: github.event_name != 'pull_request' || !contains(github.event.pull_request.labels.*.name, 'Backport')
name: Code Coverage
runs-on: oracle-vm-8cpu-32gb-x86-64
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0
with:
egress-policy: audit
- name: Check out code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
persist-credentials: 'false'
- name: Determine run mode
id: mode
run: |
if [ "${{ github.event_name }}" = "schedule" ]; then
echo "is_full_run=true" >> "$GITHUB_OUTPUT"
else
echo "is_full_run=false" >> "$GITHUB_OUTPUT"
fi
- name: Check for changes in files relevant to code coverage
if: steps.mode.outputs.is_full_run != 'true'
uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
id: changes
with:
token: ''
filters: |
changed_files:
- .github/workflows/codecov.yml
- 'go/**'
- go.mod
- go.sum
- Makefile
- name: Set up Go
if: steps.mode.outputs.is_full_run == 'true' || steps.changes.outputs.changed_files == 'true'
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
with:
go-version-file: go.mod
cache: ${{ (github.base_ref == 'main' || (github.base_ref == '' && github.ref_name == 'main')) && 'true' || 'false' }}
- name: Detect changed Go packages
if: steps.mode.outputs.is_full_run != 'true' && steps.changes.outputs.changed_files == 'true'
id: packages
run: |
BASE_SHA="${{ github.event.pull_request.base.sha }}"
HEAD_SHA="${{ github.event.pull_request.head.sha }}"
CHANGED_GO_FILES=$(git diff --name-only "$BASE_SHA" "$HEAD_SHA" -- '*.go')
if [ -z "$CHANGED_GO_FILES" ]; then
echo "BASE_SHA=$BASE_SHA"
echo "HEAD_SHA=$HEAD_SHA"
echo "packages=$PACKAGES"
echo "packages=" >> "$GITHUB_OUTPUT"
exit 0
fi
PACKAGE_DIRS=$(echo "$CHANGED_GO_FILES" | xargs -n1 dirname | sort -u)
# Validate as Go packages and exclude endtoend tests
PACKAGES=""
for dir in $PACKAGE_DIRS; do
case "$dir" in
*/endtoend*|go/cmd/vttestserver*) continue ;;
esac
if go list "./$dir" >/dev/null 2>&1; then
PACKAGES="${PACKAGES:+$PACKAGES }$dir"
fi
done
echo "BASE_SHA=$BASE_SHA"
echo "HEAD_SHA=$HEAD_SHA"
echo "packages=$PACKAGES"
echo "packages=$PACKAGES" >> "$GITHUB_OUTPUT"
- name: Set up python
if: steps.mode.outputs.is_full_run == 'true' || (steps.changes.outputs.changed_files == 'true' && steps.packages.outputs.packages != '')
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
- name: Tune the OS
if: steps.mode.outputs.is_full_run == 'true' || (steps.changes.outputs.changed_files == 'true' && steps.packages.outputs.packages != '')
uses: ./.github/actions/tune-os
- name: Setup MySQL
if: steps.mode.outputs.is_full_run == 'true' || (steps.changes.outputs.changed_files == 'true' && steps.packages.outputs.packages != '')
uses: ./.github/actions/setup-mysql
with:
flavor: mysql-8.4
- name: Get dependencies
if: steps.mode.outputs.is_full_run == 'true' || (steps.changes.outputs.changed_files == 'true' && steps.packages.outputs.packages != '')
run: |
export DEBIAN_FRONTEND="noninteractive"
sudo apt-get update
sudo apt-get install -y make unzip g++ curl git wget
go mod download
go install golang.org/x/tools/cmd/goimports@034e59c473362f8f2be47694d98fd3f12a1ad497 # v0.39.0
- name: Run make tools
if: steps.mode.outputs.is_full_run == 'true' || (steps.changes.outputs.changed_files == 'true' && steps.packages.outputs.packages != '')
run: |
make BUILD_JAVA=0 BUILD_PROTOC=0 tools
- name: Run coverage tests
if: steps.mode.outputs.is_full_run == 'true' || (steps.changes.outputs.changed_files == 'true' && steps.packages.outputs.packages != '')
timeout-minutes: 60
run: |
set -exo pipefail
export VTDATAROOT="/tmp/"
export NOVTADMINBUILD=1
source build.env
if [ "${{ steps.mode.outputs.is_full_run }}" = "true" ]; then
make unit_test_cover
else
make COVERAGE_PACKAGES="${{ steps.packages.outputs.packages }}" unit_test_cover
fi
- name: Upload coverage reports
if: steps.mode.outputs.is_full_run == 'true' || (steps.changes.outputs.changed_files == 'true' && steps.packages.outputs.packages != '')
uses: codecov/codecov-action@1af58845a975a7985b0beb0cbe6fbbb71a41dbad # v5.5.3
with:
files: coverage.out
fail_ci_if_error: true
verbose: true
flags: ${{ steps.mode.outputs.is_full_run == 'true' && '' || 'partial' }}
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}