Skip to content

Commit 517dfc7

Browse files
author
Andrea Bonomi
committed
Github workflows
1 parent 44ed77b commit 517dfc7

File tree

5 files changed

+152
-1
lines changed

5 files changed

+152
-1
lines changed

.github/workflows/release.yml

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: Releases
2+
3+
on:
4+
push:
5+
tags:
6+
- v*
7+
8+
jobs:
9+
10+
wait:
11+
name: Wait for tests
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: fountainhead/action-wait-for-check@v1.0.0
16+
id: wait-for-tests
17+
with:
18+
token: ${{ secrets.GITHUB_TOKEN }}
19+
checkName: Tests done
20+
ref: ${{ github.sha }}
21+
timeoutSeconds: 3600
22+
23+
- name: Fail the Build
24+
uses: cutenode/action-always-fail@v1
25+
if: steps.wait-for-tests.outputs.conclusion != 'success'
26+
27+
build:
28+
name: Build package
29+
runs-on: ubuntu-latest
30+
needs: [wait]
31+
32+
strategy:
33+
matrix:
34+
python-version: ['3.9']
35+
36+
steps:
37+
- name: Checkout code
38+
uses: actions/checkout@v2
39+
40+
- name: Set up Python ${{ matrix.python-version }}
41+
uses: actions/setup-python@v2
42+
with:
43+
python-version: ${{ matrix.python-version }}
44+
45+
- name: Cache pip
46+
uses: actions/cache@v2
47+
with:
48+
path: ~/.cache/pip
49+
key: ${{ runner.os }}-python-${{ matrix.python }}-pip-${{ hashFiles('**/requirements*.txt') }}-git-${{ github.sha }}
50+
restore-keys: |
51+
${{ runner.os }}-python-${{ matrix.python }}-pip-${{ hashFiles('**/requirements*.txt') }}
52+
${{ runner.os }}-python-${{ matrix.python }}-pip-
53+
${{ runner.os }}-python
54+
${{ runner.os }}-
55+
56+
- name: Upgrade pip and install dependencies
57+
run: |
58+
python -m pip install --upgrade pip
59+
python -m pip install --upgrade setuptools wheel
60+
python -m pip install -r requirements.txt
61+
python -m pip install -r requirements-dev.txt
62+
63+
- name: Build package
64+
run: python setup.py bdist_wheel sdist
65+
66+
- name: Check package
67+
run: twine check dist/*
68+
69+
- name: Publish package
70+
env:
71+
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
72+
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
73+
run: |
74+
twine upload --skip-existing dist/*
75+
76+
release:
77+
name: Release version
78+
runs-on: ubuntu-latest
79+
needs: [wait, build]
80+
81+
steps:
82+
- name: Create release
83+
id: create_release
84+
uses: actions/create-release@v1
85+
env:
86+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
87+
with:
88+
tag_name: ${{ github.ref }}
89+
release_name: ${{ github.ref }}
90+
draft: false
91+
prerelease: false

.github/workflows/tests.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
jobs:
8+
tests:
9+
name: Run tests (Python ${{matrix.python}}
10+
11+
strategy:
12+
matrix:
13+
python:
14+
- "3.6"
15+
- "3.7"
16+
- "3.8"
17+
- "3.9"
18+
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v2
24+
25+
- name: Set up Python
26+
uses: actions/setup-python@v2
27+
with:
28+
python-version: ${{ matrix.python }}
29+
30+
- name: Cache pip
31+
uses: actions/cache@v2
32+
with:
33+
path: ~/.cache/pip
34+
key: ${{ runner.os }}-python-${{ matrix.python }}-pip-${{ hashFiles('**/requirements*.txt') }}-git-${{ github.sha }}
35+
restore-keys: |
36+
${{ runner.os }}-python-${{ matrix.python }}-pip-${{ hashFiles('**/requirements*.txt') }}
37+
${{ runner.os }}-python-${{ matrix.python }}-pip-
38+
${{ runner.os }}-python-${{ matrix.python }}-
39+
${{ runner.os }}-python
40+
${{ runner.os }}-
41+
42+
- name: Upgrade pip and install dependencies
43+
run: |
44+
python -m pip install --upgrade pip
45+
python -m pip install --upgrade setuptools wheel
46+
python -m pip install -r requirements.txt
47+
48+
- name: Run tests
49+
run: python setup.py test
50+
51+
all_done:
52+
name: Tests done
53+
runs-on: ubuntu-latest
54+
needs: [tests]
55+
56+
steps:
57+
- name: All done
58+
run: echo 1

changelog.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,4 +103,5 @@
103103
### Improved
104104

105105
- refactoring
106-
106+
- Python 3.9 support
107+
- Github workfows

requirements-dev.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@ mypy
44
sphinx
55
tox
66
black
7+
twine<3.4

requirements.txt

Whitespace-only changes.

0 commit comments

Comments
 (0)