-
Notifications
You must be signed in to change notification settings - Fork 1
144 lines (125 loc) · 3.99 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
name: Wheel
on:
schedule:
# At 09:00 on Monday. (see https://crontab.guru)
- cron: '0 9 * * 1'
pull_request:
branches:
- main
defaults:
run:
shell: bash -leo pipefail {0}
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
build-wheel:
strategy:
matrix:
os: ['ubuntu-24.04', 'macos-13', 'macos-14', 'windows-2022']
arch: ['x86_64', 'aarch64']
exclude:
- os: 'ubuntu-24.04' # TODO: needs qemu setup
arch: 'aarch64'
- os: 'macos-13'
arch: 'aarch64'
- os: 'macos-14'
arch: 'x86_64'
- os: 'windows-2022'
arch: 'aarch64'
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Finch-mlir
uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Setup Developer Command Prompt
uses: ilammy/msvc-dev-cmd@v1.4.1
if: ${{ matrix.os == 'windows-2022' }}
- name: Set up Visual Studio shell
if: ${{ matrix.os == 'windows-2022' }}
uses: egor-tensin/vs-shell@v2
with:
arch: x64
- name: Setup MS Build
if: ${{ matrix.os == 'windows-2022' }}
uses: microsoft/setup-msbuild@v1.1
- name: Setup ccache
uses: hendrikmuhs/ccache-action@v1
with:
key: ${{ matrix.os }}-${{ matrix.arch }}
max-size: "1G"
verbose: 2
variant: ccache
- name: Configure ccache - ubuntu & macos
if: contains(matrix.os, 'ubuntu') || contains(matrix.os, 'macos')
shell: bash
run: |
if [ x"${{ contains(matrix.os, 'macos') }}" == x"true" ]; then
echo "/usr/local/opt/ccache/libexec:/opt/homebrew/opt/ccache/libexec" >> $GITHUB_PATH
else
echo "/usr/lib/ccache:/usr/lib64/ccache:/usr/lib/ccache/bin" >> $GITHUB_PATH
fi
- name: Configure ccache
shell: bash
run: |
ccache -p
ccache -z
# See https://github.com/hendrikmuhs/ccache-action/issues/146
ccache --set-config=compiler_check=content
ccache --set-config=sloppiness=locale,time_macros
- name: pip install standard tools
shell: bash
run: pip install cibuildwheel wheel
- name: Set env variables
run: |
echo "HOST_CCACHE_DIR="$(ccache --get-config cache_dir)"" >> $GITHUB_ENV
- name: set env variables - macos
if: contains(matrix.os, 'macos')
shell: bash
run: |
echo "MACOSX_DEPLOYMENT_TARGET=11.0" | tee -a $GITHUB_ENV
- name: cibuildwheel run
env:
SPARSE_BACKEND: MLIR
run: |
cibuildwheel --output-dir ./wheelhouse
ccache -s
- name: Reset datetime ccache
# find: The environment is too large for exec().
if: ${{ !contains(matrix.os, 'windows') }}
run: |
ccache --print-stats
find $HOST_CCACHE_DIR -exec touch -a -m -t 197001010000 {} \;
- name: Upload wheel
uses: actions/upload-artifact@v4
with:
path: wheelhouse/*.whl
name: artifact_finch_mlir-${{ matrix.os }}-${{ matrix.arch }}
release-wheel:
runs-on: 'ubuntu-latest'
needs: build-wheel
if: github.ref_name == 'main'
permissions:
id-token: write
contents: write
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
pattern: artifact_finch_mlir-*
path: wheelhouse
merge-multiple: true
- name: Create release
uses: ncipollo/release-action@v1
with:
artifacts: 'wheelhouse/*.whl'
token: ${{ secrets.GITHUB_TOKEN }}
tag: latest
name: latest
body: Latest release
removeArtifacts: false
allowUpdates: true
replacesArtifacts: true
makeLatest: true
artifactErrorsFailBuild: true