Test with Pylint 3 and Python 3.12 #21
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: CI and release pipeline | |
on: | |
pull_request: | |
push: | |
branches: ["main", "develop"] | |
tags: ["*"] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python-version: ["3.7", "3.8", "3.9", "3.10", "pypy3.8", "pypy3.9", "pypy3.10"] | |
pylint-version: ["~=2.14.0"] | |
include: | |
- python-version: "3.11" | |
pylint-version: "~=2.17.7" | |
- python-version: "3.12" | |
pylint-version: "~=3.0.2" | |
- python-version: "3.12" | |
pylint-version: "" | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/[email protected] | |
with: | |
python-version: ${{ matrix.python-version }} | |
- uses: actions/[email protected] | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip | |
- uses: actions/[email protected] | |
with: | |
path: .venv | |
key: ${{ runner.os }}-py${{ matrix.python-version }}-pylint${{ matrix.pylint-version }}-venv-${{ hashFiles('pyproject.toml') }} | |
restore-keys: | | |
${{ runner.os }}-py${{ matrix.python-version }}-pylint${{ matrix.pylint-version }}-venv- | |
${{ runner.os }}-py${{ matrix.python-version }}-pylint | |
- name: Install poetry | |
run: pip install poetry | |
- name: Install dependencies | |
run: poetry install | |
env: | |
POETRY_VIRTUALENVS_IN_PROJECT: true | |
- name: Install pylint ${{ matrix.pylint-version }} | |
run: poetry run pip install pylint${{ matrix.pylint-version }} | |
- name: Run test | |
run: poetry run test/test.sh | |
release: | |
runs-on: ubuntu-latest | |
needs: [test] | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/[email protected] | |
with: | |
python-version: '3.12' | |
- uses: actions/[email protected] | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip | |
- name: Install poetry | |
run: pip install poetry | |
- name: Publish to PyPI | |
run: poetry publish --build | |
env: | |
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_TOKEN }} | |
- name: Set version | |
id: version | |
run: echo "version=${GITHUB_REF#refs/*/v}" >> $GITHUB_OUTPUT | |
- name: Extract changelog | |
id: changelog | |
run: sed -E -n '/^## \[${{ steps.version.outputs.version }}\]/,/^## \[[0-9\.]+\]/{/^\[[0-9\.]+\]/!p;}' CHANGES.md | sed '1d;$d' > release-body-raw.md | |
- uses: docker://pandoc/core:2.10 | |
with: | |
args: --wrap none --from markdown --to gfm+hard_line_breaks --output release-body.md release-body-raw.md | |
- name: Create GitHub release | |
uses: softprops/action-gh-release@v1 | |
with: | |
body_path: release-body.md | |
tag_name: v${{ steps.version.outputs.version }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |