From 307aad8b259e459cb4bd857f91f005786f18a7bf Mon Sep 17 00:00:00 2001 From: Florent Poinsard Date: Thu, 20 Jul 2023 12:08:44 +0200 Subject: [PATCH] Optimize 'make build' in test.go and in CI Signed-off-by: Florent Poinsard --- .github/workflows/endtoend.yml | 2 +- .github/workflows/local_example.yml | 6 ++++++ .github/workflows/region_example.yml | 6 ++++++ .../workflows/upgrade_downgrade_test_backups_e2e.yml | 4 ++-- ...pgrade_downgrade_test_backups_e2e_next_release.yml | 4 ++-- .../upgrade_downgrade_test_backups_manual.yml | 4 ++-- ...ade_downgrade_test_backups_manual_next_release.yml | 4 ++-- .../upgrade_downgrade_test_query_serving_queries.yml | 4 ++-- ...ngrade_test_query_serving_queries_next_release.yml | 4 ++-- .../upgrade_downgrade_test_query_serving_schema.yml | 4 ++-- ...wngrade_test_query_serving_schema_next_release.yml | 4 ++-- .../upgrade_downgrade_test_reparent_new_vtctl.yml | 4 ++-- .../upgrade_downgrade_test_reparent_new_vttablet.yml | 4 ++-- .../upgrade_downgrade_test_reparent_old_vtctl.yml | 4 ++-- .../upgrade_downgrade_test_reparent_old_vttablet.yml | 4 ++-- test.go | 11 ++++++++--- 16 files changed, 45 insertions(+), 28 deletions(-) diff --git a/.github/workflows/endtoend.yml b/.github/workflows/endtoend.yml index c7d83929e82..214acb31cb1 100644 --- a/.github/workflows/endtoend.yml +++ b/.github/workflows/endtoend.yml @@ -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' diff --git a/.github/workflows/local_example.yml b/.github/workflows/local_example.yml index b90e9b463d0..a13a9da01e0 100644 --- a/.github/workflows/local_example.yml +++ b/.github/workflows/local_example.yml @@ -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: | diff --git a/.github/workflows/region_example.yml b/.github/workflows/region_example.yml index b795eee02a2..779e2225ee2 100644 --- a/.github/workflows/region_example.yml +++ b/.github/workflows/region_example.yml @@ -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: | diff --git a/.github/workflows/upgrade_downgrade_test_backups_e2e.yml b/.github/workflows/upgrade_downgrade_test_backups_e2e.yml index 424a2aa25b3..1d62481e8a1 100644 --- a/.github/workflows/upgrade_downgrade_test_backups_e2e.yml +++ b/.github/workflows/upgrade_downgrade_test_backups_e2e.yml @@ -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/* @@ -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/ diff --git a/.github/workflows/upgrade_downgrade_test_backups_e2e_next_release.yml b/.github/workflows/upgrade_downgrade_test_backups_e2e_next_release.yml index 3e21997dfd0..2d8c1cd585e 100644 --- a/.github/workflows/upgrade_downgrade_test_backups_e2e_next_release.yml +++ b/.github/workflows/upgrade_downgrade_test_backups_e2e_next_release.yml @@ -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/* @@ -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/ diff --git a/.github/workflows/upgrade_downgrade_test_backups_manual.yml b/.github/workflows/upgrade_downgrade_test_backups_manual.yml index b00a9e38682..107a1f8317d 100644 --- a/.github/workflows/upgrade_downgrade_test_backups_manual.yml +++ b/.github/workflows/upgrade_downgrade_test_backups_manual.yml @@ -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/* @@ -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/ diff --git a/.github/workflows/upgrade_downgrade_test_backups_manual_next_release.yml b/.github/workflows/upgrade_downgrade_test_backups_manual_next_release.yml index 3d991a5a4bd..b40349b91b9 100644 --- a/.github/workflows/upgrade_downgrade_test_backups_manual_next_release.yml +++ b/.github/workflows/upgrade_downgrade_test_backups_manual_next_release.yml @@ -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/* @@ -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/ diff --git a/.github/workflows/upgrade_downgrade_test_query_serving_queries.yml b/.github/workflows/upgrade_downgrade_test_query_serving_queries.yml index 9aa7e8edd14..9969383178b 100644 --- a/.github/workflows/upgrade_downgrade_test_query_serving_queries.yml +++ b/.github/workflows/upgrade_downgrade_test_query_serving_queries.yml @@ -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/* @@ -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/ diff --git a/.github/workflows/upgrade_downgrade_test_query_serving_queries_next_release.yml b/.github/workflows/upgrade_downgrade_test_query_serving_queries_next_release.yml index f2838971d96..e3000b10daa 100644 --- a/.github/workflows/upgrade_downgrade_test_query_serving_queries_next_release.yml +++ b/.github/workflows/upgrade_downgrade_test_query_serving_queries_next_release.yml @@ -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/* @@ -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/ diff --git a/.github/workflows/upgrade_downgrade_test_query_serving_schema.yml b/.github/workflows/upgrade_downgrade_test_query_serving_schema.yml index 09e9fac200d..041d247f27f 100644 --- a/.github/workflows/upgrade_downgrade_test_query_serving_schema.yml +++ b/.github/workflows/upgrade_downgrade_test_query_serving_schema.yml @@ -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/* @@ -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/ diff --git a/.github/workflows/upgrade_downgrade_test_query_serving_schema_next_release.yml b/.github/workflows/upgrade_downgrade_test_query_serving_schema_next_release.yml index b3b76683a00..987d22bad59 100644 --- a/.github/workflows/upgrade_downgrade_test_query_serving_schema_next_release.yml +++ b/.github/workflows/upgrade_downgrade_test_query_serving_schema_next_release.yml @@ -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/* @@ -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/ diff --git a/.github/workflows/upgrade_downgrade_test_reparent_new_vtctl.yml b/.github/workflows/upgrade_downgrade_test_reparent_new_vtctl.yml index 34d34965dfd..95930e6a4b4 100644 --- a/.github/workflows/upgrade_downgrade_test_reparent_new_vtctl.yml +++ b/.github/workflows/upgrade_downgrade_test_reparent_new_vtctl.yml @@ -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/* @@ -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/ diff --git a/.github/workflows/upgrade_downgrade_test_reparent_new_vttablet.yml b/.github/workflows/upgrade_downgrade_test_reparent_new_vttablet.yml index a5f0cf682d3..61654ce0b74 100644 --- a/.github/workflows/upgrade_downgrade_test_reparent_new_vttablet.yml +++ b/.github/workflows/upgrade_downgrade_test_reparent_new_vttablet.yml @@ -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/* @@ -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/ diff --git a/.github/workflows/upgrade_downgrade_test_reparent_old_vtctl.yml b/.github/workflows/upgrade_downgrade_test_reparent_old_vtctl.yml index 86760edab8b..f2fe046e41f 100644 --- a/.github/workflows/upgrade_downgrade_test_reparent_old_vtctl.yml +++ b/.github/workflows/upgrade_downgrade_test_reparent_old_vtctl.yml @@ -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/* @@ -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/ diff --git a/.github/workflows/upgrade_downgrade_test_reparent_old_vttablet.yml b/.github/workflows/upgrade_downgrade_test_reparent_old_vttablet.yml index 44e2e54909b..05bfa706af9 100644 --- a/.github/workflows/upgrade_downgrade_test_reparent_old_vttablet.yml +++ b/.github/workflows/upgrade_downgrade_test_reparent_old_vttablet.yml @@ -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/* @@ -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/ diff --git a/test.go b/test.go index 7dada2198bf..6914e292e17 100755 --- a/test.go +++ b/test.go @@ -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 ( @@ -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) } }