Wheels #5
Workflow file for this run
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: Wheels | |
on: | |
workflow_dispatch: | |
release: | |
types: | |
- published | |
# Ensures wheels are compatible with macOS 10.15+ | |
env: | |
MACOSX_DEPLOYMENT_TARGET: "10.15" | |
jobs: | |
build_wheels: | |
name: Wheels leflib on ${{ matrix.platform.os }} ${{ matrix.platform.arch}} ${{ matrix.python-version }} | |
runs-on: ${{ matrix.platform.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: [cp38*, cp39*, cp310*, cp311*, cp312*] | |
platform: | |
- os: ubuntu-latest | |
arch: x86_64 | |
- os: ubuntu-latest | |
arch: aarch64 | |
- os: macos-latest | |
arch: universal | |
- os: windows-latest | |
arch: x86_64 | |
env: | |
CIBW_ARCHS_LINUX: ${{ matrix.platform.arch }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
# This facilitates building Linux+arm64 wheels | |
# https://cibuildwheel.readthedocs.io/en/stable/faq/#emulation | |
- name: Set up QEMU | |
if: runner.os == 'Linux' | |
uses: docker/setup-qemu-action@v2 | |
with: | |
platforms: all | |
- name: Setup env (Windows) | |
if: matrix.platform.os == 'windows-latest' | |
run: | | |
choco install -y winflexbison3 | |
vcpkg install zlib zlib:x64-windows | |
- name: Setup env (macOS) | |
if: matrix.platform.os == 'macos-latest' | |
run: | | |
brew install bison | |
# https://github.com/The-OpenROAD-Project/OpenROAD/issues/1688 | |
echo "/usr/local/opt/bison/bin" >> $GITHUB_PATH | |
brew install flex | |
echo "/usr/local/opt/flex/bin" >> $GITHUB_PATH | |
- uses: pypa/cibuildwheel@v2.16 | |
env: | |
CIBW_BEFORE_ALL_LINUX: | | |
yum --disablerepo=epel -y update ca-certificates | |
yum install -y zlib-devel wget | |
CIBW_BEFORE_BUILD_WINDOWS: if exist "{package}\\_skbuild\" rd /q /s "{package}\\_skbuild" | |
CIBW_ENVIRONMENT_MACOS: > | |
LDFLAGS="-L/usr/local/opt/bison/lib -L/usr/local/opt/flex/lib" | |
CPPFLAGS="-I/usr/local/opt/flex/include" | |
CIBW_ENVIRONMENT_WINDOWS: SC_CMAKEARGS="-DCMAKE_TOOLCHAIN_FILE=$VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake." | |
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014 | |
CIBW_BUILD: ${{ matrix.python-version }} | |
CIBW_SKIP: "pp* *win32 *i686 *-musllinux_*" | |
CIBW_ARCHS_MACOS: x86_64 arm64 | |
CIBW_TEST_SKIP: "*_arm64" | |
CIBW_TEST_EXTRAS: test | |
CIBW_TEST_COMMAND: > | |
pytest {package}/tests/ | |
# "if: always()" ensures that we always upload any wheels that have | |
# been created, even if cibuildwheel action fails | |
- name: Upload wheels | |
if: always() | |
uses: actions/upload-artifact@v3 | |
with: | |
name: artifact | |
path: wheelhouse/*.whl | |
publish: | |
needs: [build_wheels] | |
runs-on: ubuntu-latest | |
if: github.event_name == 'release' && github.event.action == 'published' && !contains(github.event.release.body, 'NOPUBLISH') | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: artifact | |
path: dist | |
- uses: pypa/gh-action-pypi-publish@v1.4.2 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_DEPLOY }} | |
package_offline: | |
# We want to run this on the official PEP Python-wheel building platform to | |
# ensure the downloaded wheels have the broadest compatibility. Using the | |
# '--platform' tag for 'pip download' doesn't work for us, since it requires | |
# setting --only-binary=:all: and some of our deps aren't available as | |
# wheels on some platforms. | |
container: quay.io/pypa/manylinux2014_x86_64 | |
needs: [build_wheels] | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python: [cp38-cp38, cp39-cp39, cp310-cp310, cp311-cp311, cp312-cp312] | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: artifact | |
path: dist | |
- name: Package sc-leflib | |
run: | | |
mkdir deps | |
$python -m pip download pip -d deps | |
$python -m pip download ./dist/sc_leflib*${{matrix.python}}*linux*x86_64.whl -d deps | |
tar -czvf deps-${{matrix.python}}.tar.gz deps | |
env: | |
python: /opt/python/${{matrix.python}}/bin/python | |
- name: Upload package | |
uses: actions/upload-artifact@v3 | |
with: | |
path: deps*.tar.gz |