Skip to content

Commit

Permalink
chore: run all integration tests in CI (#323)
Browse files Browse the repository at this point in the history
- Migrated the CI workflow generation code from
`rules_swift_package_manager`.
- Updated all packages with integration tests to follow a naming
convention: `all_integration_tests`, `smoke_integration_tests`,
`all_test_params`.
- Update the root `BUILD.bazel` to list the packages with integration
tests and generate the appropriate `test_suite` and `ci_workflow`
declarations.
- Generate the CI workflow.
- Update CI workflow to be cancelable.

Closes #320.
  • Loading branch information
cgrindel authored Jul 23, 2023
1 parent 3a902c4 commit c573ad4
Show file tree
Hide file tree
Showing 60 changed files with 1,853 additions and 294 deletions.
4 changes: 4 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ import %workspace%/ci.bazelrc
# import ci.bazelrc and they do not have a //build:execution_env flag.
build:ci --//build:execution_env=ci

# The parent workspace always runs with bzlmod enabled.
common --enable_bzlmod
build --@cgrindel_bazel_starlib//bzlmod:enabled

# Try to import a local.rc file; typically, written by CI
try-import %workspace%/local.bazelrc

4 changes: 2 additions & 2 deletions .github/actions/configure_bzlmod/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ runs:
if: inputs.enabled == 'true'
shell: bash
run: |
cat >> "shared.bazelrc" <<EOF
cat >> "child_workspace.bazelrc" <<EOF
# Override earlier settings
common --enable_bzlmod
build --@cgrindel_bazel_starlib//bzlmod:enabled
Expand All @@ -21,7 +21,7 @@ runs:
if: inputs.enabled != 'true'
shell: bash
run: |
cat >> "shared.bazelrc" <<EOF
cat >> "child_workspace.bazelrc" <<EOF
# Override earlier settings
common --noenable_bzlmod
build --no@cgrindel_bazel_starlib//bzlmod:enabled
Expand Down
29 changes: 29 additions & 0 deletions .github/actions/execute_test/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
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
github_token:
description: The Github token to authenticate gh CLI.
required: true

runs:
using: composite
steps:
- name: Execute Test
shell: bash
env:
TEST_TARGET: ${{ inputs.test_target }}
BZLMOD_ENABLED: ${{ inputs.bzlmod_enabled }}
# The tests make use of Github-specific functionality (e.g. gh).
GITHUB_TOKEN: ${{ inputs.github_token }}
run: |
if [[ "${BZLMOD_ENABLED}" == "false" ]] && [[ "${TEST_TARGET}" =~ ^@@ ]]; then
# Strip the first @ from test target
TEST_TARGET="${TEST_TARGET#@}"
fi
bazelisk test "${TEST_TARGET}"
39 changes: 0 additions & 39 deletions .github/actions/test_example/action.yml

This file was deleted.

12 changes: 11 additions & 1 deletion .github/actions/tidy_and_test/action.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,25 @@
name: Tidy and Test
# inputs: []

inputs:
github_token:
description: The Github token to authenticate gh CLI.
required: true

runs:
using: composite
steps:
- name: Ensure everything is tidy
shell: bash
env:
# The tests make use of Github-specific functionality (e.g. gh).
GITHUB_TOKEN: ${{ inputs.github_token }}
run: |
bazelisk run //:tidy_check
- name: Execute Tests
shell: bash
env:
# The tests make use of Github-specific functionality (e.g. gh).
GITHUB_TOKEN: ${{ inputs.github_token }}
run: |
bazelisk test //...
Loading

0 comments on commit c573ad4

Please sign in to comment.