CI: set allow-prereleases: true
#528
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 Wheels | |
on: | |
push: | |
branches: | |
- main | |
- fix-wheel-build | |
- v* | |
release: | |
types: [created] | |
jobs: | |
build_wheels: | |
name: Build Wheels on ${{ matrix.os }}-${{ matrix.platform_id }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [macos-11, windows-2019] | |
bitness: [32, 64] | |
include: | |
# Run 32 and 64 bit version in parallel for Windows | |
- os: windows-2019 | |
bitness: 64 | |
platform_id: win_amd64 | |
- os: windows-2019 | |
bitness: 32 | |
platform_id: win32 | |
- os: macos-11 | |
bitness: 64 | |
platform_id: macosx_x86_64 | |
exclude: | |
- os: macos-11 | |
bitness: 32 | |
env: | |
CIBW_BUILD: cp38-${{ matrix.platform_id }} cp39-${{ matrix.platform_id }} cp310-${{ matrix.platform_id }} cp311-${{ matrix.platform_id }} cp312-${{ matrix.platform_id }} | |
CIBW_SKIP: pp* cp35* cp36* cp37* | |
CIBW_BEFORE_BUILD_MACOS: "source packing/build_pango_mac.sh" | |
CIBW_BEFORE_BUILD_WINDOWS: "python packing/download_dlls.py" | |
CIBW_ENVIRONMENT_WINDOWS: "PKG_CONFIG_PATH='C:\\cibw\\vendor\\lib\\pkgconfig'" | |
CIBW_ENVIRONMENT_MACOS: "PKG_CONFIG_PATH='/Users/runner/pangobuild/lib/pkgconfig'" | |
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: python packing/inject-dlls.py {wheel} {dest_dir} C:\cibw\vendor\bin | |
CIBW_TEST_REQUIRES: pytest pytest-cov | |
CIBW_TEST_COMMAND: "bash {project}/packing/test_wheels.sh {project}" | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
name: Install Python | |
with: | |
python-version: "3.8" | |
- name: Install cibuildwheel | |
env: | |
event_name: ${{ github.event_name }} | |
continue-on-error: true | |
shell: bash | |
run: | | |
python -m pip install cibuildwheel==2.11.2 | |
echo "$event_name" | |
- name: Build wheels (Windows) | |
if: runner.os == 'windows' | |
run: | | |
$ErrorActionPreference = 'Stop' | |
$env:PATH="$env:PATH;C:\cibw\pkg-config\bin" | |
$env:PKG_CONFIG_PATH="C:\cibw\vendor\lib\pkgconfig" | |
Copy-Item packing/LICENSE.bin . | |
Rename-Item LICENSE.bin LICENSE.win32 | |
python -m cibuildwheel --output-dir wheelhouse | |
- name: Build wheels (Non-Windows) | |
if: runner.os != 'windows' | |
run: | | |
cp packing/LICENSE.bin . | |
python -m cibuildwheel --output-dir wheelhouse | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: ./wheelhouse/*.whl | |
name: wheels-${{ runner.os }}-${{ matrix.platform_id }} | |
test_wheels: | |
name: Test wheels on ${{ matrix.os }}-${{ matrix.platform_id }}-${{ matrix.python-version }} | |
needs: [build_wheels] | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [macos-10.15, windows-2019] | |
architecture: [x86, x64] | |
python-version: ['3.8', '3.9', '3.10', '3.11'] | |
include: | |
- os: windows-2019 | |
architecture: x64 | |
platform_id: win_amd64 | |
- os: windows-2019 | |
architecture: x86 | |
platform_id: win32 | |
- os: macos-10.15 | |
architecture: x64 | |
platform_id: macosx_x86_64 | |
exclude: | |
- os: macos-10.15 | |
architecture: x86 | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
name: Install Python | |
with: | |
python-version: ${{ matrix.python-version }} | |
architecture: ${{ matrix.architecture }} | |
- uses: actions/download-artifact@v3 | |
with: | |
name: wheels-${{ runner.os }}-${{ matrix.platform_id }} | |
path: ~/wheelhouse | |
- name: Install test dependencies | |
run: | | |
pip install pytest pytest-cov | |
- name: Install wheels | |
run: | | |
pip install --no-index --find-links ~/wheelhouse ManimPango | |
- name: Run tests | |
shell: bash | |
run: | | |
bash packing/test_wheels.sh $(pwd) | |
publish_wheels: | |
needs: [test_wheels] | |
name: Upload wheels | |
runs-on: ubuntu-latest | |
if: github.event_name== 'release' | |
steps: | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.9" | |
- uses: actions/download-artifact@v3 | |
with: | |
path: downloads/ | |
- name: Publish release | |
if: github.event_name == 'release' | |
shell: bash | |
env: | |
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | |
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | |
run: | | |
mkdir -p wheelhouse/ | |
find downloads/ -name \*.whl -exec cp {} wheelhouse \; | |
pip install twine | |
twine upload wheelhouse/*.whl | |
build_sdist: | |
name: Source distribution | |
runs-on: ubuntu-latest | |
if: github.event_name== 'release' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.8" | |
- name: Build Source Distribution | |
if: ${{ github.event_name== 'release' && runner.os == 'Linux' }} | |
env: | |
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | |
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | |
run: | | |
sudo apt install libcairo2-dev pkg-config python3-dev | |
sudo apt-get install libpango1.0-dev | |
pip install twine | |
python setup.py sdist | |
twine upload dist/* | |
- name: Store artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
path: dist/*.tar.gz | |
name: manimpango.tar.gz | |
- name: Install Dependency | |
run: pip install requests | |
- name: Get Upload URL | |
id: create_release | |
shell: python | |
env: | |
access_token: ${{ secrets.GITHUB_TOKEN }} | |
tag_act: ${{ github.ref }} | |
run: | | |
import requests | |
import os | |
ref_tag = os.getenv('tag_act').split('/')[-1] | |
access_token = os.getenv('access_token') | |
headers = { | |
"Accept":"application/vnd.github.v3+json", | |
"Authorization": f"token {access_token}" | |
} | |
url = f"https://api.github.com/repos/ManimCommunity/manimpango/releases/tags/{ref_tag}" | |
c = requests.get(url,headers=headers) | |
upload_url=c.json()['upload_url'] | |
with open(os.environ.get("GITHUB_OUTPUT"), "w") as f: | |
print(f"upload_url={upload_url}", file=f) | |
print(f"tag_name={ref_tag[1:]}", file=f) | |
- name: Upload Release Asset | |
id: upload-release | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: dist/ManimPango-${{ steps.create_release.outputs.tag_name }}.tar.gz | |
asset_name: ManimPango-${{ steps.create_release.outputs.tag_name }}.tar.gz | |
asset_content_type: application/gzip | |
success: | |
needs: [test_wheels] | |
runs-on: ubuntu-latest | |
name: Building and testing of wheels success | |
steps: | |
- name: Success | |
run: echo "Building and testing of wheels success" |