Skip to content

Commit cbda0e5

Browse files
committed
save MLIR cache immediately after successful build
Signed-off-by: Gong Su <[email protected]>
1 parent 69cce51 commit cbda0e5

File tree

1 file changed

+26
-14
lines changed

1 file changed

+26
-14
lines changed

.github/workflows/macos-amd64-build.yml

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,67 +3,79 @@ name: GitHub Action MacOS amd64
33
on: [push, pull_request]
44

55
jobs:
6-
env_setup:
6+
build:
77
runs-on: macos-13
88
steps:
9-
- uses: actions/checkout@v3
9+
- uses: actions/checkout@v4
1010
with:
1111
submodules: recursive
12+
1213
- uses: actions/setup-python@v4
1314
with:
1415
python-version: '3.10'
16+
1517
- name: remove system python
1618
run: |
1719
sudo rm -rf /Library/Frameworks/Python.framework/Versions/3* /usr/local/Frameworks/Python.framework/Versions/3* /usr/local/bin/python3* || true
20+
1821
- name: install tools that are needed for compilation
1922
run: |
2023
brew install automake ninja protobuf@32 pybind11
2124
python3 -m pip install protobuf==6.32.0
22-
build_mlir:
23-
runs-on: macos-13
24-
needs: env_setup
25-
steps:
25+
2626
- name: get protobuf version
2727
id: get-protobuf-version
2828
run: |
2929
echo "protobuf_version=$(protoc --version)" >> $GITHUB_OUTPUT
30-
- name: cache MLIR directory
31-
id: cache-mlir
32-
uses: actions/cache@v3
30+
31+
- name: restore MLIR cache
32+
id: restore-mlir-cache
33+
uses: actions/cache/restore@v4
3334
with:
3435
path: ~/work/onnx-mlir/llvm-project
3536
key: ${{ runner.os }}-mlir-${{ hashFiles('**/clone-mlir.sh', '**/build-mlir.sh') }}-${{ steps.get-protobuf-version.outputs.protobuf_version }}
37+
3638
- name: clone & build MLIR
37-
if: steps.cache-mlir.outputs.cache-hit != 'true'
39+
if: steps.restore-mlir-cache.outputs.cache-hit != 'true'
3840
run: |
3941
cd ~/work/onnx-mlir
4042
sh ~/work/onnx-mlir/onnx-mlir/utils/clone-mlir.sh
4143
sh ~/work/onnx-mlir/onnx-mlir/utils/build-mlir.sh
42-
build_onnx_mlir:
43-
runs-on: macos-13
44-
needs: build_mlir
45-
steps:
44+
45+
- name: save MLIR cache
46+
id: save-mlir-cache
47+
if: steps.restore-mlir-cache.outputs.cache-hit != 'true'
48+
uses: actions/cache/save@v4
49+
with:
50+
path: ~/work/onnx-mlir/llvm-project
51+
key: ${{ steps.restore-mlir-cache.outputs.cache-primary-key }}
52+
4653
- name: install python requirements
4754
run: |
4855
cd ~/work/onnx-mlir/onnx-mlir
4956
python3 -m pip install --upgrade wheel
5057
python3 -m pip install -r requirements.txt
58+
5159
- name: install third_party/onnx
5260
run: |
5361
cd ~/work/onnx-mlir/onnx-mlir/third_party/onnx
5462
sh ~/work/onnx-mlir/onnx-mlir/utils/install-onnx.sh
63+
5564
- name: build onnx-mlir
5665
run: |
5766
cd ~/work/onnx-mlir
5867
sh ~/work/onnx-mlir/onnx-mlir/utils/install-onnx-mlir.sh
68+
5969
- name: build and run docs/doc_example tests
6070
run: |
6171
cd ~/work/onnx-mlir
6272
sh ~/work/onnx-mlir/onnx-mlir/utils/check-doc-example.sh
73+
6374
- name: build and run unit tests
6475
run: |
6576
cd ~/work/onnx-mlir
6677
sh ~/work/onnx-mlir/onnx-mlir/utils/check-unittest.sh
78+
6779
- name: run onnx-mlir backend and numerical tests
6880
run: |
6981
cd ~/work/onnx-mlir

0 commit comments

Comments
 (0)