Include tests/cases
in sdist
#558
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: | |
include: | |
# Run 32 and 64 bit version in parallel for Windows | |
- os: windows-2022 | |
platform_id: win_amd64 | |
architecture: x64 | |
- os: windows-2022 | |
platform_id: win32 | |
architecture: x86 | |
- os: macos-13 | |
platform_id: macosx_x86_64 | |
architecture: x64 | |
- os: macos-14 | |
platform_id: macosx_arm64 | |
architecture: arm64 | |
env: | |
CIBW_BUILD: cp39-${{ matrix.platform_id }} cp310-${{ matrix.platform_id }} cp311-${{ matrix.platform_id }} cp312-${{ matrix.platform_id }} cp313-${{ matrix.platform_id }} | |
CIBW_SKIP: pp* cp36* cp37* cp38* | |
CIBW_BEFORE_BUILD_MACOS: "python packing/download_pango_macos.py ${{ matrix.architecture }}" | |
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_TEST_REQUIRES: pytest pytest-cov | |
CIBW_TEST_COMMAND: "bash {project}/packing/test_wheels.sh {project}" | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set Path for pkg-config | |
if: runner.os == 'windows' | |
run: | | |
$env:Path = "C:\cibw\pkg-config\bin;C:\cibw\vendor\bin;$($env:PATH)" | |
echo "$env:Path" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append | |
- name: Build wheels (Windows) | |
if: runner.os == 'windows' | |
shell: pwsh | |
run: | | |
Copy-Item packing/LICENSE.bin . | |
Rename-Item LICENSE.bin LICENSE.win32 | |
- name: Build wheels (Non-Windows) | |
if: runner.os != 'windows' | |
run: | | |
cp packing/LICENSE.bin . | |
- name: Build wheels | |
uses: pypa/[email protected] | |
env: | |
PKG_CONFIG_PATH: "C:\\cibw\\vendor\\lib\\pkgconfig" | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: ./wheelhouse/*.whl | |
name: wheels-${{ runner.os }}-${{ matrix.platform_id }} | |
test_wheels_win: | |
name: Test wheels on Windows - ${{ matrix.platform_id }} (${{ matrix.python-version }}) | |
needs: [build_wheels] | |
runs-on: windows-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
architecture: [x64, x86] | |
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13'] | |
include: [ | |
{platform_id: win_amd64, architecture: x64}, | |
{platform_id: win32, architecture: x86}, | |
] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
name: Install Python | |
with: | |
python-version: ${{ matrix.python-version }} | |
architecture: ${{ matrix.architecture }} | |
allow-prereleases: true | |
- 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) | |
test_wheels_mac: | |
name: Test wheels on macOS - ${{ matrix.platform_id }} (${{ matrix.python-version }}) | |
needs: [build_wheels] | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
architecture: [x64, arm64] | |
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13'] | |
include: [ | |
{platform_id: macosx_x86_64, architecture: x64, os: macos-13}, | |
{platform_id: macosx_arm64, architecture: arm64, os: macos-14}, | |
] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
name: Install Python | |
with: | |
python-version: ${{ matrix.python-version }} | |
architecture: ${{ matrix.architecture == 'arm64' && null || matrix.architecture }} | |
allow-prereleases: true | |
- 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_mac, test_wheels_win] | |
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@v4 | |
- 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_win, test_wheels_mac] | |
runs-on: ubuntu-latest | |
name: Building and testing of wheels success | |
steps: | |
- name: Success | |
run: echo "Building and testing of wheels success" |