blob: 93c6814efb10c62ab1f4d1e2333c4557e3a040d3 [file]
name: CI
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [master]
pull_request:
branches: [master]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
concurrency:
# Cancel previous actions from the same PR: https://stackoverflow.com/a/72408109
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, windows-2022, macos-14]
mode:
- bazel: 9.1.0
bzlmod: true
- bazel: 8.2.1
bzlmod: false
runs-on: ${{ matrix.os }}
env:
USE_BAZEL_VERSION: ${{ matrix.mode.bazel }}
steps:
- name: "Checkout the sources"
uses: actions/checkout@v6
- name: Mount bazel caches
uses: actions/cache@v5
with:
path: |
~/.cache/bazel
~/.cache/bazel-disk-cache
key: bazel-cache-${{ hashFiles('**/BUILD.bazel', '**/*.bzl', 'WORKSPACE', 'WORKSPACE.bazel') }}
restore-keys: bazel-cache-
- name: "Setup Bazelisk"
uses: bazelbuild/setup-bazelisk@v3
- name: "Building //bazel:android-all"
run: bazel --bazelrc=${{ github.workspace }}/.github/workflows/ci.bazelrc build //bazel:android-all --enable_bzlmod=${{ matrix.mode.bzlmod }} --enable_workspace=${{ ! matrix.mode.bzlmod }}
integration-tests:
strategy:
matrix:
os: [ubuntu-latest, windows-2022, macos-14]
bazel: [7.4.1, 9.1.0]
bzlmod: [ true, false ]
exclude:
- bazel: 9.1.0
bzlmod: false
runs-on: ${{ matrix.os }}
env:
USE_BAZEL_VERSION: ${{ matrix.bazel }}
steps:
- name: "Checkout the sources"
uses: actions/checkout@v6
- name: Mount bazel caches
uses: actions/cache@v5
with:
path: |
~/.cache/bazel
~/.cache/bazel-disk-cache
key: bazel-cache-${{ hashFiles('**/BUILD.bazel', '**/*.bzl', 'WORKSPACE', 'WORKSPACE.bazel') }}
restore-keys: bazel-cache-
- name: "Setup Bazelisk"
uses: bazelbuild/setup-bazelisk@v3
- name: "Running integration tests"
working-directory: examples/simple
run: bazel --bazelrc=${{ github.workspace }}/.github/workflows/ci.bazelrc test //:SparseArraySetTest --enable_bzlmod=${{ matrix.bzlmod }} --enable_workspace=${{ ! matrix.bzlmod }}