Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize make build in test.go and in CI #13567

Merged
merged 1 commit into from
Jul 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/endtoend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ jobs:
- name: Build
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
run: |
make build
NOVTADMINBUILD=1 make build

- name: endtoend
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.end_to_end == 'true'
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/local_example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ jobs:
with:
go-version: 1.20.5

- uses: actions/setup-node@v3
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.examples == 'true'
with:
# node-version should match package.json
node-version: '18.16.0'

- name: Tune the OS
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.examples == 'true'
run: |
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/region_example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ jobs:
with:
go-version: 1.20.5

- uses: actions/setup-node@v3
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.examples == 'true'
with:
# node-version should match package.json
node-version: '18.16.0'

- name: Tune the OS
if: steps.skip-workflow.outputs.skip-workflow == 'false' && steps.changes.outputs.examples == 'true'
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/upgrade_downgrade_test_backups_e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ jobs:
timeout-minutes: 10
run: |
source build.env
make build
NOVTADMINBUILD=1 make build
mkdir -p /tmp/vitess-build-other/
cp -R bin /tmp/vitess-build-other/
rm -Rf bin/*
Expand All @@ -153,7 +153,7 @@ jobs:
timeout-minutes: 10
run: |
source build.env
make build
NOVTADMINBUILD=1 make build
mkdir -p /tmp/vitess-build-current/
cp -R bin /tmp/vitess-build-current/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ jobs:
timeout-minutes: 10
run: |
source build.env
make build
NOVTADMINBUILD=1 make build
mkdir -p /tmp/vitess-build-other/
cp -R bin /tmp/vitess-build-other/
rm -Rf bin/*
Expand All @@ -156,7 +156,7 @@ jobs:
timeout-minutes: 10
run: |
source build.env
make build
NOVTADMINBUILD=1 make build
mkdir -p /tmp/vitess-build-current/
cp -R bin /tmp/vitess-build-current/

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/upgrade_downgrade_test_backups_manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ jobs:
timeout-minutes: 5
run: |
source build.env
make build
NOVTADMINBUILD=1 make build
mkdir -p /tmp/vitess-build-other/
cp -R bin /tmp/vitess-build-other/
rm -Rf bin/*
Expand All @@ -178,7 +178,7 @@ jobs:
timeout-minutes: 5
run: |
source build.env
make build
NOVTADMINBUILD=1 make build
mkdir -p /tmp/vitess-build-current/
cp -R bin /tmp/vitess-build-current/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ jobs:
timeout-minutes: 5
run: |
source build.env
make build
NOVTADMINBUILD=1 make build
mkdir -p /tmp/vitess-build-other/
cp -R bin /tmp/vitess-build-other/
rm -Rf bin/*
Expand All @@ -181,7 +181,7 @@ jobs:
timeout-minutes: 5
run: |
source build.env
make build
NOVTADMINBUILD=1 make build
mkdir -p /tmp/vitess-build-current/
cp -R bin /tmp/vitess-build-current/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ jobs:
timeout-minutes: 10
run: |
source build.env
make build
NOVTADMINBUILD=1 make build
mkdir -p /tmp/vitess-build-other/
cp -R bin /tmp/vitess-build-other/
rm -Rf bin/*
Expand All @@ -171,7 +171,7 @@ jobs:
timeout-minutes: 10
run: |
source build.env
make build
NOVTADMINBUILD=1 make build
mkdir -p /tmp/vitess-build-current/
cp -R bin /tmp/vitess-build-current/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ jobs:
timeout-minutes: 10
run: |
source build.env
make build
NOVTADMINBUILD=1 make build
mkdir -p /tmp/vitess-build-other/
cp -R bin /tmp/vitess-build-other/
rm -Rf bin/*
Expand All @@ -174,7 +174,7 @@ jobs:
timeout-minutes: 10
run: |
source build.env
make build
NOVTADMINBUILD=1 make build
mkdir -p /tmp/vitess-build-current/
cp -R bin /tmp/vitess-build-current/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ jobs:
timeout-minutes: 10
run: |
source build.env
make build
NOVTADMINBUILD=1 make build
mkdir -p /tmp/vitess-build-other/
cp -R bin /tmp/vitess-build-other/
rm -Rf bin/*
Expand All @@ -171,7 +171,7 @@ jobs:
timeout-minutes: 10
run: |
source build.env
make build
NOVTADMINBUILD=1 make build
mkdir -p /tmp/vitess-build-current/
cp -R bin /tmp/vitess-build-current/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ jobs:
timeout-minutes: 10
run: |
source build.env
make build
NOVTADMINBUILD=1 make build
mkdir -p /tmp/vitess-build-other/
cp -R bin /tmp/vitess-build-other/
rm -Rf bin/*
Expand All @@ -174,7 +174,7 @@ jobs:
timeout-minutes: 10
run: |
source build.env
make build
NOVTADMINBUILD=1 make build
mkdir -p /tmp/vitess-build-current/
cp -R bin /tmp/vitess-build-current/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ jobs:
timeout-minutes: 10
run: |
source build.env
make build
NOVTADMINBUILD=1 make build
mkdir -p /tmp/vitess-build-other/
cp -R bin /tmp/vitess-build-other/
rm -Rf bin/*
Expand All @@ -174,7 +174,7 @@ jobs:
timeout-minutes: 10
run: |
source build.env
make build
NOVTADMINBUILD=1 make build
mkdir -p /tmp/vitess-build-current/
cp -R bin /tmp/vitess-build-current/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ jobs:
timeout-minutes: 10
run: |
source build.env
make build
NOVTADMINBUILD=1 make build
mkdir -p /tmp/vitess-build-other/
cp -R bin /tmp/vitess-build-other/
rm -Rf bin/*
Expand All @@ -174,7 +174,7 @@ jobs:
timeout-minutes: 10
run: |
source build.env
make build
NOVTADMINBUILD=1 make build
mkdir -p /tmp/vitess-build-current/
cp -R bin /tmp/vitess-build-current/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ jobs:
timeout-minutes: 10
run: |
source build.env
make build
NOVTADMINBUILD=1 make build
mkdir -p /tmp/vitess-build-other/
cp -R bin /tmp/vitess-build-other/
rm -Rf bin/*
Expand All @@ -171,7 +171,7 @@ jobs:
timeout-minutes: 10
run: |
source build.env
make build
NOVTADMINBUILD=1 make build
mkdir -p /tmp/vitess-build-current/
cp -R bin /tmp/vitess-build-current/

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ jobs:
timeout-minutes: 10
run: |
source build.env
make build
NOVTADMINBUILD=1 make build
mkdir -p /tmp/vitess-build-other/
cp -R bin /tmp/vitess-build-other/
rm -Rf bin/*
Expand All @@ -171,7 +171,7 @@ jobs:
timeout-minutes: 10
run: |
source build.env
make build
NOVTADMINBUILD=1 make build
mkdir -p /tmp/vitess-build-current/
cp -R bin /tmp/vitess-build-current/

Expand Down
11 changes: 8 additions & 3 deletions test.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,9 @@ var (
skipBuild = flag.Bool("skip-build", false, "skip running 'make build'. Assumes pre-existing binaries exist")
partialKeyspace = flag.Bool("partial-keyspace", false, "add a second keyspace for sharded tests and mark first shard as moved to this keyspace in the shard routing rules")
// `go run test.go --dry-run --skip-build` to quickly test this file and see what tests will run
dryRun = flag.Bool("dry-run", false, "For each test to be run, it will output the test attributes, but NOT run the tests. Useful while debugging changes to test.go (this file)")
remoteStats = flag.String("remote-stats", "", "url to send remote stats")
dryRun = flag.Bool("dry-run", false, "For each test to be run, it will output the test attributes, but NOT run the tests. Useful while debugging changes to test.go (this file)")
remoteStats = flag.String("remote-stats", "", "url to send remote stats")
buildVTAdmin = flag.Bool("build-vtadmin", false, "Enable or disable VTAdmin build during 'make build'")
)

var (
Expand Down Expand Up @@ -425,7 +426,11 @@ func main() {
} else {
// Since we're sharing the working dir, do the build once for all tests.
log.Printf("Running make build...")
if out, err := exec.Command("make", "build").CombinedOutput(); err != nil {
command := exec.Command("make", "build")
if !*buildVTAdmin {
command.Env = append(command.Env, "NOVTADMINBUILD=1")
}
if out, err := command.CombinedOutput(); err != nil {
log.Fatalf("make build failed: %v\n%s", err, out)
}
}
Expand Down