Build and Test (macOS 15) #19
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and Test (macOS 15) | |
permissions: read-all | |
on: | |
schedule: | |
# daily at 3 AM | |
- cron: "0 3 * * *" | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
check-cache: | |
runs-on: | |
labels: macos-15 | |
outputs: | |
runner: ${{ steps.runner.outputs.runner }} | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # pin@v3 | |
- name: Cache bazel build artifacts | |
id: cache | |
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # [email protected] | |
with: | |
path: | | |
~/.cache/bazel | |
key: ${{ runner.os }}-${{ env.ImageVersion }}-bazel-${{ hashFiles('.bazelversion', '.bazelrc', 'WORKSPACE') }}-${{ hashFiles('bazel/import_llvm.bzl') }} | |
restore-keys: | | |
${{ runner.os }}-${{ env.ImageVersion }}-bazel-${{ hashFiles('.bazelversion', '.bazelrc', 'WORKSPACE') }}- | |
lookup-only: true | |
- name: Select runner | |
id: runner | |
env: | |
CACHE_HIT: ${{ steps.cache.outputs.cache-hit == 'true' }} | |
run: | | |
set -euo pipefail | |
if [[ "${CACHE_HIT}" == "true" ]]; then | |
echo "runner=macos-15" >> "$GITHUB_OUTPUT" | |
else | |
echo "runner=macos-15" >> "$GITHUB_OUTPUT" | |
fi | |
build-and-test: | |
needs: check-cache | |
runs-on: | |
labels: ${{ needs.check-cache.outputs.runner }} | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # pin@v3 | |
with: | |
key: ${{ runner.os }}-${{ env.ImageVersion }}-bazel-${{ hashFiles('.bazelversion', '.bazelrc', 'WORKSPACE') }}-${{ hashFiles('bazel/import_llvm.bzl') }} | |
- name: Cache bazel build artifacts | |
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # [email protected] | |
with: | |
path: | | |
~/.cache/bazel | |
key: ${{ runner.os }}-${{ env.ImageVersion }}-bazel-${{ hashFiles('.bazelversion', '.bazelrc', 'WORKSPACE') }}-${{ hashFiles('bazel/import_llvm.bzl') }} | |
restore-keys: | | |
${{ runner.os }}-${{ env.ImageVersion }}-bazel-${{ hashFiles('.bazelversion', '.bazelrc', 'WORKSPACE') }}- | |
# --noincompatible_strict_action_env is used below to inherit the path | |
# from the parent process, which is required for the build to be cached | |
# and reused in the `Test rust codegen targets` step below, as that step | |
# requires the `PATH` to find the `cargo` binary. | |
- name: "Run `bazel build`" | |
run: | | |
bazel build --noincompatible_strict_action_env --//:enable_openmp=0 -c fastbuild //... | |
- name: "Run `bazel test`" | |
# (TODO:#1521): re-enable all tests | |
# Nb. any test that uses the mlir-runner is going to fail on MacOS (not sure why) | |
# we have to manually exclude those. | |
run: | | |
bazel query 'tests/Dialect/... except tests/Dialect/Polynomial/Conversions/heir_polynomial_to_llvm/...' | \ | |
xargs bazel test --noincompatible_strict_action_env --//:enable_openmp=0 -c fastbuild "$@" |