1.0.0 #17
Workflow file for this run
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: Publish denonavr on PyPI | |
on: | |
release: | |
types: [published] | |
permissions: | |
contents: read | |
jobs: | |
verify: | |
runs-on: ubuntu-22.04 | |
name: Verify Python build context | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
- name: Verify version | |
run: | | |
python -m pip install setuptools | |
setup_version="$(python -c 'import tomllib; print(tomllib.load(open("pyproject.toml", "rb"))["project"]["version"])')" | |
branch_version=$(echo "${{ github.ref }}" | awk -F"/" '{print $NF}' ) | |
if [ "${setup_version}" == "${branch_version}" ]; then | |
echo "Version of tag ${branch_version} matches with version of pyproject.toml ${setup_version}" | |
else | |
echo "Version of tag ${branch_version} doesn't match with version of pyproject.toml ${setup_version}" | |
exit 1 | |
fi | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
if [ -f test-requirements.txt ]; then pip install -r test-requirements.txt; fi | |
- name: Analysing the code with pylint | |
run: | | |
python -m pylint denonavr tests | |
- name: Lint with flake8 | |
run: | | |
python -m flake8 denonavr tests --count --show-source --statistics | |
- name: Check code formatting with isort | |
run: | | |
python -m isort denonavr/. tests/. --check --verbose | |
- name: Check code formatting with black | |
run: | | |
python -m black denonavr tests --check --verbose | |
- name: Integration test with pytest | |
run: | | |
python -m pytest tests --timeout=60 --durations=10 | |
build: | |
name: Build and publish PyPi package | |
needs: verify | |
runs-on: ubuntu-22.04 | |
if: github.repository_owner == 'ol-iver' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install --upgrade build | |
- name: Build package | |
run: python -m build | |
- name: Publish package | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ secrets.PYPI_API_TOKEN }} |