Skip to content

Merge pull request #4880 from google/mizux/julia #3299

Merge pull request #4880 from google/mizux/julia

Merge pull request #4880 from google/mizux/julia #3299

# ref: https://github.com/actions/runner-images
name: amd64 MacOS Bazel
on:
push:
branches:
- main
- v99bugfix
pull_request:
workflow_dispatch:
concurrency:
group: ${{github.workflow}}-${{github.ref}}
cancel-in-progress: true
env:
cache-root: /private/tmp/bazel
# Building using the github runner environement directly.
jobs:
amd64-MacOS-Bazel-Python:
strategy:
matrix:
python: [
#{version: '3.10'},
#{version: '3.11'},
{version: '3.12'},
#{version: '3.13'},
]
fail-fast: false
env:
cache-name: ${{github.job}}-${{matrix.python.version}}
runs-on: macos-15-intel
steps:
- uses: actions/checkout@v5
- name: Set Java to OpenJDK 17 (Temurin)
uses: actions/setup-java@v5
with:
distribution: 'temurin'
java-version: '17'
- name: Check mvn
run: mvn --version
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: ${{matrix.python.version}}
- name: Check Python
run: python --version
- name: Check Bazel
run: bazel version
- name: Change Python in .bazelrc
run: |
sed -i '' -e 's/\(python_version=\)3.[0-9]*/\1${{matrix.python.version}}/g' .bazelrc
cat .bazelrc
- name: Change Python in MODULE.bazel
run: |
sed -i '' -e 's/\(DEFAULT_PYTHON =\) "3.[0-9]*"/\1 "${{matrix.python.version}}"/g' MODULE.bazel
cat MODULE.bazel
- name: Restore bazel cache
uses: actions/cache/restore@v4
id: bazel-cache-restore
with:
key: ${{env.cache-name}}
path: ${{env.cache-root}}
- name: Build
run: bazel --output_user_root=${{env.cache-root}} build --config=ci //ortools/... //examples/...
- name: Test
run: bazel --output_user_root=${{env.cache-root}} test --config=ci //ortools/... //examples/...
- name: Save Bazel cache for branch main even when Build and Test fail.
uses: actions/cache/save@v4
# https://docs.github.com/en/actions/reference/workflows-and-actions/dependency-caching#restrictions-for-accessing-a-cache
if: always() && github.ref == 'refs/heads/main'
with:
key: ${{env.cache-name}}-${{github.sha}}
path: ${{env.cache-root}}
amd64_macos_bazel:
runs-on: ubuntu-latest
needs: amd64-MacOS-Bazel-Python
steps:
- uses: actions/checkout@v5