From 0741d54d1ee327f0fee256c62060b42267e9c344 Mon Sep 17 00:00:00 2001 From: Markus Rudy Date: Wed, 22 Nov 2023 12:52:16 +0100 Subject: [PATCH] ci: execute license integration test with Bazel --- .bazelrc | 7 +++++++ .github/workflows/test-integration.yml | 10 +++++++++- CMakeLists.txt | 1 - internal/license/integration/BUILD.bazel | 1 + 4 files changed, 17 insertions(+), 2 deletions(-) diff --git a/.bazelrc b/.bazelrc index f5268600af..de31dcc060 100644 --- a/.bazelrc +++ b/.bazelrc @@ -27,6 +27,13 @@ build --flag_alias=container_prefix=//bazel/settings:container_prefix # set cli edition flag alias build --flag_alias=cli_edition=//bazel/settings:cli_edition +# disable integration tests by default +test --test_tag_filters=-integration +# enable all tests (including integration) +test:integration --test_tag_filters= --@io_bazel_rules_go//go/config:tags=integration +# enable only integration tests +test:integration-only --test_tag_filters=+integration --@io_bazel_rules_go//go/config:tags=integration + # bazel configs to explicitly target a platform common:host --platforms @local_config_platform//:host common:linux_amd64 --platforms @zig_sdk//libc_aware/platform:linux_amd64_gnu.2.23 diff --git a/.github/workflows/test-integration.yml b/.github/workflows/test-integration.yml index 5d780ff695..1c14f73be8 100644 --- a/.github/workflows/test-integration.yml +++ b/.github/workflows/test-integration.yml @@ -42,6 +42,14 @@ jobs: run: mkdir build && cd build && cmake .. # Runs all test targets starting with "integration-" - - name: Integration Tests + - name: CMake-based Integration Tests working-directory: build run: ctest -R integration- + + - name: Setup bazel + uses: ./.github/actions/setup_bazel_nix + + - name: Integration Tests + env: + TMPDIR: ${{ runner.temp }} + run: bazel test //... --test_output=errors --config=nostamp --config=integration-only --remote_download_minimal diff --git a/CMakeLists.txt b/CMakeLists.txt index a6721b15e3..6409e56fea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,4 +6,3 @@ enable_testing() # TODO(malt3): Remove this once every integration test is migrated to Bazel add_test(NAME integration-csi COMMAND bash -c "go test -tags integration -c ./test/ && sudo ./test.test -test.v" WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/csi) add_test(NAME integration-dm COMMAND bash -c "go test -tags integration -c ./test/ && sudo ./test.test -test.v" WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/disk-mapper/internal) -add_test(NAME integration-license COMMAND bash -c "go test -tags integration" WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/internal/license) diff --git a/internal/license/integration/BUILD.bazel b/internal/license/integration/BUILD.bazel index 3c65cd83ab..131ef07b26 100644 --- a/internal/license/integration/BUILD.bazel +++ b/internal/license/integration/BUILD.bazel @@ -5,6 +5,7 @@ go_test( srcs = ["license_integration_test.go"], tags = [ "requires-network", + "integration", ], deps = [ "//internal/license",