Fix builds on macOS systems #80
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Poetry Lockfile rebuild | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- ci-lockfile | |
jobs: | |
rebuild: | |
name: Lockfile Rebuild | |
runs-on: ${{ matrix.sys.os }} | |
env: | |
# As of 1.2.0b2 poetry tries to access the system Keyring for more actions than it did | |
# before. This causes problems on the Ubuntu CI - but not on Windows - for reasons that | |
# are unclear. (Backend installed but not running? System not capable of prompting a | |
# user to login to unlock the keychain as it's a CI system?) | |
# | |
# @see https://github.com/python-poetry/poetry/issues/1917 | |
PYTHON_KEYRING_BACKEND: keyring.backends.null.Keyring | |
# According to MSys2's list of known issues (https://www.msys2.org/docs/python/#known-issues), | |
# setuptools >= 60.0 is not compatible with MSys2 (or vice-versa). | |
# `SETUPTOOLS_USE_DISTUTILS=stdlib` is the recommended work-around. | |
SETUPTOOLS_USE_DISTUTILS: ${{ matrix.sys.distutils }} | |
defaults: | |
run: | |
shell: ${{ matrix.sys.shell }} | |
strategy: | |
fail-fast: false | |
matrix: | |
sys: | |
- os: windows-latest | |
shell: msys2 {0} | |
distutils: stdlib | |
- os: ubuntu-latest | |
shell: bash | |
distutils: local | |
- os: macos-latest | |
shell: bash | |
distutils: local | |
# Poetry 1.7.0 & 1.7.1 fail on all three systems above | |
poetVers: | |
- 1.8.3 | |
- 1.8.2 | |
- 1.8.1 | |
- 1.8.0 | |
- 1.6.1 | |
- 1.6.0 | |
- 1.5.1 | |
- 1.5.0 | |
- 1.4.2 | |
- 1.4.1 | |
- 1.4.0 | |
- 1.3.1 | |
- 1.3.0 | |
- 1.2.2 | |
exclude: | |
# Poetry bug #8338 (ImportError: atomic_open from requests.utils) | |
- sys: | |
os: ubuntu-latest | |
poetVers: 1.6.0 | |
steps: | |
# This should closely mirror the msys2-ci workflow file | |
- name: Install and Configure Msys2 | |
if: ${{ startsWith(matrix.sys.os, 'windows') }} | |
uses: msys2/setup-msys2@v2 | |
with: | |
msystem: ucrt64 | |
update: true | |
install: > | |
git | |
pacboy: > | |
cairo:p | |
gcc:p | |
gobject-introspection:p | |
gstreamer:p | |
gst-plugins-good:p | |
liblo:p | |
ninja:p | |
pkgconf:p | |
python-gobject:p | |
python-pip:p | |
python-pyqt5:p | |
qt5-svg:p | |
rtmidi:p | |
# Either libasound2-dev or libjack-dev (or both) is required to build the python-rtmidi | |
# 1.5.x source on Ubuntu systems. | |
- name: Install dependency for python-rtmidi | |
if: ${{ startsWith(matrix.sys.os, 'ubuntu') }} | |
run: | | |
sudo apt-get install libasound2-dev | |
# On macOS systems, pip is maintained "externally" via homebrew, and so refuses to update | |
# itself or install anything directly. As this is a CI system, we can safely override this. | |
# | |
# We do *NOT* set the default install location to "user", as that location is not in PATH, | |
# and thus poetry is unfindable when we attempt to use it directly later. | |
- name: Configure pip | |
if: ${{ startsWith(matrix.sys.os, 'macos') }} | |
run: | | |
python3 -m pip config --user set global.break-system-packages true | |
- name: Update pip | |
run: | | |
python3 -m pip install -U pip | |
# poetry requires jsonschema which, as of jsonschema v4.18.0, requires rpds-py, which | |
# requires a rust compiler (unless rpds-py is installed from a wheel, and there isn't one | |
# provided for use with MSys2 on Windows). | |
# | |
# Besides the question of why one should need a rust compiler to build a python package, | |
# as this is only a build-time dependancy, we should be able to satisfy poetry's requirement | |
# by specifying a version, and hope that pip doesn't try to update it to a newer version. | |
- name: Pin jsonschema | |
if: ${{ startsWith(matrix.sys.os, 'windows') }} | |
run: | | |
pip3 install "jsonschema<4.18.0" | |
- name: Install Poetry via pip | |
run: | | |
pip3 install poetry==${{ matrix.poetVers }} | |
pip3 list | grep poetry | |
- name: Checkout source | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 1 | |
# Without this, we get a series of "MaxRetryError" errors when rebuilding the lockfile on | |
# Windows, seemingly caused by not being able to verify certificates. | |
# | |
# The VM version of git appears to be configured to use a file that may assist with this, | |
# however attempting to tell the MSys2 version of git to use the exact same config fails | |
# with the same error. | |
# | |
# I suspect that this may be some fault or shortcoming in Dulwich, which is what poetry uses | |
# instead of querying the git client. | |
# | |
# We still need to install a version of git via MSys2, as a git client is needed to clone | |
# dependencies not available via pip, and the VM version of git can seemingly not be found | |
# when inside an MSys2 shell. | |
- name: Force system git client | |
if: ${{ startsWith(matrix.sys.os, 'windows') }} | |
run: | | |
poetry config experimental.system-git-client true | |
- name: Rebuild lockfile | |
run: | | |
poetry lock -v | |
# Each of the jobs *should* generate the same (platform-agnostic) lockfile. | |
# However they might not, so upload all of them for comparison. | |
- name: Upload lockfile | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.sys.os }}__${{ matrix.poetVers }}__poetry.lock | |
path: poetry.lock |