| 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, macos-14] |
| bazel: [8.7.0, 9.2.0] |
| runs-on: ${{ matrix.os }} |
| env: |
| USE_BAZEL_VERSION: ${{ matrix.bazel }} |
| steps: |
| - name: "Checkout the sources" |
| uses: actions/checkout@v7 |
| - name: "Setup Bazel" |
| uses: bazel-contrib/setup-bazel@0.19.0 |
| with: |
| bazelisk-cache: true |
| cache-save: true |
| disk-cache: true |
| - name: "Building //bazel:android-all" |
| run: bazel --bazelrc=${{ github.workspace }}/.github/workflows/ci.bazelrc build //bazel:android-all |
| - name: Verify MODULE.bazel.lock is unchanged |
| if: always() |
| shell: bash |
| run: | |
| if [[ -n "$(git status --porcelain -- MODULE.bazel.lock)" ]]; then |
| git diff -- MODULE.bazel.lock |
| git diff --cached -- MODULE.bazel.lock |
| echo "::error file=MODULE.bazel.lock::MODULE.bazel.lock changed during CI. Run Bazel locally and commit the updated lockfile." |
| exit 1 |
| fi |
| integration-tests: |
| strategy: |
| matrix: |
| os: [ubuntu-latest, macos-14] |
| bazel: [8.7.0, 9.2.0] |
| bzlmod: [ true ] |
| runs-on: ${{ matrix.os }} |
| env: |
| USE_BAZEL_VERSION: ${{ matrix.bazel }} |
| steps: |
| - name: "Checkout the sources" |
| uses: actions/checkout@v7 |
| - name: "Setup Bazel" |
| uses: bazel-contrib/setup-bazel@0.19.0 |
| with: |
| bazelisk-cache: true |
| cache-save: true |
| disk-cache: true |
| - name: "Running integration tests" |
| working-directory: examples/simple |
| run: bazel --bazelrc=${{ github.workspace }}/.github/workflows/ci.bazelrc test //:SparseArraySetTest |