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 207 208
|
on:
release:
types: [published]
schedule:
- cron: '0 1 * * *'
workflow_dispatch:
inputs:
release_tag:
description: "Tag of the release to build (leave empty for current branch)"
python_versions:
description: "Python versions to build (leave empty for all supported versions)"
deploy_target:
type: choice
description: "Choose the deployment target"
options:
- None
- PyPI
- Test PyPI
name: PyPi packaging
jobs:
build_wheels:
name: ${{ matrix.name }}${{ matrix.gpl && ' (GPL)' || '' }}
runs-on: ${{ matrix.os }}
if: (github.repository == 'cvc5/cvc5') || (github.event_name != 'schedule')
strategy:
matrix:
name:
- manylinux-x86_64
- manylinux-aarch64
- macos-x86_64
- macos-arm64
- windows-x86_64
- windows-arm64
gpl: [false, true]
include:
- name: manylinux-x86_64
os: ubuntu-latest
arch: x86_64
shell: bash
- name: manylinux-aarch64
os: ubuntu-24.04-arm
arch: aarch64
shell: bash
- name: macos-x86_64
os: macos-15-intel
macos-target: 10.13
shell: bash
- name: macos-arm64
os: macos-15
macos-target: 11
shell: bash
- name: windows-x86_64
os: windows-latest
shell: 'msys2 {0}'
- name: windows-arm64
os: windows-11-arm
shell: 'msys2 {0}'
exclude:
- name: windows-x86_64
gpl: true
- name: windows-arm64
gpl: true
defaults:
run:
shell: ${{ matrix.shell }}
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
ref: ${{ github.event.inputs.release_tag }}
# Required by PEP-668
- name: Set up Python virtual environment
if: runner.os == 'macOS'
run: |
python3 -m venv ~/.venv
echo "$HOME/.venv/bin" >> $GITHUB_PATH
- uses: msys2/setup-msys2@v2
if: runner.os == 'Windows' && runner.arch == 'X64'
with:
msystem: clang64
path-type: inherit
install: |
make
mingw-w64-clang-x86_64-cmake
mingw-w64-clang-x86_64-clang
mingw-w64-clang-x86_64-gmp
- uses: msys2/setup-msys2@v2
if: runner.os == 'Windows' && runner.arch == 'ARM64'
with:
msystem: clangarm64
path-type: inherit
install: |
make
mingw-w64-clang-aarch64-cmake
mingw-w64-clang-aarch64-clang
mingw-w64-clang-aarch64-gmp
# cibuildwheel requires pyproject.toml to be present from the beginning
- name: Create pyproject.toml
run: |
echo "::group::Create pyproject.toml"
mkdir -p build/src/api/python
if [ "${{ matrix.gpl }}" == "true" ]; then
sed -e 's/^name="cvc5"$/name="cvc5-gpl"/' \
-e 's/^\(description=".*\)"/\1 (GPL version)"/' \
-e 's/^\(readme = {text = ".*\)\(", content-type = "text\/plain"\)/\1 (GPL version)\2/' \
./src/api/python/pyproject.toml > ./build/src/api/python/pyproject.toml
else
sed -e 's/^\(description=".*\)"/\1 (BSD version)"/' \
-e 's/^\(readme = {text = ".*\)\(", content-type = "text\/plain"\)/\1 (BSD version)\2/' \
./src/api/python/pyproject.toml > ./build/src/api/python/pyproject.toml
fi
echo "::endgroup::"
- name: Store MinGW64 path
if: runner.os == 'Windows'
id: mingw64-path
shell: msys2 {0}
run: echo "bin=$(cygpath -m $(dirname $(which cc)))" >> $GITHUB_OUTPUT
- name: Build wheels
uses: pypa/cibuildwheel@v3.3.0
with:
package-dir: ./build/src/api/python/
env:
CIBW_ALLOW_EMPTY: True
CIBW_BUILD: "${{ github.event.inputs.python_versions || '*' }}"
CIBW_SKIP: "pp*-win* *-win32 *-manylinux_i686 *-musllinux_* cp31?t-*"
CIBW_ENABLE: pypy pypy-eol
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
CIBW_MANYLINUX_AARCH64_IMAGE: manylinux2014
CIBW_MANYLINUX_PYPY_X86_64_IMAGE: manylinux2014
CIBW_MANYLINUX_PYPY_AARCH64_IMAGE: manylinux2014
CIBW_ARCHS_LINUX: "${{ matrix.arch }}"
CIBW_BEFORE_ALL_LINUX: bash ./contrib/cibw/before_all_linux.sh ${{ matrix.gpl }}
CIBW_BEFORE_ALL_MACOS: bash ./contrib/cibw/before_all_macos.sh ${{ matrix.gpl }}
CIBW_BEFORE_ALL_WINDOWS: msys2 -c "./contrib/cibw/before_all_windows.sh ${{ matrix.gpl }}"
# Use delvewheel on windows
CIBW_BEFORE_BUILD_WINDOWS: "pip install delvewheel"
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: >
delvewheel repair -w {dest_dir} {wheel} --add-path "${{ github.workspace }}\install\bin;${{ steps.mingw64-path.outputs.bin }}"
CIBW_ENVIRONMENT_LINUX: >
LD_LIBRARY_PATH="$(pwd)/install/lib64:$LD_LIBRARY_PATH"
CIBW_ENVIRONMENT_MACOS: >
DYLD_LIBRARY_PATH="$(pwd)/install/lib:$DYLD_LIBRARY_PATH"
MACOSX_DEPLOYMENT_TARGET=${{ matrix.macos-target }}
CIBW_ENVIRONMENT_WINDOWS: >
PATH="${{ steps.mingw64-path.outputs.bin }};$PATH"
CIBW_TEST_COMMAND: python {project}/examples/api/python/quickstart.py
CIBW_TEST_SKIP: "cp38-macosx_arm64" # Silence warning. See: https://github.com/pypa/cibuildwheel/pull/1171
# - uses: actions/upload-artifact@v5
# with:
# name: wheels-${{ matrix.name }}
# path: ./wheelhouse/*.whl
- name: Install software for publishing the wheels
run: |
python3 -m pip install -U packaging # See https://github.com/pypa/twine/issues/1216
python3 -m pip install twine
- name: Check wheels with twine
run: |
echo "::group::Check wheels with twine"
for wheel in `ls ./wheelhouse/*.whl`
do
twine check $wheel
done
echo "::endgroup::"
- name: Upload wheels to pypi.org
if: >
github.event_name == 'release' ||
(github.event_name == 'workflow_dispatch' &&
github.event.inputs.deploy_target == 'PyPI' &&
startsWith(github.event.inputs.release_tag, 'cvc5-'))
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
echo "::group::Upload to pypi.org"
for wheel in `ls ./wheelhouse/*.whl`
do
# --skip-existing is only valid when uploading to PyPI
twine upload --skip-existing $wheel
done
echo "::endgroup::"
- name: Upload wheels to test.pypi.org
if: >
github.event_name == 'workflow_dispatch' &&
github.event.inputs.deploy_target == 'Test PyPI'
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
run: |
echo "::group::Upload to test.pypi.org"
for wheel in `ls ./wheelhouse/*.whl`
do
twine upload --repository testpypi $wheel
done
echo "::endgroup::"
|