Fix GHA caches #207
Workflow file for this run
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: CI MacOS | |
on: | |
workflow_call: | |
workflow_dispatch: | |
pull_request: | |
merge_group: | |
push: | |
branches: | |
- main | |
schedule: | |
- cron: '0 */6 * * *' | |
concurrency: | |
group: ci-build-test-cpp-macos-${{ github.event.number || github.sha }} | |
cancel-in-progress: true | |
jobs: | |
build_and_ctest: | |
name: Build and Test (${{ matrix.runs-on }}, ASSERTIONS) | |
runs-on: ${{ matrix.runs-on }} | |
strategy: | |
fail-fast: false | |
matrix: | |
runs-on: [macos-12, macos-14] | |
env: | |
CACHE_DIR: ${{ github.workspace }}/.container-cache | |
CACHE_KEY: ${{ matrix.runs-on }}-build-test-cpp-asserts-v1-${{ github.event.number || format('{0}-{1}', github.ref_name, github.run_number) }} | |
steps: | |
- name: Set unified TZ | |
uses: szenius/[email protected] | |
with: | |
# this is an arbitrary choice | |
timezoneLinux: "Asia/Singapore" | |
timezoneMacos: "Asia/Singapore" | |
timezoneWindows: "Singapore Standard Time" | |
- name: "Checking out repository" | |
uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # v3.5.0 | |
with: | |
submodules: recursive | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- name: Install deps | |
run: | | |
brew install ccache ninja | |
- name: Sync source deps | |
run: | | |
python ./sync_deps.py | |
- name: Python deps | |
run: | | |
pip install "numpy<2" pyyaml "pybind11[global]==2.10.3" nanobind | |
- name: Enable cache | |
uses: actions/cache/restore@v3 | |
with: | |
path: ${{ env.CACHE_DIR }} | |
key: ${{ env.CACHE_KEY }} | |
restore-keys: ${{ matrix.runs-on }}-build-test-cpp- | |
- name: Configure ccache debug logs | |
run: | | |
echo CCACHE_DEBUG=1 >> $GITHUB_ENV | |
echo CCACHE_DEBUGLEVEL=2 >> $GITHUB_ENV | |
echo CCACHE_DEBUGDIR="$HOME/ccache-debug" >> $GITHUB_ENV | |
echo CCACHE_SLOPPINESS=include_file_ctime,include_file_mtime,time_macros >> $GITHUB_ENV | |
- name: Build packages | |
run: | | |
export cache_dir="${{ env.CACHE_DIR }}" | |
bash build_tools/ci/build_test_cpp.sh | |
- name: Create artifacts | |
if: ${{ !cancelled() }} | |
run: | | |
tar cf iree-dist-${{ matrix.runs-on }}.tar -C iree-install . | |
- name: Tar ccache logs | |
if: ${{ !cancelled() }} | |
run: | | |
ccache --show-stats -v | |
tar cf macos-ccache-logs.tar $CCACHE_DEBUGDIR | |
- name: Upload ccache logs | |
uses: actions/upload-artifact@v4 | |
if: ${{ !cancelled() }} | |
with: | |
name: ccache_logs | |
path: macos-ccache-logs.tar | |
if-no-files-found: warn | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
if: ${{ !cancelled() }} | |
with: | |
name: ${{ matrix.runs-on }}_release_packages | |
path: iree-dist-${{ matrix.runs-on }}.tar | |
if-no-files-found: warn | |
- name: Save cache | |
uses: actions/cache/save@v3 | |
if: ${{ !cancelled() && github.event_name != 'pull_request' }} | |
with: | |
path: ${{ env.CACHE_DIR }} | |
key: ${{ env.CACHE_KEY }} |