name: CI
on:
  pull_request:
  push:
    branches:
      - main

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

jobs:
  setup-bazel:
    runs-on: ${{ matrix.os }}-latest
    strategy:
      matrix:
        os:
          - macos
          - ubuntu
          - windows
    steps:
      - uses: actions/checkout@v4
      - uses: ./
      - uses: actions/checkout@v4
        with:
          repository: bazelbuild/examples
          path: examples
      - run: bazel build --announce_rc :ProjectRunner
        working-directory: examples/java-tutorial
      - if: failure() && runner.debug == '1'
        uses: mxschmitt/action-tmate@v3
