From 73b5a75f9bf60b64df67748fe5fffd5d6d814a89 Mon Sep 17 00:00:00 2001 From: nolen777 Date: Sat, 21 May 2022 11:40:17 -0400 Subject: [PATCH] Split builds by eagle & shardok (#1667) * split test job into eagle & shardok * split the build jobs too Former-commit-id: 74352cd273c2317d7c147cb0bd66a485246fc335 --- .circleci/config.yml | 77 +++++++++++++++---- ci/bazel_test.sh | 8 -- ci/bazel_test_eagle_cci.sh | 7 ++ ..._test_cci.sh => bazel_test_shardok_cci.sh} | 2 +- ci/build_servers_eagle_cci.sh | 27 +++++++ ...rs_cci.sh => build_servers_shardok_cci.sh} | 10 +-- 6 files changed, 98 insertions(+), 33 deletions(-) delete mode 100755 ci/bazel_test.sh create mode 100755 ci/bazel_test_eagle_cci.sh rename ci/{bazel_test_cci.sh => bazel_test_shardok_cci.sh} (70%) create mode 100755 ci/build_servers_eagle_cci.sh rename ci/{build_servers_cci.sh => build_servers_shardok_cci.sh} (75%) diff --git a/.circleci/config.yml b/.circleci/config.yml index a5c142a9b0..f7c6ac7d02 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -36,7 +36,7 @@ commands: command: cat .bazelrc jobs: - test: + test-eagle: docker: - image: nolen777/circleci-bazelisk:0.0.8 @@ -48,15 +48,35 @@ jobs: - setup-bazelrc - run: name: Run tests - command: ./ci/bazel_test_cci.sh + command: ./ci/bazel_test_eagle_cci.sh - run: name: Store test artifacts when: always - command: mkdir -p /tmp/testlogs && cp -R ./bazel-testlogs/* /tmp/testlogs/ + command: mkdir -p /tmp/testlogs-eagle && cp -R ./bazel-testlogs/* /tmp/testlogs-eagle/ - store_test_results: - path: /tmp/testlogs + path: /tmp/testlogs-eagle + + test-shardok: + docker: + - image: nolen777/circleci-bazelisk:0.0.8 + + resource_class: xlarge + + steps: + - checkout + - setup-tools + - setup-bazelrc + - run: + name: Run tests + command: ./ci/bazel_test_shardok_cci.sh + - run: + name: Store test artifacts + when: always + command: mkdir -p /tmp/testlogs-shardok && cp -R ./bazel-testlogs/* /tmp/testlogs-shardok/ + - store_test_results: + path: /tmp/testlogs-shardok - build: + build-eagle: docker: - image: nolen777/circleci-bazelisk:0.0.8 @@ -69,7 +89,32 @@ jobs: - run: name: Build servers - command: ./ci/build_servers_cci.sh + command: ./ci/build_servers_eagle_cci.sh + + - persist_to_workspace: + root: deploy + paths: + - eagle_server_deploy.jar + + - persist_to_workspace: + root: ci + paths: + - eagle_run.Dockerfile + + build-shardok: + docker: + - image: nolen777/circleci-bazelisk:0.0.8 + + resource_class: xlarge + + steps: + - checkout + - setup-tools + - setup-bazelrc + + - run: + name: Build servers + command: ./ci/build_servers_shardok_cci.sh - store_artifacts: path: ./deploy/shardok.tar.gz @@ -78,12 +123,6 @@ jobs: root: deploy paths: - shardok.tar.gz - - eagle_server_deploy.jar - - - persist_to_workspace: - root: ci - paths: - - eagle_run.Dockerfile deploy-shardok: docker: @@ -135,10 +174,16 @@ jobs: workflows: build-workflow: jobs: - - test: + - test-eagle: context: - bazel - - build: + - test-shardok: + context: + - bazel + - build-eagle: + context: + - bazel + - build-shardok: context: - bazel # - deploy-shardok: @@ -155,7 +200,7 @@ workflows: branches: only: main requires: - - build # Only run deploy job once the build job has completed - - test # Only run if the test job is successful + - build-eagle # Only run deploy job once the build job has completed + - test-eagle # Only run if the test job is successful context: - bazel diff --git a/ci/bazel_test.sh b/ci/bazel_test.sh deleted file mode 100755 index 9c515d8835..0000000000 --- a/ci/bazel_test.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/usr/bin/env bash - -set -e -set -x - -COMMAND_LOG="$(bazel --output_base=${BAZEL_OUTPUT_BASE} info command_log)" -bazel --output_base=${BAZEL_OUTPUT_BASE} test \ - //src/test/... diff --git a/ci/bazel_test_eagle_cci.sh b/ci/bazel_test_eagle_cci.sh new file mode 100755 index 0000000000..0fc86a1e8f --- /dev/null +++ b/ci/bazel_test_eagle_cci.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +set -e +set -x + +bazel test \ + //src/test/scala/... diff --git a/ci/bazel_test_cci.sh b/ci/bazel_test_shardok_cci.sh similarity index 70% rename from ci/bazel_test_cci.sh rename to ci/bazel_test_shardok_cci.sh index 2f7a8a48c1..4d9416370d 100755 --- a/ci/bazel_test_cci.sh +++ b/ci/bazel_test_shardok_cci.sh @@ -4,4 +4,4 @@ set -e set -x bazel test \ - //src/test/... + //src/test/cpp/... diff --git a/ci/build_servers_eagle_cci.sh b/ci/build_servers_eagle_cci.sh new file mode 100755 index 0000000000..0fe0d69b4b --- /dev/null +++ b/ci/build_servers_eagle_cci.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +set -e +set -x + +COMMAND_LOG="$(bazel info command_log)" +bazel build \ + //src/main/scala/net/eagle0/eagle:eagle_server_deploy.jar +STATUS="$?" + +if [ $STATUS -eq 0 ] +then + echo "Build succeeded!" > command_log.txt +else + echo "Build failed. Copying command log from ${COMMAND_LOG}" + cp "${COMMAND_LOG}" command_log.txt + exit $STATUS +fi + +echo "Removing old server files..." +/bin/rm -rf ./deploy +/bin/mkdir -p ./deploy + +echo "Copying eagle jar..." +/bin/cp -R ./bazel-bin/src/main/scala/net/eagle0/eagle/eagle_server_deploy.jar ./deploy/ + +echo "build_servers_eagle completed" diff --git a/ci/build_servers_cci.sh b/ci/build_servers_shardok_cci.sh similarity index 75% rename from ci/build_servers_cci.sh rename to ci/build_servers_shardok_cci.sh index 4a3f58a01c..a02fecb3ef 100755 --- a/ci/build_servers_cci.sh +++ b/ci/build_servers_shardok_cci.sh @@ -6,8 +6,7 @@ set -x COMMAND_LOG="$(bazel info command_log)" bazel build \ //src/main/cpp/net/eagle0/shardok:shardok-server \ - //src/main/cpp/net/eagle0/shardok:shardok-inspector \ - //src/main/scala/net/eagle0/eagle:eagle_server_deploy.jar + //src/main/cpp/net/eagle0/shardok:shardok-inspector STATUS="$?" if [ $STATUS -eq 0 ] @@ -21,8 +20,6 @@ fi echo "Removing old server files..." /bin/rm -rf ./shardok -/bin/rm -rf ./deploy -/bin/mkdir -p ./deploy echo "Setting up Shardok files..." /bin/mkdir -p ./shardok @@ -31,10 +28,7 @@ echo "Setting up Shardok files..." /bin/cp -R ./bazel-bin/src/main/cpp/net/eagle0/shardok/shardok-server.runfiles/net_eagle0/src/main/resources ./shardok/shardok-server.runfiles/net_eagle0/src/main/ /bin/cp -R ./bazel-bin/src/main/cpp/net/eagle0/shardok/shardok-inspector ./shardok/ -echo "Copying eagle jar..." -/bin/cp -R ./bazel-bin/src/main/scala/net/eagle0/eagle/eagle_server_deploy.jar ./deploy/ - echo "tar & zip shardok files..." /bin/tar cfh - shardok | /usr/bin/pigz > ./deploy/shardok.tar.gz -echo "bazel_build_servers completed" +echo "build_servers_shardok completed"