Skip to content

Commit fe554bc

Browse files
authored
CI: Try to make Ubuntu wheels easier to install (#10)
1 parent 94e3d99 commit fe554bc

File tree

2 files changed

+22
-11
lines changed

2 files changed

+22
-11
lines changed

.github/workflows/build_wheels.yml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ jobs:
3333
os: ["ubuntu-22.04", "ubuntu-20.04", "macos-12"]
3434
platform: ["x86_64"]
3535
python-version: ["3.8", "3.9", "3.10", "3.11"]
36+
env:
37+
PLATFORM_OS: ${{ matrix.os }}
3638

3739
steps:
3840
- name: Checkout repository
@@ -130,9 +132,12 @@ jobs:
130132
sudo mkdir -p $BUILD_TEMP_DIR
131133
sudo chown -R $(id -u):$(id -g) $BUILD_TEMP_DIR
132134
pip install wheel
133-
python setup.py bdist_wheel --plat-name=$PLATFORM_TAG
135+
python setup.py bdist_wheel
134136
echo "List wheels"
135137
ls ./dist
138+
find ./dist -type f -name '*.whl' -exec mv {} {}.$PLATFORM_OS \;
139+
echo "Renamed with $PLATFORM_OS suffix"
140+
ls ./dist
136141
137142
- name: Build package for MacOS
138143
if: runner.os == 'macOS'
@@ -144,9 +149,10 @@ jobs:
144149
pip install wheel
145150
python setup.py bdist_wheel
146151
147-
- uses: actions/upload-artifact@v3
152+
- name: "Upload artifacts"
153+
uses: actions/upload-artifact@v3
148154
with:
149-
path: ./dist/*.whl
155+
path: ./dist/*
150156

151157
test-wheels:
152158
name: Test wheels on ${{ matrix.os }} ${{ matrix.platform }} (Python ${{ matrix.python-version }})
@@ -158,7 +164,7 @@ jobs:
158164
os: ["ubuntu-22.04", "ubuntu-20.04", "macos-12", "macos-11"]
159165
python-version: ["3.8", "3.9", "3.10", "3.11"]
160166
env:
161-
PYTHON_VERSION: ${{ matrix.python-version }}
167+
PLATFORM_OS: ${{ matrix.os }}
162168

163169
steps:
164170
- name: Install Ubuntu 22.04 runtime dependencies
@@ -176,7 +182,6 @@ jobs:
176182
libegl1 \
177183
libopengl0 \
178184
xvfb
179-
echo "PLATFORM_TAG=ubuntu22_04_x86_64" >> $GITHUB_ENV
180185
181186
- name: Install Ubuntu 20.04 runtime dependencies
182187
if: matrix.os == 'ubuntu-20.04'
@@ -193,7 +198,6 @@ jobs:
193198
libegl1 \
194199
libopengl0 \
195200
xvfb
196-
echo "PLATFORM_TAG=ubuntu20_04_x86_64" >> $GITHUB_ENV
197201
198202
- name: Set up Python
199203
uses: actions/setup-python@v4
@@ -208,15 +212,14 @@ jobs:
208212
- name: Install dependencies
209213
shell: bash
210214
run: |
211-
echo "PYTHON_SITE_PACKAGES=$pythonLocation/lib/python$PYTHON_VERSION/site-packages" >> $GITHUB_ENV
212215
python -m pip install pytest Pillow numpy pixelmatch python-dotenv
213216
214217
- name: Install and test wheels on Ubuntu
215218
if: runner.os == 'Linux'
216219
run: |
217-
python -m pip install --find-links wheelhouse/artifact --platform $PLATFORM_TAG --target $PYTHON_SITE_PACKAGES --no-deps --upgrade pymgl
220+
find ./wheelhouse/artifact -type f -name "*.whl.$PLATFORM_OS" -print0 -exec bash -c 'mv "${0}" "${0//.$PLATFORM_OS/}"' {} \;
221+
python -m pip install --find-links wheelhouse/artifact pymgl
218222
python -m pip list
219-
python -m pip list --path $PYTHON_SITE_PACKAGES
220223
xvfb-run -a --server-args="-screen 0 1024x768x24 -ac +render -noreset" \
221224
python -m pytest --pyargs pymgl -v
222225

README.md

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,18 @@ Ubuntu 22.04 and 20.04.
4444

4545
Wheels are available on the release page in Github. Download and install from there.
4646

47-
Something like:
47+
Unfortunately, Python wheel names are very restrictive, so we have added
48+
`.ubuntu-22.04` and `.ubuntu-20.04` suffixes to the wheel names, which have to
49+
be stripped off before you can install them.
50+
51+
Something like this for Ubuntu 22.04:
4852

4953
```bash
50-
pip install https://github.com/brendan-ward/pymgl/releases/download/<release>/pymgl-<release>-<Python version>-<Python version>-ubuntu<Ubuntu version>_x86_64.whl
54+
55+
wget https://github.com/brendan-ward/pymgl/releases/download/<release>/pymgl-<release>-<Python version>-<Python version>-linux_x86_64.whl.ubuntu-22.04
56+
# rename file to remove .ubuntu-22.04 suffix
57+
find . -type f -name "*.whl.ubuntu-22.04" -print0 -exec bash -c 'mv "${0}" "${0//.ubuntu-22.04/}"' {} \;
58+
python3 -m pip install --find-links . pymgl
5159
```
5260

5361
You also need to install the following runtime dependencies:

0 commit comments

Comments
 (0)