Skip to content

Step in Github action workflow to verify each go test files have a build tag assigned to it #7933

Step in Github action workflow to verify each go test files have a build tag assigned to it

Step in Github action workflow to verify each go test files have a build tag assigned to it #7933

Workflow file for this run

name: Go
on:
push:
branches: ['main', '*.*-dev', '*.*.*-dev']
pull_request:
branches: [main]
jobs:
build-and-test:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: "1.23.1"
- name: Build
run: |
cd yb-voyager
go build -v ./...
- name: Verify Build Tags in Test Files
run: |
MISSING_TAGS=$(grep -L '//go:build' $(find . -type f -name '*_test.go' | grep -v vendor) || true)
if [[ -n "$MISSING_TAGS" ]]; then
echo "The following test files are missing a build tag: "
echo "$MISSING_TAGS"
echo "Ensure all test files have a build tag. If a new build tag is introduced, make sure to update the workflow to trigger the tests for that build tag."
exit 1
fi
- name: Test
run: |
cd yb-voyager
go test -v ./... -tags 'unit'
- name: Vet
run: |
cd yb-voyager
go vet ./...
- name: Run staticcheck
run: |
cd yb-voyager
go install honnef.co/go/tools/cmd/staticcheck@2024.1.1
staticcheck ./...