Skip to content

Add Go version

Add Go version #165

Workflow file for this run

# Workflow label
name: CI
# Workflow trigger
on: [push, pull_request]
# Workflow tasks
jobs:
# Apply lint, check formatting
lint:
name: "Lint (Python ${{ matrix.python-version }})"
runs-on: windows-latest
strategy:
matrix:
python-version: ['3.9', '3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Cache Python
uses: actions/cache@v2
with:
path: ${{ env.pythonLocation }}
key: ${{matrix.os}}-${{matrix.python-version}}-${{ hashFiles('setup.py') }}-${{ hashFiles('requirements.txt') }}
- name: Install Python requirements
run: |
pip install --upgrade --upgrade-strategy eager .[dev]
pip install flake8
- name: Lint with flake8
run: |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Cancelling pipeline (failed)
if: failure()
uses: andymckay/cancel-action@0.2
- 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.9', '3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
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 libgirepository1.0-dev gcc libcairo2-dev pkg-config python3-dev gir1.2-gtk-3.0 python3-gi python3-gi-cairo
- name: Install platform-specific requirements (macOS) # Note: brew is very slow sometimes. TODO: speedup brew by using caching.
if: matrix.os == 'macos-latest'
run: brew install python py3cairo pygobject3 pango
- 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://osdn.net/frs/redir.php?m=gigenet&f=mix-mplus-ipa%2F58720%2Fmigu-1p-20130430.zip"
shell: bash
- name: Install fonts (Windows)
if: matrix.os == 'windows-latest'
run: ./.github/scripts/install-fonts.ps1 'https://osdn.net/frs/redir.php?m=gigenet&f=mix-mplus-ipa%2F58720%2Fmigu-1p-20130430.zip'
shell: pwsh
- name: Cache Python
uses: actions/cache@v2
with:
path: ${{ env.pythonLocation }}
key: ${{matrix.os}}-${{matrix.python-version}}-${{ hashFiles('setup.py') }}-${{ hashFiles('requirements.txt') }}
- name: Install Python requirements
run: pip install --upgrade --upgrade-strategy eager .[dev]
- name: Test
run: PANGOCAIRO_BACKEND=fc pytest
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
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.12
uses: actions/setup-python@v2
with:
python-version: 3.12
- name: Install pypa/build
run: >-
python -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
.
- name: Publish distribution 📦 to Test PyPI
uses: pypa/gh-action-pypi-publish@release/v1.9
with:
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository-url: https://test.pypi.org/legacy/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1.9
with:
password: ${{ secrets.PYPI_API_TOKEN }}