-
Notifications
You must be signed in to change notification settings - Fork 1
206 lines (185 loc) · 6.94 KB
/
build-test-gha-branches.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
198
199
200
201
202
203
204
205
206
# WARNING: There is a lot of duplication between .yml workflows because I don't know (yet) how
# to factorize these workflows. Keep things in sync.
name: Test building on GitHub Actions
on:
push:
branches:
- test-gha/*
jobs:
make-source-dist:
runs-on: ubuntu-20.04
steps:
- name: Install dependencies
run: pip3 install build twine
- name: Get the code
uses: actions/checkout@v4
- name: Build the source distribution
run: python3 -m build --sdist
- name: Check the source distribution
run: twine check dist/*
- name: Upload the source distribution to GitHub Actions artifacts
uses: actions/upload-artifact@v4
with:
name: source-dist
path: dist
build-for-linux-x86_64:
runs-on: ubuntu-20.04
needs:
- make-source-dist
strategy:
matrix:
python_version: ['3.8']
steps:
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python_version }}
- name: Install Python packages
run: pip${{ matrix.python_version }} install build auditwheel twine Chrones
- name: Install Boost
run: |
cd /home/runner/work
wget https://boostorg.jfrog.io/artifactory/main/release/1.82.0/source/boost_1_82_0.tar.gz
tar xf boost_*.tar.gz
rm boost_*.tar.gz
cd boost_*
sudo cp -r boost /usr/local/include
- name: Install patchelf
run: |
cd /home/runner/work
mkdir patchelf
cd patchelf
wget https://github.com/NixOS/patchelf/releases/download/0.18.0/patchelf-0.18.0-x86_64.tar.gz
tar xf *.tar.gz
sudo cp bin/patchelf /usr/local/bin
- name: Download the source distribution from GitHub Actions artifacts
uses: actions/download-artifact@v4
with:
name: source-dist
- name: Unzip the source distribution
run: |
tar xf *.tar.gz
rm *.tar.gz
- name: Build the wheel
run: python${{ matrix.python_version }} -m build --wheel --outdir local-dist lincs-*
- name: Make the wheel machine-independent
run: auditwheel repair --plat manylinux_2_31_x86_64 --strip local-dist/*.whl --wheel-dir dist
- name: Check the wheel
run: twine check dist/*.whl
- name: Upload the wheel to GitHub Actions artifacts
uses: actions/upload-artifact@v4
with:
name: wheel-dist-${{ matrix.python_version }}-linux-x86_64
path: dist
check:
runs-on: ${{ matrix.os }}
needs:
- build-for-linux-x86_64
strategy:
fail-fast: false
matrix:
os:
- ubuntu-20.04
python_version: ['3.8']
exclude:
# Older Python versions don't build 'universal2' wheels, so they can't run on the M1 runner that run macOS 14 and 15
- os: macos-14
python_version: '3.8'
- os: macos-15
python_version: '3.8'
- os: macos-14
python_version: '3.9'
- os: macos-15
python_version: '3.9'
- os: macos-14
python_version: '3.10'
- os: macos-15
python_version: '3.10'
steps:
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python_version }}
# DO NOT install any other dependencies, to test that the wheels are self-contained
- name: Download the wheels from GitHub Actions artifacts
uses: actions/download-artifact@v4
with:
pattern: wheel-dist-${{ matrix.python_version }}-*
merge-multiple: true
- name: Install the wheel
run: pip${{ matrix.python_version }} install --find-links . --pre lincs
- run: lincs --version
- run: lincs --help
- run: lincs generate classification-problem 3 2 | tee problem.yml
- run: lincs generate classification-model problem.yml | tee model.yml
- run: lincs generate classified-alternatives problem.yml model.yml 100
build-for-linux-arm64:
runs-on: ubuntu-20.04
needs:
- make-source-dist
strategy:
matrix:
python_version: ['3.8']
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: arm64
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Get the code (only for '.github/workflows/linux-arm64/build.Dockerfile')
uses: actions/checkout@v4
- name: Download the source distribution from GitHub Actions artifacts
uses: actions/download-artifact@v4
with:
name: source-dist
path: wd
- name: Build the wheel, make it machine-independent and check it (during a Docker build in Qemu)
run: |
cp .github/workflows/linux-arm64/build.Dockerfile wd/Dockerfile
cd wd
find -type f
docker buildx build --platform linux/arm64 --build-arg PYTHON_VERSION=${{ matrix.python_version }} --load .
image=$(docker buildx build --platform linux/arm64 --build-arg PYTHON_VERSION=${{ matrix.python_version }} --load . --quiet)
container=$(docker create --platform linux/arm64 $image)
docker cp $container:/wd/dist .
find -type f
- name: Upload the wheel to GitHub Actions artifacts
uses: actions/upload-artifact@v4
with:
name: wheel-dist-${{ matrix.python_version }}-linux-arm64
path: wd/dist
check-on-linux-arm64:
runs-on: ubuntu-24.04
needs:
- build-for-linux-arm64
strategy:
fail-fast: false
matrix:
python_version: ['3.8']
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: arm64
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# DO NOT install any other dependencies, to test that the wheels are self-contained
- name: Get the code (only for '.github/workflows/linux-arm64/check.Dockerfile')
uses: actions/checkout@v4
- name: Download the wheels from GitHub Actions artifacts
uses: actions/download-artifact@v4
with:
pattern: wheel-dist-${{ matrix.python_version }}-linux-arm64
merge-multiple: true
path: wd
- name: Install the wheel and run it (during a Docker build in Qemu)
run: |
cp .github/workflows/linux-arm64/check.Dockerfile wd/Dockerfile
cd wd
find . -type f
docker buildx build --platform linux/arm64 --build-arg PYTHON_VERSION=${{ matrix.python_version }} --load .
image=$(docker buildx build --platform linux/arm64 --build-arg PYTHON_VERSION=${{ matrix.python_version }} --load . --quiet)
container=$(docker create --platform linux/arm64 $image)
docker cp $container:/output.txt - | tar --extract --to-stdout
find . -type f