- Drop python 3.6 and 3.7 and add python 3.11 and 3.12. #13
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, Test and Publish | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- "[0-9]+.[0-9]+.[0-9]+" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
container: | |
image: quay.io/pypa/manylinux_2_28_x86_64:latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install dependencies | |
run: | | |
dnf makecache --refresh | |
dnf -y install swig | |
- name: Build wheel files | |
run: | | |
git submodule update --init xsd/pageformat | |
git submodule update --init py-pagexml/lxml | |
cd py-pagexml | |
for ver in cp38-cp38 cp39-cp39 cp310-cp310 cp311-cp311 cp312-cp312; do | |
echo "=== Building wheel for $(/opt/python/$ver/bin/python3 --version) ===" | |
/opt/python/$ver/bin/pip3 install pkgconfig | |
/opt/python/$ver/bin/python3 setup.py bdist_wheel --slim | |
auditwheel repair dist/*$ver-linux_x86_64.whl -w dist | |
rm dist/*$ver-linux_x86_64.whl | |
done | |
mv dist ../wheels | |
- uses: actions/upload-artifact@v2 | |
with: | |
name: wheels | |
path: wheels | |
unittest: | |
needs: build | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python: ["3.8", "3.9", "3.10", "3.11", "3.12"] | |
steps: | |
- name: Setup Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python }} | |
- uses: actions/download-artifact@v2 | |
with: | |
name: wheels | |
- name: Install package | |
run: | | |
py=$(python3 --version | sed -r 's|Python 3\.([0-9]+)\..*|3\1|') | |
pip3 install *-cp$py-*.whl | |
- name: Run unit tests | |
run: python3 -m pagexml_tests | |
publish-pypi: | |
needs: unittest | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/') | |
steps: | |
- uses: actions/download-artifact@v2 | |
with: | |
name: wheels | |
- name: Prepare wheel files | |
run: | | |
mkdir dist | |
mv *.whl dist | |
- name: Publish to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} |