Skip to content

Conversation

@furtib
Copy link
Contributor

@furtib furtib commented Dec 2, 2025

Why:
We want to support multiple Bazel versions simultaneously.
We should run our test suite on all supported Bazel versions.

What:
Added a matrix strategy to both of the unittest jobs. .github/bazel_version.json contains a list of bazel versions to be used during testing.

Addresses:
#108

@furtib furtib changed the title CI TEST Prepare unittests to be extended with different bazel versions Prepare unittests to be extended with different bazel versions Dec 2, 2025
@furtib furtib requested a review from Szelethus December 2, 2025 12:47
@furtib furtib self-assigned this Dec 2, 2025
@furtib furtib added enhancement New feature or request non-functional change ☮️ The patch doesn't change any functionality, e.g. refactoring, documentation, test-only. labels Dec 2, 2025
@furtib
Copy link
Contributor Author

furtib commented Dec 2, 2025

Currently, the bazel versions are declared for each job separately.
For this, I have two solutions:

A) Load versions from a file

To have the versions loaded from the same source, I would need to introduce a separate setup job.
Including such a setup job would allow us to load versions from a separate file, but would significantly complicate the workflow file.
Loading versions from a separate file would allow us to load these versions in foss.yaml too. This would require 2 setup jobs, 1 for each YAML file.
To see an example for this see: #72

B) Combine all jobs into 1 large, meta job

Alternatively, we could merge the two jobs and have the matrix strategy also generate the separate OS dynamically.
In this case, the Ubuntu version would be required to use a Docker container too. Sadly, this would mean the version numbers aren't shared between the FOSS and unittests.
This would look like this:

jobs:
  unified_test:
    name: "${{ matrix.config.label }} / Bazel ${{ matrix.bazel_version }}"
    runs-on: ubuntu-24.04
    
    container:
      image: ${{ matrix.config.image }}

    strategy:
      fail-fast: false
      matrix:
        bazel_version: ["6.5.0", "7.0.0"]
        
        config:
          - label: "Ubuntu"
            image: "ubuntu:24.04"
            setup_dir: "ubuntu"
          - label: "RHEL9"
            image: "redhat/ubi9:latest"
            setup_dir: "rhel9"

    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Set bazel version to ${{ matrix.bazel_version }}
        run: echo "${{ matrix.bazel_version }}" > .bazelversion
        shell: bash

      - name: Setup environment
        uses: ./.github/platform_environment_setup/${{ matrix.config.setup_dir }}

C) Use alternative solutions:

  • Create separate CI files for all bazel versions
  • Use the Orchestrator pattern (Create a separate workflow, and start the other workflows from there, setting environment variables)

@furtib furtib marked this pull request as draft January 5, 2026 07:05
@furtib furtib force-pushed the ci-modular-bazel-version branch 6 times, most recently from d23ee88 to 1e66681 Compare January 7, 2026 06:59
@furtib furtib marked this pull request as ready for review January 7, 2026 06:59
@furtib furtib force-pushed the ci-modular-bazel-version branch from 1e66681 to 82015f7 Compare January 7, 2026 06:59
@furtib furtib mentioned this pull request Jan 7, 2026
@furtib
Copy link
Contributor Author

furtib commented Jan 7, 2026

I have gone ahead with option A

Copy link
Contributor

@Szelethus Szelethus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a very elegant solution! LGTM!

@Szelethus Szelethus merged commit fbd5755 into Ericsson:main Jan 9, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request non-functional change ☮️ The patch doesn't change any functionality, e.g. refactoring, documentation, test-only.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants