fix(ci): actually fix artifacts generation #47
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: Build | |
on: | |
workflow_dispatch: | |
pull_request: | |
push: | |
branches: | |
- master | |
jobs: | |
build_wheels: | |
name: Build wheels on ${{ matrix.os }} for Python | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-22.04, macos-latest, windows-latest] | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-python@v5 | |
name: Install Python | |
with: | |
python-version: '3.12' | |
- name: Prepare compiler environment for Windows | |
if: runner.os == 'Windows' | |
uses: ilammy/msvc-dev-cmd@v1 | |
with: | |
arch: amd64 | |
- name: Install cibuildwheel | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install -r requirements-cibw.txt | |
- name: Build wheels | |
env: | |
CIBW_BUILD: cp37-* cp38-* cp39-* cp310-* cp311-* cp312-* | |
CIBW_ARCHS_MACOS: "universal2" | |
CIBW_ARCHS_LINUX: "auto64" | |
CIBW_ARCHS_WINDOWS: "auto64" | |
CIBW_SKIP: "*musllinux*" | |
CIBW_BEFORE_ALL_LINUX: > | |
yum -y -q --enablerepo=extras install epel-release | |
&& yum install -y re2-devel ninja-build | |
CIBW_REPAIR_WHEEL_COMMAND_LINUX: "auditwheel show {wheel} && auditwheel repair -w {dest_dir} {wheel}" | |
CIBW_BEFORE_ALL_MACOS: > | |
brew install re2 pybind11 ninja | |
CIBW_ENVIRONMENT_MACOS: MACOSX_DEPLOYMENT_TARGET=10.15 | |
CIBW_REPAIR_WHEEL_COMMAND_MACOS: "pip uninstall -y delocate && pip install delocate && delocate-listdeps {wheel} && delocate-wheel -w {dest_dir} -v {wheel}" | |
CIBW_BEFORE_ALL_WINDOWS: > | |
vcpkg install re2:x64-windows | |
&& vcpkg integrate install | |
CIBW_ENVIRONMENT_WINDOWS: 'CMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake' | |
CIBW_TEST_COMMAND: python -c "import re2" | |
run: | | |
python -m cibuildwheel --output-dir wheelhouse | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: dist-${{ matrix.os }}-${{ matrix.python-version }} | |
path: ./wheelhouse/*.whl | |
build_sdist: | |
name: Build source distribution | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
name: Install Python | |
with: | |
python-version: '3.12' | |
- name: Build sdist | |
run: | | |
pip install pep517 | |
python -m pep517.build -s . | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: dist-${{ matrix.os }}-${{ matrix.python-version }} | |
path: dist/*.tar.gz | |
check_artifacts: | |
needs: [build_sdist, build_wheels] | |
defaults: | |
run: | |
shell: bash | |
name: Check artifacts are correct | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v4 | |
with: | |
pattern: dist-* | |
merge-multiple: true | |
path: dist | |
# note wheels should be in subdirectory <upload_name> | |
- name: Check number of downloaded artifacts | |
run: ls -R |