-
Notifications
You must be signed in to change notification settings - Fork 376
101 lines (96 loc) · 2.91 KB
/
python-app.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
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 }}