Packaging - Use setup.py instead pyproject.toml, temporary #238
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: π§ͺ Tests | |
on: | |
push: | |
tags: "*" | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
jobs: | |
tests: | |
name: "π³ Tests" | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python: [ | |
"3.7", | |
"3.8", | |
"3.9", | |
"3.10", | |
"3.11", | |
"3.12", | |
] | |
steps: | |
- name: Get source code | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python }} | |
- name: Upgrade PIP | |
run: pip install --upgrade pip | |
- name: Run tests | |
working-directory: test | |
run: | | |
export PYTHONPATH="${{ github.workspace }}" | |
python -m unittest | |
ruff: | |
name: "β Ruff" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
- name: Upgrade PIP | |
run: pip install --upgrade pip | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Python requirements | |
run: pip install -r requirements-dev.txt | |
- name: Run Ruff | |
run: make lint | |
release: | |
name: "π Release" | |
runs-on: ubuntu-20.04 | |
needs: [tests, ruff] | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
steps: | |
- name: Set env | |
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | |
- name: Get source code | |
uses: actions/checkout@v4 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.10" | |
- name: Upgrade PIP | |
run: pip install --upgrade pip | |
- name: Setup | |
run: | | |
VERSION=${GITHUB_REF:-0.0.0} | |
VERSION=${VERSION##*/} | |
sed -i "s/__VERSION__/${VERSION}/g" setup.py | |
sed -i "s/__VERSION__/${VERSION}/g" pyproject.toml | |
sed -i "s/__VERSION__/${VERSION}/g" qgis_plugin_manager/__about__.py | |
- name: Use setup.py instead of pyproject.toml | |
# Temporary, until the migration is done | |
run: rm pyproject.toml | |
- name: Read the changelog | |
id: changelog | |
uses: 3liz/[email protected] | |
- name: Build package | |
run: | | |
python setup.py sdist | |
- name: Create release on GitHub | |
uses: ncipollo/[email protected] | |
with: | |
body: ${{ steps.changelog.outputs.markdown }} | |
token: ${{ secrets.BOT_HUB_TOKEN }} | |
allowUpdates: true | |
artifacts: "dist/*.tar.gz" | |
- name: Deploy to PyPI | |
uses: pypa/gh-action-pypi-publish@master | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} |