Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .aspect/bazelrc/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,10 @@

load("@aspect_bazel_lib//lib:bazelrc_presets.bzl", "write_aspect_bazelrc_presets")

filegroup(
name = "all_files",
srcs = glob(["**"]),
visibility = ["//:__pkg__"],
)

write_aspect_bazelrc_presets(name = "update_aspect_bazelrc_presets")
34 changes: 33 additions & 1 deletion .bazelignore
Original file line number Diff line number Diff line change
@@ -1 +1,33 @@
e2e
# make sure we ignore bazel managed directories for e2e tests
e2e/bazel-bzlmod-lock-file-from-args/bazel-bin
e2e/bazel-bzlmod-lock-file-from-args/bazel-out
e2e/bazel-bzlmod-lock-file-from-args/bazel-bazel-bzlmod-lock-file-from-args
e2e/bazel-bzlmod-lock-file-from-args/bazel-testlogs
e2e/bazel-bzlmod-lock-file/bazel-bin
e2e/bazel-bzlmod-lock-file/bazel-out
e2e/bazel-bzlmod-lock-file/bazel-bazel-bzlmod-lock-file
e2e/bazel-bzlmod-lock-file/bazel-testlogs
e2e/bazel-bzlmod-toolchain-from-source-lock-file/bazel-bin
e2e/bazel-bzlmod-toolchain-from-source-lock-file/bazel-out
e2e/bazel-bzlmod-toolchain-from-source-lock-file/bazel-bazel-bzlmod-toolchain-from-source-lock-file
e2e/bazel-bzlmod-toolchain-from-source-lock-file/bazel-testlogs
e2e/bazel-bzlmod-toolchain-from-source/bazel-bin
e2e/bazel-bzlmod-toolchain-from-source/bazel-out
e2e/bazel-bzlmod-toolchain-from-source/bazel-bazel-bzlmod-toolchain-from-source
e2e/bazel-bzlmod-toolchain-from-source/bazel-testlogs
e2e/bazel-bzlmod/bazel-bin
e2e/bazel-bzlmod/bazel-out
e2e/bazel-bzlmod/bazel-bazel-bzlmod
e2e/bazel-bzlmod/bazel-testlogs
e2e/bazel-workspace/bazel-bin
e2e/bazel-workspace/bazel-out
e2e/bazel-workspace/bazel-bazel-workspace
e2e/bazel-workspace/bazel-testlogs
e2e/bzlmod-toolchain-circular-dependencies/bazel-bin
e2e/bzlmod-toolchain-circular-dependencies/bazel-out
e2e/bzlmod-toolchain-circular-dependencies/bazel-bzlmod-toolchain-circular-dependencies
e2e/bzlmod-toolchain-circular-dependencies/bazel-testlogs
e2e/repo-yaml/bazel-bin
e2e/repo-yaml/bazel-out
e2e/repo-yaml/bazel-repo-yaml
e2e/repo-yaml/bazel-testlogs
13 changes: 12 additions & 1 deletion .bazelrc
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
# Import Aspect bazelrc presets
import %workspace%/.aspect/bazelrc/bazel7.bazelrc # will only work in bazel7+
import %workspace%/.aspect/bazelrc/bazel7.bazelrc
import %workspace%/.aspect/bazelrc/convenience.bazelrc
import %workspace%/.aspect/bazelrc/correctness.bazelrc
import %workspace%/.aspect/bazelrc/debug.bazelrc
import %workspace%/.aspect/bazelrc/performance.bazelrc

# Prevent Bazel from treating e2e child workspace BUILD files as packages
# When adding a new e2e test then `bazel run @rules_bazel_integration_test//tools:update_deleted_packages`
# needs to be executed
common --deleted_packages=e2e/bazel-bzlmod,e2e/bazel-bzlmod-lock-file,e2e/bazel-bzlmod-lock-file-from-args,e2e/bazel-bzlmod-toolchain-from-source,e2e/bazel-bzlmod-toolchain-from-source-lock-file,e2e/bazel-workspace,e2e/bzlmod-toolchain-circular-dependencies,e2e/repo-yaml

# Specific project flags go here if we have some

# use prebuilt protoc
common --incompatible_enable_proto_toolchain_resolution
common --@protobuf//bazel/toolchains:prefer_prebuilt_protoc

# inside the rules project we build from source
common --extra_toolchains=//cmd:bazeldnf-host-toolchain
Expand All @@ -15,6 +23,9 @@ common --@protobuf//bazel/toolchains:prefer_prebuilt_protoc
# make sure bazel doesn't complain on hosts without java
common --java_runtime_version=remotejdk_21

test --test_tag_filters=-allowed-to-fail
test --test_env=GO_TEST_WRAP_TESTV=1

# Load any settings & overrides specific to the current user from `.bazelrc.user`.
# This file should appear in `.gitignore` so that settings are not shared with team members. This
# should be last statement in this config so the user configuration is able to overwrite flags from
Expand Down
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ docs/*.md linguist-generated=true
# Exclude a bunch of paths to save some disk space
e2e/bazel-bzlmod-* export-ignore
e2e/bazel-workspace* export-ignore
e2e/.bazelrc export-ignore
.github export-ignore
pkg/*/testdata export-ignore
tools/release export-ignore
REPO.bazel export-ignore
193 changes: 38 additions & 155 deletions .github/workflows/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: bazel-contrib/setup-bazel@0.8.5
- uses: actions/checkout@v6.0.2
- uses: bazel-contrib/setup-bazel@0.18.0
with:
# Avoid downloading Bazel every time.
bazelisk-cache: true
Expand All @@ -28,159 +28,42 @@ jobs:
repository-cache: true
# enable some flags for CI
bazelrc: |
import %workspace%/.aspect/bazelrc/ci.bazelrc
import %workspace%/.github/workflows/ci.bazelrc
try-import %workspace%/.aspect/bazelrc/ci.bazelrc
try-import %workspace%/.github/workflows/ci.bazelrc
try-import %workspace%/../../.aspect/bazelrc/ci.bazelrc
try-import %workspace%/../../.github/workflows/ci.bazelrc
# keep a cache for MODULE.bazel repos
external-cache: true
- run: bazelisk build //... && bazelisk test //...

e2e-workspace-matrix:
strategy:
matrix:
version:
- version: 6.x
bazelrc: |
import %workspace%/../../.aspect/bazelrc/bazel6.bazelrc
- version: 7.x
bazelrc: |
import %workspace%/../../.aspect/bazelrc/bazel7.bazelrc
import %workspace%/../../.aspect/bazelrc/bazel6.bazelrc
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: bazel-contrib/setup-bazel@0.8.5
with:
# Avoid downloading Bazel every time.
bazelisk-cache: true
# Keep a disk-cache
disk-cache: true
# Share repository cache between workflows.
repository-cache: true
# enable some flags for CI
bazelrc: |
import %workspace%/../../.aspect/bazelrc/ci.bazelrc
import %workspace%/../../.github/workflows/ci.bazelrc
${{ matrix.version.bazelrc }}
- run: cd e2e/bazel-workspace && USE_BAZEL_VERSION=${{ matrix.version.version }} bazelisk build //...

e2e-bzlmod-matrix:
strategy:
matrix:
version: [7.x, 8.x]
path:
- bazel-bzlmod
- bazel-bzlmod-lock-file

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: bazel-contrib/setup-bazel@0.8.5
with:
# Avoid downloading Bazel every time.
bazelisk-cache: true
# Keep a disk-cache
disk-cache: true
# Share repository cache between workflows.
repository-cache: true
# enable some flags for CI
bazelrc: |
import %workspace%/../../.aspect/bazelrc/ci.bazelrc
import %workspace%/../../.github/workflows/ci.bazelrc
- run: cd e2e/${{ matrix.path }} && USE_BAZEL_VERSION=${{ matrix.version }} bazelisk build //...

e2e-bzlmod-build-toolchain-matrix:
strategy:
matrix:
version: [7.x, 8.x]

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: bazel-contrib/setup-bazel@0.8.5
with:
# Avoid downloading Bazel every time.
bazelisk-cache: true
# Keep a disk-cache
disk-cache: true
# Share repository cache between workflows.
repository-cache: true
# enable some flags for CI
bazelrc: |
import %workspace%/../../.aspect/bazelrc/ci.bazelrc
import %workspace%/../../.github/workflows/ci.bazelrc
- run: cd e2e/bazel-bzlmod-toolchain-from-source && USE_BAZEL_VERSION=${{ matrix.version }} bazelisk build //...

e2e-repo-yaml:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: bazel-contrib/setup-bazel@0.8.5
with:
# Avoid downloading Bazel every time.
bazelisk-cache: true
# Keep a disk-cache
disk-cache: true
# Share repository cache between workflows.
repository-cache: true
# enable some flags for CI
bazelrc: |
import %workspace%/.aspect/bazelrc/ci.bazelrc
import %workspace%/.github/workflows/ci.bazelrc
- run: |
export USE_BAZEL_VERSION=7.x
bazelisk run //cmd -- init --fc 41 --output $(pwd)/repo.yaml
bazelisk run //cmd -- fetch --repofile $(pwd)/repo.yaml
bazelisk run //cmd -- resolve --repofile $(pwd)/repo.yaml bash

e2e-bzlmod-lock-file-from-args:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: bazel-contrib/setup-bazel@0.8.5
with:
# Avoid downloading Bazel every time.
bazelisk-cache: true
# Keep a disk-cache
disk-cache: true
# Share repository cache between workflows.
repository-cache: true
# enable some flags for CI
bazelrc: |
import %workspace%/../../.aspect/bazelrc/ci.bazelrc
import %workspace%/../../.github/workflows/ci.bazelrc
- run: |
export USE_BAZEL_VERSION=8.x
cd e2e/bazel-bzlmod-lock-file-from-args && bazelisk run :bazeldnf -- fetch && bazelisk run @bazeldnf_rpms//:update-lock-file && bazelisk build ...

e2e-bzlmod-toolchain-circular-dependencies:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: bazel-contrib/setup-bazel@0.8.5
with:
# Avoid downloading Bazel every time.
bazelisk-cache: true
# Keep a disk-cache
disk-cache: true
# Share repository cache between workflows.
repository-cache: true
# enable some flags for CI
bazelrc: |
import %workspace%/../../.aspect/bazelrc/ci.bazelrc
import %workspace%/../../.github/workflows/ci.bazelrc
- id: prepare
- id: build
name: building repository
run: bazelisk build //...
- id: unit-tests
name: running unit tests
run: bazelisk test //...
- id: prepare-e2e-runner
name: preparing for e2e
# workaround for https://github.com/bazel-contrib/setup-bazel/issues/108
# together with our customized default_test_runner
run: cat ~/.bazelrc | grep -v output_base > ~/.bazelrc.clean
if: success() || failure() # always run even if the previous step fails
- id: e2e-that-should-pass
name: running mandatory e2e tests
run: bazelisk test e2e --notest_keep_going
if: success() || failure() # always run even if the previous step fails
- id: e2e-that-are-allowed-to-fail
name: running e2e tests that are allowed to fail
if: success() || failure() # always run even if the previous step fails
run: |
export USE_BAZEL_VERSION=8.x
cd e2e/bzlmod-toolchain-circular-dependencies
bazelisk run @bazeldnf_rpms//:fetch-repo
bazelisk run @bazeldnf_rpms//:update-lock-file
- id: test
run: |
export USE_BAZEL_VERSION=8.x
cd e2e/bzlmod-toolchain-circular-dependencies
bazelisk build //... || status=$?
if [ ${status} -ne 0 ]; then
echo "::warning::Optional job failed."
echo "optional_fail=true" >> "${GITHUB_OUTPUT}"
echo "optional_fail_status=${status}" >> "${GITHUB_OUTPUT}"
fi
ret_code=0
bazel test //e2e --notest_keep_going --test_tag_filters=allowed-to-fail || ret_code=$?
case $ret_code in
0) echo "All allowed-to-fail tests passed." ;;
3) echo "::warning::Some allowed-to-fail e2e tests failed or timed out." ;;
4) echo "No tests matched the allowed-to-fail filter." ;;
*) exit $ret_code ;;
esac
- uses: actions/upload-artifact@v4 # upload test results
if: success() || failure() # always run even if the previous step fails
with:
name: test-results
path: 'bazel-testlogs/**/test.xml'
56 changes: 0 additions & 56 deletions .github/workflows/allowed-to-fail.yml

This file was deleted.

21 changes: 21 additions & 0 deletions .github/workflows/test-report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: 'Test Report'
on:
workflow_run:
workflows: ['build and test'] # runs after our CI workflow for the given MR
types:
- completed
permissions:
contents: read
actions: read
checks: write
jobs:
report:
runs-on: ubuntu-latest
steps:
- uses: dorny/test-reporter@v2
with:
artifact: test-results # artifact name
name: Bazel Test results
path: '**/test.xml' # Path to test results (inside artifact .zip)
reporter: java-junit
fail-on-error: 'false' # If allowed to fail tests fail then don't block the MR
Loading
Loading