11name : Build
22
33on :
4+ release :
5+ types : [published]
46 push :
57 branches :
68 - master
79 - ci
810 pull_request :
911 branches :
10- - ' * '
12+ - " * "
1113
1214env :
1315 PROJECT_NAME : essentials
@@ -17,56 +19,83 @@ jobs:
1719 runs-on : ubuntu-18.04
1820 strategy :
1921 matrix :
20- python-version : [3.7, 3.8]
22+ python-version : [3.6, 3. 7, 3.8, 3.9 ]
2123
2224 steps :
23- - uses : actions/checkout@v1
24- with :
25- fetch-depth : 9
26- submodules : false
25+ - uses : actions/checkout@v1
26+ with :
27+ fetch-depth : 9
28+ submodules : false
2729
28- - name : Use Python ${{ matrix.python-version }}
29- uses : actions/setup-python@v1
30- with :
31- python-version : ${{ matrix.python-version }}
30+ - name : Use Python ${{ matrix.python-version }}
31+ uses : actions/setup-python@v1
32+ with :
33+ python-version : ${{ matrix.python-version }}
3234
33- - uses : actions/cache@v1
34- id : depcache
35- with :
36- path : deps
37- key : requirements-pip-${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }}
35+ - uses : actions/cache@v1
36+ id : depcache
37+ with :
38+ path : deps
39+ key : requirements-pip-${{ matrix.python-version }}-${{ hashFiles('requirements.txt') }}
3840
39- - name : Download dependencies
40- if : steps.depcache.outputs.cache-hit != 'true'
41- run : |
42- pip download --dest=deps -r requirements.txt
41+ - name : Download dependencies
42+ if : steps.depcache.outputs.cache-hit != 'true'
43+ run : |
44+ pip download --dest=deps -r requirements.txt
4345
44- - name : Install dependencies
45- run : |
46- pip install -U --no-index --find-links=deps deps/*
46+ - name : Install dependencies
47+ run : |
48+ pip install -U --no-index --find-links=deps deps/*
4749
48- - name : Run tests
49- run : |
50- flake8 && pytest --doctest-modules --junitxml=junit/pytest-results-${{ matrix.python-version }}.xml --cov=$PROJECT_NAME --cov-report=xml tests/
50+ - name : Run tests
51+ run : |
52+ flake8 && pytest --doctest-modules --junitxml=junit/pytest-results-${{ matrix.python-version }}.xml --cov=$PROJECT_NAME --cov-report=xml tests/
5153
52- - name : Upload pytest test results
53- uses : actions/upload-artifact@master
54- with :
55- name : pytest-results-${{ matrix.python-version }}
56- path : junit/pytest-results-${{ matrix.python-version }}.xml
57- if : always()
54+ - name : Upload pytest test results
55+ uses : actions/upload-artifact@master
56+ with :
57+ name : pytest-results-${{ matrix.python-version }}
58+ path : junit/pytest-results-${{ matrix.python-version }}.xml
59+ if : always()
5860
59- - name : Install distribution dependencies
60- run : pip install --upgrade twine setuptools wheel
61- if : matrix.python-version == 3.8
61+ - name : Codecov
62+ run : |
63+ bash <(curl -s https://codecov.io/bash)
6264
63- - name : Create distribution package
64- run : python setup.py sdist bdist_wheel
65- if : matrix.python-version == 3.8
65+ - name : Install distribution dependencies
66+ run : pip install --upgrade twine setuptools wheel
67+ if : matrix.python-version == 3.8 || matrix.python-version == 3.9
6668
67- - name : Upload distribution package
68- uses : actions/upload-artifact@master
69- with :
70- name : dist-package-${{ matrix.python-version }}
71- path : dist
72- if : matrix.python-version == 3.8
69+ - name : Create distribution package
70+ run : python setup.py sdist bdist_wheel
71+ if : matrix.python-version == 3.8 || matrix.python-version == 3.9
72+
73+ - name : Upload distribution package
74+ uses : actions/upload-artifact@master
75+ with :
76+ name : dist-package-${{ matrix.python-version }}
77+ path : dist
78+ if : matrix.python-version == 3.8 || matrix.python-version == 3.9
79+
80+ publish :
81+ runs-on : ubuntu-18.04
82+ needs : build
83+ if : github.event_name == 'release'
84+ steps :
85+ - name : Download a distribution artifact
86+ uses : actions/download-artifact@v2
87+ with :
88+ name : dist-package-3.9
89+ path : dist
90+ - name : Publish distribution 📦 to Test PyPI
91+ uses : pypa/gh-action-pypi-publish@master
92+ with :
93+ skip_existing : true
94+ user : __token__
95+ password : ${{ secrets.test_pypi_password }}
96+ repository_url : https://test.pypi.org/legacy/
97+ - name : Publish distribution 📦 to PyPI
98+ uses : pypa/gh-action-pypi-publish@master
99+ with :
100+ user : __token__
101+ password : ${{ secrets.pypi_password }}
0 commit comments