Skip to content

Commit

Permalink
refactor(bazel,candid-integration-test): move to separate job
Browse files Browse the repository at this point in the history
  • Loading branch information
m4rtinkoenig committed Mar 7, 2024
1 parent c9be4e4 commit 5efe7af
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 1 deletion.
5 changes: 4 additions & 1 deletion bazel/candid_integration_tests/BUILD.bazel
Expand Up @@ -46,6 +46,9 @@ py_test(
"NEW_DID_TEST": "$(location :new_did_git_test)",
"WORKSPACE": "$(rootpath //:WORKSPACE.bazel)",
},
tags = ["local"],
tags = [
"local",
"manual",
],
deps = [requirement("pytest")],
)
12 changes: 12 additions & 0 deletions gitlab-ci/config/main.yml
Expand Up @@ -268,6 +268,18 @@ bazel-test-all-rebuild:
BAZEL_EXTRA_ARGS: "--repository_cache= --disk_cache= --noremote_accept_cached --remote_instance_name=${CI_COMMIT_SHA} --@rules_rust//rust/settings:pipelined_compilation=True"
timeout: 2h

# moved out of bazel-test-all to reduce noise in build logs.
# can be reverted if https://dfinity.atlassian.net/browse/IDX-3081 is done
bazel-test-candid-integration:
extends:
- .bazel-test-all
rules:
- changes:
- '**/*.did'
variables:
BAZEL_TARGETS: "//bazel/candid_integration_tests:candid_integration_tests"
timeout: 10m

bazel-test-macos:
extends:
- .bazel-test-all
Expand Down
59 changes: 59 additions & 0 deletions gitlab-ci/config/zz-generated-gitlab-ci.yaml
Expand Up @@ -1287,6 +1287,65 @@ bazel-test-bare-metal:
BAZEL_STARTUP_ARGS: "--output_base=/var/tmp/bazel-output/"
BAZEL_TARGETS: "//..."
RUSTFLAGS: "--remap-path-prefix=${CI_PROJECT_DIR}=/ic"
bazel-test-candid-integration:
after_script:
- |
set +e # Do not fail in the after_script, try to do as much as possible instead.
echo -e "\033[0;31m"
echo -e "************************************************************************"
echo -e "*** NEED BAZEL HELP? See #project-bazel and ***"
echo -e "*** https://github.com/dfinity/ic/blob/master/bazel/README.md ***"
echo -e "*** (NEW) To regenerate Cargo Bazel lockfiles run ./bin/bazel-pin.sh ***"
echo -e "************************************************************************"
echo -e "\033[0m"
- cp -R "$(realpath bazel-testlogs)" bazel-testlogs-gitlab
- gzip bazel-build-log*.json
- |
echo -e "\e[0Ksection_start:$(date +%s):bazel_exporter_logs[collapsed=true]\r\e[0KClick to see Bazel exporter logs"
bazel run //bazel/exporter:exporter --build_event_binary_file= -- -f "$(pwd)/bazel-bep.pb"
echo -e "\e[0Ksection_end:$(date +%s):bazel_exporter_logs\r\e[0K"
- |
if [ "$(uname)" == "Linux" ]; then
bazel clean --expunge
fi
- - |
# Start the after_script section
echo -e "\e[0Ksection_start:$(date +%s):after_script[collapsed=true]\r\e[0KClick here to see the after_script section. It does not affect the job success status"

# Export all the environmental variables so that the GITLAB configured variables are available to after_script.sh
export ROOT_PIPELINE_ID=${PARENT_PIPELINE_ID:-$CI_PIPELINE_ID}
buildevents cmd "$ROOT_PIPELINE_ID" "$CI_JOB_ID" after-script -- "${CI_PROJECT_DIR}"/gitlab-ci/src/after_script/after_script.sh

rm -rf "${CI_PROJECT_DIR}/target"

# Finish and collapse the after_script section
echo -e "\e[0Ksection_end:$(date +%s):after_script\r\e[0K"
artifacts:
paths:
- bazel-build-log*.json*
- bazel-bep.pb
reports:
junit:
- bazel-testlogs-gitlab/**/test.xml
when: always
extends:
- ".bazel-test-all"
needs: []
rules:
- changes:
- "**/*.did"
script:
- "./gitlab-ci/src/bazel-ci/main.sh"
tags:
- dfinity-ic
- bazel
timeout: 10m
variables:
BAZEL_CI_CONFIG: "--config=ci --repository_cache=/cache/bazel"
BAZEL_COMMAND: test
BAZEL_STARTUP_ARGS: "--output_base=/var/tmp/bazel-output/"
BAZEL_TARGETS: "//bazel/candid_integration_tests:candid_integration_tests"
RUSTFLAGS: "--remap-path-prefix=${CI_PROJECT_DIR}=/ic"
bazel-test-coverage:
after_script:
- bazel clean --expunge
Expand Down

0 comments on commit 5efe7af

Please sign in to comment.