-
Notifications
You must be signed in to change notification settings - Fork 0
197 lines (180 loc) · 5.23 KB
/
cd-wheel.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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
name: cd-wheel
permissions:
contents: read
on: # yamllint disable-line rule:truthy
workflow_call:
inputs:
mpiname:
description: 'MPI Name'
default: 'mpich'
required: false
type: string
version:
description: 'MPI Version'
default: ''
required: false
type: string
release:
description: 'Release number'
default: ''
required: false
type: string
os-arch:
description: 'Target OS-Architecture'
default: ''
required: false
type: string
workflow_dispatch:
inputs:
mpiname:
description: 'MPI'
default: 'mpich'
type: choice
options:
- mpich
- openmpi
version:
description: 'Version'
default: ''
required: false
type: string
release:
description: 'Release number'
default: ''
required: false
type: string
os-arch:
description: "Target OS-Architecture"
default: Linux-x86_64
required: true
type: choice
options:
- all
- Linux
- Linux-aarch64
- Linux-ppc64le
- Linux-x86_64
- macOS
- macOS-arm64
- macOS-x86_64
env:
MPINAME: '${{ inputs.mpiname }}'
VERSION: '${{ inputs.version }}'
RELEASE: '${{ inputs.release }}'
jobs:
setup:
runs-on: 'ubuntu-latest'
outputs:
matrix: ${{ steps.setup.outputs.matrix }}
steps:
- id: setup
shell: python
name: 'setup build matrix'
run: |
keys = ("os", "arch", "runner")
rows = [
("Linux", "aarch64", "ubuntu-22.04"),
("Linux", "ppc64le", "ubuntu-22.04"),
("Linux", "x86_64", "ubuntu-22.04"),
("macOS", "arm64", "macos-14"),
("macOS", "x86_64", "macos-13"),
]
os, _, arch = "${{ inputs.os-arch }}".partition("-")
if os not in ("", "*", "all"):
rows = [row for row in rows if row[0] == os]
if arch not in ("", "*", "all"):
rows = [row for row in rows if row[1] == arch]
matrix = [dict(zip(keys, row)) for row in rows]
import os, json
with open(os.getenv("GITHUB_OUTPUT"), "w") as out:
print(f"matrix={json.dumps(matrix)}", file=out)
build:
needs: setup
if: ${{ needs.setup.outputs.matrix != '[]' }}
name: build-${{ matrix.os }}-${{ matrix.arch }}
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include: ${{ fromJSON(needs.setup.outputs.matrix) }}
steps:
- id: checkout
uses: actions/checkout@v4
- id: setup-macOS
if: ${{ runner.os == 'macOS' }}
name: setup-macOS
run: |
# create gfortran symlink
cd $(brew --prefix)/bin
gfortran=$(ls gfortran-* | sort | head -n 1)
sudo ln -s $gfortran gfortran
# install autotools
brew install autoconf
brew install automake
brew install libtool
# unlink libevent
brew unlink libevent || true
# install uv
brew install uv
- id: setup-python
uses: actions/setup-python@v5
with:
python-version: 3
- id: setup-qemu
if: ${{ runner.os == 'Linux' }}
uses: docker/setup-qemu-action@v3
with:
platforms: all
- id: bootstrap
run: ./bootstrap.sh
- id: source-date-epoch
run: |
SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)
echo SOURCE_DATE_EPOCH=$SOURCE_DATE_EPOCH >> $GITHUB_ENV
echo $(git log -1 --pretty=%ci) [timestamp=$SOURCE_DATE_EPOCH]
- id: build
uses: pypa/[email protected]
timeout-minutes: 360
with:
package-dir: package
output-dir: wheelhouse
env:
CIBW_BUILD_FRONTEND: "build[uv]"
CIBW_BUILD: "cp312-*"
CIBW_SKIP: "*musllinux*"
CIBW_ARCHS: "${{ matrix.arch }}"
CIBW_BEFORE_ALL: >-
bash {project}/cibw-build-mpi.sh
CIBW_TEST_COMMAND: >-
bash {project}/cibw-check-mpi.sh
CIBW_ENVIRONMENT_PASS: >-
MPINAME RELEASE
CIBW_ENVIRONMENT_LINUX: >-
SOURCE="/project/package/source"
WORKDIR="/project/package/workdir"
DESTDIR="/project/package/install"
CIBW_ENVIRONMENT_MACOS: >-
SOURCE="$PWD/package/source"
WORKDIR="$PWD/package/workdir"
DESTDIR="$PWD/package/install"
CIBW_REPAIR_WHEEL_COMMAND_MACOS: >
delocate-wheel
--ignore-missing-dependencies
--exclude libmpi --exclude libpmpi
--require-archs {delocate_archs}
-w {dest_dir} -v {wheel}
- id: sha256sum
run: |
# sha256sum
test $(uname) == Darwin && sha256sum() { shasum -a 256 $@; } || true
echo '```' >> $GITHUB_STEP_SUMMARY
sha256sum -b *.whl >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
working-directory: wheelhouse
- id: upload
uses: actions/upload-artifact@v4
with:
name: wheel-${{ inputs.mpiname }}-${{ matrix.os }}-${{ matrix.arch }}
path: wheelhouse/*.whl
- id: check
run: ./check-wheel.sh wheelhouse