Skip to content

v0.3.1

v0.3.1 #1280

Workflow file for this run

name: Tests and release
on:
pull_request:
workflow_dispatch:
push:
branches:
- main
tags:
- "v*"
release:
types: [published]
jobs:
version:
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
steps:
- name: Checkout main branch
uses: actions/checkout@v3
with:
ref: 'main'
ssh-key: ${{ secrets.SSH_KEY }}
- name: Set version
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Update version
run: python scripts/update_version.py ${{ env.RELEASE_VERSION }}
- name: Auto-commit changes
uses: stefanzweifel/git-auto-commit-action@49620cd3ed21ee620a48530e81dba0d139c9cb80
with:
commit_message: Bump version to ${{ env.RELEASE_VERSION }}
create_branch: true
branch: release-${{ env.RELEASE_VERSION }}
- name: Merge changes to main
run: |
git checkout "main"
git merge "release-${{ env.RELEASE_VERSION }}" --no-edit
git push
test:
runs-on: ubuntu-latest
if: ${{ always() }}
needs: [version]
steps:
- uses: actions/checkout@v2
- name: Markdown Linter
uses: docker://avtodev/markdown-lint:v1
with:
args: README.md CONTRIBUTING.md docs
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest tox cairo-lang
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with tox and pytest
run: |
tox
dist:
runs-on: ubuntu-latest
needs: [test]
name: Python sdist/wheel
steps:
- uses: actions/checkout@v1
- uses: actions/setup-python@v2
with:
python-version: "3.8"
- run: python -m pip install -U setuptools
- run: python -m pip install -e .[testing]
- name: Build package
run: tox -e build
- uses: actions/upload-artifact@v2
with:
name: dist
path: dist
dist_upload:
runs-on: ubuntu-latest
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
needs: [dist]
name: Upload to PyPi
steps:
- uses: actions/download-artifact@v2
with:
name: dist
path: dist
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.pypi_token }}