11name : Python package
22
3- on : [push]
3+ on :
4+ push :
5+ branches-ignore :
6+ - ' dependabot/**'
7+ pull_request : {}
48
59jobs :
610 PEP8 :
11+ name : Check with Ruff
712 runs-on : ubuntu-latest
813 steps :
9- - uses : actions/checkout@v3.5.2
14+ - uses : actions/checkout@v3
1015 - name : Set up Python
11- uses : actions/setup-python@v4.6.1
16+ uses : actions/setup-python@v4
1217 with :
1318 python-version : ' 3.x'
1419 - name : Install dependencies
1520 run : |
1621 python -m pip install --upgrade pip
17- pip install --upgrade -r flake8_requirements.txt
18- - name : Lint with flake8
22+ pip install --upgrade ruff
23+ - name : Lint with ruff
1924 run : |
20- flake8 exec_helpers
25+ ruff . --format github
2126
2227 PyLint :
2328 runs-on : ubuntu-latest
2429 steps :
25- - uses : actions/checkout@v3.5.2
30+ - uses : actions/checkout@v3
2631 - name : Set up Python
27- uses : actions/setup-python@v4.6.1
32+ uses : actions/setup-python@v4
2833 with :
29- python-version : ' 3.7 '
34+ python-version : ' 3.8 '
3035 - name : Install dependencies
3136 run : |
3237 python -m pip install --upgrade pip
3338 pip install --upgrade -r CI_REQUIREMENTS.txt
34- pip install --upgrade "pylint >= 2.6.0"
35- - name : Generate version file
39+ pip install --upgrade "pylint >= 2.6.0" perflint
40+ - name : Install develop
3641 run : |
37- python setup.py --version clean
42+ pip install -e .
3843 - name : Lint with PyLint
3944 run : |
4045 pylint exec_helpers
4146
4247 MyPy :
4348 runs-on : ubuntu-latest
4449 steps :
45- - uses : actions/checkout@v3.5.2
50+ - uses : actions/checkout@v3
4651 - name : Set up Python
47- uses : actions/setup-python@v4.6.1
52+ uses : actions/setup-python@v4
4853 with :
4954 python-version : ' 3.x'
5055 - name : Install dependencies
5156 run : |
5257 python -m pip install --upgrade pip
5358 pip install --upgrade -r CI_REQUIREMENTS.txt
5459 pip install --upgrade -r mypy_requirements.txt
55- - name : Generate version file
60+ - name : Install develop
5661 run : |
57- python setup.py --version clean
62+ pip install -e .
5863 - name : Lint with MyPy
5964 run : |
6065 mypy --strict --install-types --non-interactive exec_helpers
6166
6267 Black :
6368 runs-on : ubuntu-latest
6469 steps :
65- - uses : actions/checkout@v3.5.2
70+ - uses : actions/checkout@v3
6671 - name : Set up Python
67- uses : actions/setup-python@v4.6.1
72+ uses : actions/setup-python@v4
6873 with :
6974 python-version : ' 3.x'
7075 - name : Install dependencies
@@ -74,44 +79,84 @@ jobs:
7479 - name : Check code style with black
7580 run : |
7681 black --check exec_helpers
82+ Metadata :
83+ name : Validate metadata
84+ runs-on : ubuntu-latest
85+ steps :
86+ - uses : actions/checkout@v3
87+ - name : Set up Python
88+ uses : actions/setup-python@v4
89+ with :
90+ python-version : ' 3.x'
91+ - name : Install dependencies
92+ run : |
93+ python -m pip install --upgrade pip
94+ pip install --upgrade twine build
95+ - name : Build package
96+ run : |
97+ python -m build -s
98+ - name : Validate metadata
99+ run : |
100+ twine check dist/*
77101
78102 Test :
79- needs : [PEP8, PyLint, MyPy, Black]
103+ needs : [PEP8, PyLint, MyPy, Black, Metadata] # isort is broken
80104 runs-on : ${{ matrix.os }}
81105 strategy :
82106 max-parallel : 6
83107 matrix :
84- os : [" ubuntu-latest", " windows-latest" ]
108+ os : [ubuntu-latest, windows-latest]
85109 python-version : ["3.7", "3.8", "3.9", "3.10", "3.11"]
86110
111+ name : " Script based python ${{ matrix.python-version }} on ${{ matrix.os }}"
87112 steps :
88- - uses : actions/checkout@v3.5.2
113+ - uses : actions/checkout@v3
89114 - name : Set up Python ${{ matrix.python-version }}
90- uses : actions/setup-python@v4.6.1
115+ uses : actions/setup-python@v4
91116 with :
92117 python-version : ${{ matrix.python-version }}
93118 - name : Install dependencies
94119 run : |
95120 python -m pip install --upgrade pip wheel
96121 pip install --upgrade -r CI_REQUIREMENTS.txt
97122 pip install --upgrade -r pytest_requirements.txt
98- - name : Build package and install develop
123+ - name : Install develop
99124 run : |
100125 pip install -e .
101126 - name : Test with pytest
102127 run : |
103128 py.test --cov-report= --cov=exec_helpers test
104129 coverage report -m
130+ coverage xml
105131# coverage report -m --fail-under 85
132+ - name : Coveralls Parallel
133+ uses : coverallsapp/github-action@v2
134+ with :
135+ flag-name : run-${{ matrix.python-version }}-${{ matrix.os }}
136+ parallel : true
137+ file : coverage.xml
106138
107- Deploy :
108- needs : [Test]
139+ UploadCoverage :
140+ name : Upload coverage to Coveralls
141+ needs : [ Test ]
142+ if : ${{ always() }}
143+ runs-on : ubuntu-latest
144+ steps :
145+ - name : Coveralls Finished
146+ uses : coverallsapp/github-action@v2
147+ with :
148+ parallel-finished : true
149+
150+ Build :
151+ needs : [ Test ]
109152 if : github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
110153 runs-on : ubuntu-latest
111154 steps :
112- 155+ - uses : actions/checkout@v3
156+ with :
157+ fetch-depth : 0 # need for setuptools_scm
113158 - name : Set up Python
114- uses : actions/setup-python@v4.6.1
159+ uses : actions/setup-python@v4
115160 with :
116161 python-version : ' 3.x'
117162 - name : Install dependencies
@@ -121,9 +166,25 @@ jobs:
121166 - name : Build package
122167 run : |
123168 python -m build
124- - name : Deploy
125- env :
126- TWINE_USERNAME : ${{ secrets.PYPI_USERNAME }}
127- TWINE_PASSWORD : ${{ secrets.PYPI_PASSWORD }}
128- run : |
129- twine upload --skip-existing dist/*
169+ - uses : actions/upload-artifact@v3
170+ with :
171+ path : dist/*
172+
173+ Deploy :
174+ needs : [Build]
175+ if : github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
176+ runs-on : ubuntu-latest
177+ environment :
178+ name : pypi
179+ url : https://pypi.org/p/exec-helpers
180+ permissions :
181+ id-token : write # IMPORTANT: this permission is mandatory for trusted publishing
182+ steps :
183+ - uses : actions/download-artifact@v3
184+ with :
185+ # unpacks default artifact into dist/
186+ # if `name: artifact` is omitted, the action will create extra parent dir
187+ name : artifact
188+ path : dist
189+ - name : Publish package distributions to PyPI
190+ uses : pypa/gh-action-pypi-publish@release/v1
0 commit comments