name: build-bazel

on: [push, pull_request]

jobs:
  bazel:
    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        os: [macos-latest]

    steps:
      - uses: actions/checkout@v4

      - uses: bazelbuild/setup-bazelisk@v3

      - name: bazel clean
        run: bazel clean
      
      - name: build bazel
        run: bazel build //...
      
      - name: test all
        run: bazel test --test_output=all //...

      - name: test example
        run: ./bazel-bin/call-highs-example

      - name: Upload bazel-testlogs
        uses: actions/upload-artifact@v4
        with:
          name: bazel-testlogs
          path: bazel-testlogs/