-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: refactor CI generation to include tests outside of
examples
(#…
…319) - Introduce `//ci` package. It contains the following: - `bzlmod_modes`: Module for managing enable/disable bzlmod values. - `ci_integration_test_params`: Rule to collect test parameters for an integration test. - `ci_test_params_suite`: Rule for aggregating one or more `ci_integration_test_params`. - `ci_workflow`: Macro that generates a GitHub workflow files, defines a test to confirm the version in source matches the generated version, and defines a runnable target to update the source tree. - Update `generate_ci_workflow` to expect the new test params JSON. Closes #311.
- Loading branch information
Showing
28 changed files
with
784 additions
and
217 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: Execute Test | ||
|
||
inputs: | ||
test_target: | ||
description: The test target to execute. | ||
required: true | ||
bzlmod_enabled: | ||
description: Boolean value that specifies whether bzlmod should be enabled. | ||
required: true | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Execute Test | ||
shell: bash | ||
env: | ||
TEST_TARGET: ${{ inputs.test_target }} | ||
BZLMOD_ENABLED: ${{ inputs.bzlmod_enabled }} | ||
run: | | ||
if [[ "${BZLMOD_ENABLED}" == "false" ]] && [[ "${TEST_TARGET}" =~ ^@@ ]]; then | ||
# Strip the first @ from test target | ||
TEST_TARGET="${TEST_TARGET#@}" | ||
fi | ||
bazelisk test "${TEST_TARGET}" |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
load("@bazel_skylib//:bzl_library.bzl", "bzl_library") | ||
load("@cgrindel_bazel_starlib//bzlformat:defs.bzl", "bzlformat_pkg") | ||
|
||
bzlformat_pkg(name = "bzlformat") | ||
|
||
bzl_library( | ||
name = "defs", | ||
srcs = ["defs.bzl"], | ||
visibility = ["//visibility:public"], | ||
deps = [ | ||
"//ci/internal:bzlmod_modes", | ||
"//ci/internal:ci_integration_test_params", | ||
"//ci/internal:ci_workflow", | ||
"//ci/internal:providers", | ||
], | ||
) | ||
|
||
filegroup( | ||
name = "all_files", | ||
srcs = glob(["*"]), | ||
visibility = ["//:__subpackages__"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
"""Public API for CI workflow generation.""" | ||
|
||
load("//ci/internal:bzlmod_modes.bzl", _bzlmod_modes = "bzlmod_modes") | ||
load( | ||
"//ci/internal:ci_integration_test_params.bzl", | ||
_ci_integration_test_params = "ci_integration_test_params", | ||
) | ||
load( | ||
"//ci/internal:ci_test_params_suite.bzl", | ||
_ci_test_params_suite = "ci_test_params_suite", | ||
) | ||
load("//ci/internal:ci_workflow.bzl", _ci_workflow = "ci_workflow") | ||
load( | ||
"//ci/internal:providers.bzl", | ||
_CITestParamsInfo = "CITestParamsInfo", | ||
) | ||
|
||
# Modules | ||
bzlmod_modes = _bzlmod_modes | ||
|
||
# Rules | ||
ci_integration_test_params = _ci_integration_test_params | ||
ci_workflow = _ci_workflow | ||
ci_test_params_suite = _ci_test_params_suite | ||
|
||
# Providers | ||
CITestParamsInfo = _CITestParamsInfo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
load("@bazel_skylib//:bzl_library.bzl", "bzl_library") | ||
load("@cgrindel_bazel_starlib//bzlformat:defs.bzl", "bzlformat_pkg") | ||
|
||
bzlformat_pkg(name = "bzlformat") | ||
|
||
bzl_library( | ||
name = "ci_integration_test_params", | ||
srcs = ["ci_integration_test_params.bzl"], | ||
visibility = ["//visibility:public"], | ||
deps = [":providers"], | ||
) | ||
|
||
bzl_library( | ||
name = "ci_workflow", | ||
srcs = ["ci_workflow.bzl"], | ||
visibility = ["//visibility:public"], | ||
deps = [ | ||
":providers", | ||
"@cgrindel_bazel_starlib//updatesrc:defs", | ||
], | ||
) | ||
|
||
bzl_library( | ||
name = "ci_test_params", | ||
srcs = ["ci_test_params.bzl"], | ||
visibility = ["//ci:__subpackages__"], | ||
deps = [":providers"], | ||
) | ||
|
||
bzl_library( | ||
name = "ci_test_params_suite", | ||
srcs = ["ci_test_params_suite.bzl"], | ||
visibility = ["//ci:__subpackages__"], | ||
deps = [ | ||
":ci_test_params", | ||
":providers", | ||
], | ||
) | ||
|
||
filegroup( | ||
name = "all_files", | ||
srcs = glob(["*"]), | ||
visibility = ["//:__subpackages__"], | ||
) | ||
|
||
bzl_library( | ||
name = "bzlmod_modes", | ||
srcs = ["bzlmod_modes.bzl"], | ||
visibility = ["//ci:__subpackages__"], | ||
) | ||
|
||
bzl_library( | ||
name = "providers", | ||
srcs = ["providers.bzl"], | ||
visibility = ["//ci:__subpackages__"], | ||
) |
Oops, something went wrong.