Skip to content

Commit

Permalink
Fix and update GitHub Actions + Add publish action (#33)
Browse files Browse the repository at this point in the history
* Update GitHub Actions and add publish action

* Added setuptools

* Fix publish action
  • Loading branch information
leifgehrmann authored Jun 25, 2024
1 parent ff494c0 commit e1ab8d0
Show file tree
Hide file tree
Showing 6 changed files with 81 additions and 31 deletions.
36 changes: 7 additions & 29 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,41 +5,19 @@ on:
pull_request:

jobs:
build:
runs-on: ${{matrix.os}}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
sdist:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
python-version: "3.12"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox tox-gh-actions
- name: Install System Dependencies (macOS)
if: runner.os == 'macOS'
pip install -r requirements.txt
- name: Create sdist
run: |
brew install pkg-config
brew install libffi
brew install pango
brew install glib
# https://github.com/Kozea/CairoSVG/issues/354#issuecomment-1160552256
sudo ln -s /opt/homebrew/lib/libcairo* .
sudo ln -s /opt/homebrew/lib/libpango* .
sudo ln -s /opt/homebrew/lib/libgobject* .
sudo ln -s /opt/homebrew/lib/libglib* .
- name: Install System Dependencies (Windows)
if: runner.os == 'windows'
run: |
C:\msys64\usr\bin\bash -lc 'pacman -S mingw-w64-x86_64-ttf-dejavu mingw-w64-x86_64-gtk3 --noconfirm'
xcopy "C:\msys64\mingw64\share\fonts\TTF" "C:\Users\runneradmin\.fonts" /e /i
echo "C:\msys64\mingw64\bin" | Out-File -FilePath $env:GITHUB_PATH
rm C:\msys64\mingw64\bin\python.exe
- name: Test with tox
run: tox
python setup.py sdist
2 changes: 1 addition & 1 deletion .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
pull_request:

jobs:
build:
coverage:
runs-on: ubuntu-latest

steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
pull_request:

jobs:
build:
lint:
runs-on: ubuntu-latest

steps:
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Publish

on:
workflow_dispatch:

jobs:
pypi-publish:
runs-on: ubuntu-latest
environment: release
permissions:
id-token: write
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.12"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Create dist
run: |
python setup.py sdist
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
45 changes: 45 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Test

on:
push:
pull_request:

jobs:
tox:
runs-on: ${{matrix.os}}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install tox tox-gh-actions
- name: Install System Dependencies (macOS)
if: runner.os == 'macOS'
run: |
brew install pkg-config
brew install libffi
brew install pango
brew install glib
# https://github.com/Kozea/CairoSVG/issues/354#issuecomment-1160552256
sudo ln -s /opt/homebrew/lib/libcairo* .
sudo ln -s /opt/homebrew/lib/libpango* .
sudo ln -s /opt/homebrew/lib/libgobject* .
sudo ln -s /opt/homebrew/lib/libglib* .
- name: Install System Dependencies (Windows)
if: runner.os == 'windows'
run: |
C:\msys64\usr\bin\bash -lc 'pacman -S mingw-w64-x86_64-ttf-dejavu mingw-w64-x86_64-gtk3 --noconfirm'
xcopy "C:\msys64\mingw64\share\fonts\TTF" "C:\Users\runneradmin\.fonts" /e /i
echo "C:\msys64\mingw64\bin" | Out-File -FilePath $env:GITHUB_PATH
rm C:\msys64\mingw64\bin\python.exe
- name: Test with tox
run: tox
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ pangocffi >= 0.11.0
flake8
coverage
pytest
setuptools

0 comments on commit e1ab8d0

Please sign in to comment.