Continuous integration #297
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
name: Continuous integration | |
on: | |
push: | |
branches: master | |
pull_request: | |
branches: master | |
workflow_dispatch: # allows manual triggering | |
schedule: | |
- cron: '1 11 * * *' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }} | |
jobs: | |
build-and-test: | |
name: Build & Test | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
bazel_mode: [workspace, module] | |
version: ["5.4.1", "6.4.0", "7.0.0"] | |
include: | |
# Bazel 5.4.1 does not find Visual Studio on windows-2022. So, we | |
# test it on windows-2019. | |
- version: 5.4.1 | |
bazel_mode: workspace | |
os: windows-2019 | |
exclude: | |
- version: 5.4.1 | |
bazel_mode: module | |
# Bazel 5.4.1 does not find Visual Studio on windows-2022. | |
- version: 5.4.1 | |
os: windows-latest | |
defaults: | |
run: | |
shell: bash | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: bazelbuild/setup-bazelisk@v2 | |
- uses: tweag/configure-bazel-remote-cache-auth@v0 | |
with: | |
buildbuddy_api_key: ${{ secrets.BUILDBUDDY_API_KEY }} | |
bazelrc_path: .bazelrc.auth | |
- uses: extractions/netrc@v1 | |
with: | |
machine: api.github.com | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Configure for CI | |
uses: tweag/write-bazelrc@v0 | |
with: | |
content: build --config=ci | |
- name: Disable stardoc | |
# Windows: Stardoc complains about docstring quote indentation on Windows. | |
# bzlmod: Stardoc does not work with bzlmod. | |
if: ${{ runner.os == 'Windows' || matrix.bazel_mode == 'module' }} | |
uses: tweag/write-bazelrc@v0 | |
with: | |
content: build --config=no-stardoc | |
- name: Enable bzlmod | |
uses: tweag/write-bazelrc@v0 | |
if: ${{ matrix.bazel_mode == 'module' }} | |
with: | |
content: build --experimental_enable_bzlmod | |
- name: Configure the Bazel version | |
run: | | |
echo "USE_BAZEL_VERSION=${{ matrix.version }}" > .bazeliskrc | |
echo "USE_BAZEL_VERSION=${{ matrix.version }}" > tests/.bazeliskrc | |
- name: Run Bazel test at the root | |
if: ${{ matrix.bazel_mode == 'workspace' && runner.os != 'Windows' }} | |
uses: ./.github/actions/run_bazel_test | |
- name: Run Bazel test under the tests directory | |
uses: ./.github/actions/run_bazel_test | |
with: | |
working-directory: tests | |
all_ci_tests: | |
runs-on: ubuntu-latest | |
needs: | |
- build-and-test | |
if: ${{ always() }} | |
steps: | |
- uses: cgrindel/gha_join_jobs@794a2d117251f22607f1aab937d3fd3eaaf9a2f5 # v1 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} |