Add shape.boolean method with tests #345
8000
Workflow file for this run
This file contains hidden or 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
# Workflow label | |
name: CI | |
# Workflow trigger | |
on: [push, pull_request] | |
# Cancel previous runs on new push | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
# Workflow tasks | |
jobs: | |
# Apply lint, check formatting | |
lint: | |
name: "Lint (Python ${{ matrix.python-version }})" | |
runs-on: windows-latest | |
strategy: | |
matrix: | |
python-version: ["3.10", "3.11", "3.12", "3.13"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Cache Python dependencies | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('pyproject.toml') }} | |
- name: Install Python requirements | |
run: | | |
pip install --upgrade pip | |
pip install --upgrade --upgrade-strategy eager .[dev] | |
pip install flake8 | |
- name: Lint with flake8 | |
run: | | |
# Stop the build if there are Python syntax errors or undefined names | |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
# Exit-zero treats all errors as warnings. Use same line length as .flake8 config | |
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
- name: Cancelling pipeline (failed) | |
if: failure() | |
uses: andymckay/cancel-action@0.5 | |
- name: Check formatting with black | |
run: black --check . | |
# Execute pytest to check PyonFX's functionalities | |
test: | |
name: "Test (${{matrix.os}}, Python ${{ matrix.python-version }})" | |
runs-on: ${{matrix.os}} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
python-version: ["3.10", "3.11", "3.12", "3.13"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install platform-specific requirements (Ubuntu) | |
if: matrix.os == 'ubuntu-latest' | |
run: | | |
sudo apt-get update | |
sudo apt-get install libgirepository-2.0-dev gobject-introspection libcairo2-dev python3-dev build-essential gir1.2-gtk-3.0 python3-gi python3-gi-cairo | |
- name: Install platform-specific requirements (macOS) | |
if: matrix.os == 'macos-latest' | |
run: brew install python py3cairo pygobject3 pango cairo glib | |
- name: Set DYLD_FALLBACK_LIBRARY_PATH for Homebrew (macOS) | |
if: matrix.os == 'macos-latest' | |
run: echo "DYLD_FALLBACK_LIBRARY_PATH=$(brew --prefix)/lib" >> $GITHUB_ENV | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.22' | |
- name: Install fonts (non-Windows) | |
if: matrix.os != 'windows-latest' | |
run: | | |
go install github.com/Crosse/font-install@latest | |
font-install "https://github.com/itouhiro/mixfont-mplus-ipa/releases/download/v2020.0307/migu-1p-20200307.zip" | |
shell: bash | |
- name: Install fonts (Windows) | |
if: matrix.os == 'windows-latest' | |
run: ./.github/scripts/install-fonts.ps1 'https://github.com/itouhiro/mixfont-mplus-ipa/releases/download/v2020.0307/migu-1p-20200307.zip' | |
shell: pwsh | |
- name: Cache Python dependencies | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pip | |
key: ${{ matrix.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('pyproject.toml') }} | |
- name: Install Python requirements | |
run: pip install --upgrade pip && pip install --upgrade --upgrade-strategy eager .[dev] | |
- name: Test with pytest | |
run: PANGOCAIRO_BACKEND=fc pytest -v | |
shell: bash | |
# Build the package and publish it on PyPi | |
build-n-publish: | |
needs: [lint, test] | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') | |
name: "Build and publish distributions to PyPI and TestPyPI" | |
runs-on: ubuntu-latest | |
environment: | 3022|
name: pypi | |
url: https://pypi.org/p/pyonfx | |
permissions: | |
id-token: write # Trusted publishing | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3.13 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.13 | |
- name: Install build dependencies | |
run: | | |
pip install --upgrade pip | |
pip install build twine | |
- name: Build package | |
run: python -m build | |
- name: Check distribution | |
run: twine check dist/* | |
- name: Publish distribution 📦 to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 |