Skip to content

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

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

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

name: Static Code Checks, Etc.
on:
push:
branches:
- "main"
- "release-[0-9]+.[0-9]"
tags: '**'
pull_request:
branches: '**'
permissions: read-all
jobs:
build:
name: Static Code Checks Etc
runs-on: ubuntu-24.04
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0
with:
egress-policy: audit
- name: Skip CI
run: |
if [[ "${{contains( github.event.pull_request.labels.*.name, 'Skip CI')}}" == "true" ]]; then
echo "skipping CI due to the 'Skip CI' label"
exit 1
fi
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: 'false'
- name: Run FOSSA scan and upload build data
uses: fossa-contrib/fossa-action@3d2ef181b1820d6dcd1972f86a767d18167fa19b # v3.0.1
with:
# This is a push-only API token: https://github.com/fossa-contrib/fossa-action#push-only-api-token
fossa-api-key: f62c11ef0c249fef239947f01279aa0f
github-token: ${{ github.token }}
- name: Check for changes in files
uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
id: changes
with:
token: ''
filters: |
go_files:
- '**/*.go'
- '*.go'
- 'go.sum'
- 'go.mod'
- '.github/workflows/static_checks_etc.yml'
parser_changes:
- 'go/vt/sqlparser/**'
- 'go.sum'
- 'go.mod'
- 'build.env'
- 'bootstrap.sh'
- 'tools/**'
- '.github/workflows/static_checks_etc.yml'
proto_changes:
- 'bootstrap.sh'
- 'tools/**'
- 'build.env'
- 'go.sum'
- 'go.mod'
- 'Makefile'
- 'go/vt/proto/**'
- 'proto/*.proto'
- '.github/workflows/static_checks_etc.yml'
sizegen:
- 'go/**/*.go'
- 'test.go'
- 'Makefile'
- 'build.env'
- 'go.sum'
- 'go.mod'
- 'tools/**'
- 'bootstrap.sh'
- '.github/workflows/static_checks_etc.yml'
visitor:
- 'go/tools/asthelpergen/**'
- 'go/vt/sqlparser/**'
- 'Makefile'
- 'build.env'
- 'go.sum'
- 'go.mod'
- 'tools/**'
- 'bootstrap.sh'
- 'misc/git/hooks/asthelpers'
- '.github/workflows/static_checks_etc.yml'
astfmt:
- 'go/tools/astfmtgen/**'
- 'go/vt/sqlparser/**'
- 'Makefile'
- 'build.env'
- 'go.sum'
- 'go.mod'
- 'tools/**'
- 'bootstrap.sh'
- '.github/workflows/static_checks_etc.yml'
end_to_end:
- 'docker/**'
- 'test.go'
- 'Makefile'
- 'bootstrap.sh'
- '.github/workflows/static_checks_etc.yml'
ci_config:
- 'test/config.json'
- '.github/workflows/static_checks_etc.yml'
release_notes:
- 'changelog/**'
- './go/tools/releases/**'
- '.github/workflows/static_checks_etc.yml'
github:
- '.github/**'
- 'Makefile'
- '.github/workflows/static_checks_etc.yml'
- name: Set up Go
if: (steps.changes.outputs.go_files == 'true' || steps.changes.outputs.parser_changes == 'true' || steps.changes.outputs.proto_changes == '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: Tune the OS
if: steps.changes.outputs.go_files == 'true'
uses: ./.github/actions/tune-os
- name: Get dependencies
if: (steps.changes.outputs.parser_changes == 'true' || steps.changes.outputs.go_files == 'true')
run: |
sudo apt-get update
sudo apt-get install -y make unzip g++ etcd-client etcd-server curl git wget
sudo service etcd stop
go mod download
- name: Run make minimaltools
if: (steps.changes.outputs.parser_changes == 'true' || steps.changes.outputs.go_files == 'true')
run: |
make minimaltools
- name: Install goimports
run: |
go install golang.org/x/tools/cmd/goimports@034e59c473362f8f2be47694d98fd3f12a1ad497 # v0.39.0
- name: Install yamllint
if: steps.changes.outputs.github == 'true'
run: pip install yamllint==1.38.0
- name: check_go_versions
run:
tools/check_go_versions.sh || exit 1
- name: check_make_parser
if: (steps.changes.outputs.parser_changes == 'true' || steps.changes.outputs.go_files == 'true')
run: |
tools/check_make_parser.sh || exit 1
- name: check_make_sizegen
if: (steps.changes.outputs.sizegen == 'true' || steps.changes.outputs.go_files == 'true')
run: |
tools/check_make_sizegen.sh || exit 1
- name: check_make_visitor
if: (steps.changes.outputs.visitor == 'true' || steps.changes.outputs.go_files == 'true')
run: |
misc/git/hooks/asthelpers || exit 1
- name: check_ast_format_fast
if: (steps.changes.outputs.astfmt == 'true' || steps.changes.outputs.go_files == 'true')
run: |
./tools/check_astfmtgen.sh || exit 1
- name: run ensure_bootstrap_version
if: steps.changes.outputs.end_to_end == 'true'
run: |
make ensure_bootstrap_version
git status
test -z "$(git diff-index --name-only HEAD --)" || exit 1
- name: Check .github YAML configs
if: steps.changes.outputs.github == 'true'
run: |
yamllint -d "{extends: relaxed, rules: {indentation: disable, line-length: disable, trailing-spaces: disable}}" \
.github/*.yml \
.github/ISSUE_TEMPLATE/*.yml \
.github/workflows/*.yml
- name: Run golangci-lint
if: steps.changes.outputs.go_files == 'true'
uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9.0.0
with:
args: --timeout 10m
install-mode: "goinstall"
skip-cache: true
working-directory: go
version: v2.9.0
- name: Run go mod tidy
if: steps.changes.outputs.go_files == 'true'
run: |
set -e
go mod tidy
output=$(git status -s)
if [ -z "${output}" ]; then
exit 0
fi
echo 'We wish to maintain a tidy state for go mod. Please run `go mod tidy` on your branch, commit and push again.'
echo 'Running `go mod tidy` on this CI test yields with the following changes:'
echo "$output"
exit 1
- name: Setup Node
if: steps.changes.outputs.proto_changes == 'true'
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
# make proto requires newer node than the pre-installed one
node-version: '22.13.1'
- name: check_make_proto
if: steps.changes.outputs.proto_changes == 'true'
run: |
tools/check_make_proto.sh || exit 1
- name: Check test/config.json
if: (steps.changes.outputs.go_files == 'true' || steps.changes.outputs.ci_config == 'true')
run: |
go run ./go/tools/ci-config/main.go || exit 1
- name: Check changelog
if: steps.changes.outputs.release_notes == 'true'
run: |
set -e
go run ./go/tools/releases/releases.go
output=$(git status -s)
if [ -z "${output}" ]; then
exit 0
fi
echo 'We wish to maintain a consistent changelog directory, please run `go run ./go/tools/releases/releases.go`, commit and push again.'
echo 'Running `go run ./go/tools/releases/releases.go` on CI yields the following changes:'
echo "$output"
echo ""
exit 1