1+ # This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2+ # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
3+
4+ name : Python publish
5+
6+ on :
7+ push :
8+ tags :
9+ - ' v*' # Only run on version tags like v1.2.3
10+
11+ jobs :
12+ build :
13+
14+ runs-on : ubuntu-latest
15+ strategy :
16+ fail-fast : false
17+ matrix :
18+ python-version : ["3.x"]
19+
20+ steps :
21+ - uses : actions/checkout@v4
22+ - name : Set up Python ${{ matrix.python-version }}
23+ uses : actions/setup-python@v3
24+ with :
25+ python-version : ${{ matrix.python-version }}
26+ - name : Install dependencies
27+ run : |
28+ python -m pip install --upgrade pip
29+ python -m pip install flake8 pytest
30+ if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
31+ - name : Lint with flake8
32+ run : |
33+ # stop the build if there are Python syntax errors or undefined names
34+ flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
35+ # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
36+ flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
37+ - name : Test with pytest
38+ run : |
39+ python -m pip install scipy
40+ pip install -e .
41+ pytest
42+ - name : Install build tools
43+ run : |
44+ pip install build
45+ - name : Build the package
46+ run : |
47+ python -m build
48+ - name : Store the distribution packages
49+ uses : actions/upload-artifact@v4
50+ with :
51+ name : python-package-distributions
52+ path : dist/
53+
54+ publish-to-pypi :
55+ needs :
56+ - build
57+ runs-on : ubuntu-latest
58+ environment :
59+ name : pypi
60+ url : https://pypi.org/p/incrementalstats
61+ permissions :
62+ id-token : write
63+
64+ steps :
65+ - name : Download all the dists
66+ uses : actions/download-artifact@v4
67+ with :
68+ name : python-package-distributions
69+ path : dist/
70+ - name : Publish distribution 📦 to PyPI
71+ uses : pypa/gh-action-pypi-publish@release/v1
0 commit comments