Skip to content

Commit

Permalink
Merge pull request #28 from HENNGE/update-lxml-python3.12
Browse files Browse the repository at this point in the history
Support  python 3.12, update lxml to 5.x
  • Loading branch information
FurqanHabibi authored Jun 10, 2024
2 parents b87632e + acaca32 commit a17d470
Show file tree
Hide file tree
Showing 3 changed files with 118 additions and 29 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: minisaml release workflow

on:
release:
types: [released] # only triggered on release, not pre-release or draft release

permissions:
contents: read
id-token: write

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

defaults:
run:
shell: bash

env:
PYTHON_VERSION: 3.12
TARGET_BRANCH: ${{ github.event.release.target_commitish }}
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
TAG_NAME: ${{ github.ref_name }}

jobs:
release:
name: Release to PyPI
runs-on: ubuntu-latest
steps:
- name: Check whether release target branch is default branch
if: env.TARGET_BRANCH != env.DEFAULT_BRANCH
uses: actions/github-script@v7
with:
script: |
core.setFailed('Target branch (${{ env.TARGET_BRANCH }}) is not default branch (${{ env.DEFAULT_BRANCH }}).')
- uses: actions/checkout@v4

- uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}

- run: curl -sSL https://install.python-poetry.org | python3 -

- run: echo "PKG_VER=$(poetry version --short)" >> $GITHUB_ENV

- name: Check whether current tag matches package version
if: env.TAG_NAME != env.PKG_VER
uses: actions/github-script@v7
with:
script: |
core.setFailed('Tag name (${{ env.TAG_NAME }}) does not match package version (${{ env.PKG_VER }}).')
- name: Build package
run: poetry build

- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
80 changes: 55 additions & 25 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,86 +2,116 @@ name: workflow

on: [push, pull_request]

permissions:
actions: write
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

defaults:
run:
shell: bash

env:
PYTHON_VERSIONS: '["3.8", "3.9", "3.10", "3.11", "3.12"]'
POETRY_VERSION: 1.8.3

jobs:
# workaround since matrix can not access `env` but can access `needs`
python-versions:
runs-on: "ubuntu-latest"
outputs:
versions: ${{ steps.set-versions.outputs.versions }}
steps:
- id: set-versions
run: echo "versions=$PYTHON_VERSIONS" >> $GITHUB_OUTPUT

lock:
needs: python-versions
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10"]
python-version: ${{ fromJSON(needs.python-versions.outputs.versions) }}
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- run: curl -sSL https://install.python-poetry.org | python3 -
- run: poetry lock
- uses: actions/cache@v2
- uses: actions/cache@v4
with:
path: poetry.lock
key: ${{ github.sha }}-${{ matrix.python-version }}

pytest:
needs: lock
needs: [lock, python-versions]
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10"]
python-version: ${{ fromJSON(needs.python-versions.outputs.versions) }}
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: actions/cache@v2
- uses: actions/cache@v4
with:
path: poetry.lock
key: ${{ github.sha }}-${{ matrix.python-version }}
- run: curl -sSL https://install.python-poetry.org | python3 -
- run: poetry install
- run: poetry run pytest --verbose

mypy:
needs: lock
needs: [lock, python-versions]
strategy:
matrix:
python-version: ["3.7", "3.8", "3.9", "3.10"]
python-version: ${{ fromJSON(needs.python-versions.outputs.versions) }}
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- uses: actions/cache@v2
- uses: actions/cache@v4
with:
path: poetry.lock
key: ${{ github.sha }}-${{ matrix.python-version }}
- run: curl -sSL https://install.python-poetry.org | python3 -
- run: poetry install
- run: poetry run mypy

isort:
needs: lock
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10"
- uses: actions/cache@v2
python-version: "3.12"
- uses: actions/cache@v4
with:
path: poetry.lock
key: ${{ github.sha }}-3.10
key: ${{ github.sha }}-3.12
- run: curl -sSL https://install.python-poetry.org | python3 -
- run: poetry install
- run: poetry run isort --check --diff src tests

black:
needs: lock
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10"
- uses: actions/cache@v2
python-version: "3.12"
- uses: actions/cache@v4
with:
path: poetry.lock
key: ${{ github.sha }}-3.10
key: ${{ github.sha }}-3.12
- run: curl -sSL https://install.python-poetry.org | python3 -
- run: poetry install
- run: poetry run black --check src/ tests/
- run: poetry run black --check src/ tests/
9 changes: 5 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,19 @@ classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3 :: Only",
"Typing :: Typed"
]

[tool.poetry.dependencies]
python = "^3.7"
minisignxml = ">=22.4"
lxml = "^4.9"
python = "^3.8"
minisignxml = ">=24.6"
lxml = "^5.0"
yarl = ">=1.4.2"
# poetry doesn't support extras in dev-dependencies, so these must be here as optional dependencies
Sphinx = { version = "^5", optional = true }
Expand Down

0 comments on commit a17d470

Please sign in to comment.