|
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: build |
5 |
| - |
6 |
| -on: |
7 |
| - push: |
8 |
| - branches: [ "main" ] |
9 |
| - pull_request: |
10 |
| - branches: [ "main" ] |
11 |
| - |
12 |
| -jobs: |
13 |
| - build: |
14 |
| - runs-on: ${{ matrix.os }} |
15 |
| - strategy: |
16 |
| - fail-fast: false |
17 |
| - matrix: |
18 |
| - os: [ubuntu-latest] |
19 |
| - python-version: ["3.8", "3.9", "3.10", "3.11"] |
20 |
| - steps: |
21 |
| - - uses: actions/checkout@v3 |
22 |
| - - name: Set up Python ${{ matrix.python-version }} |
23 |
| - uses: actions/setup-python@v4 |
24 |
| - with: |
25 |
| - python-version: ${{ matrix.python-version }} |
26 |
| - - name: Install package |
27 |
| - run: | |
28 |
| - python -m pip install --upgrade pip |
29 |
| - python -m pip install flake8 |
30 |
| - pip install -r requirements.txt |
31 |
| - pip install . |
32 |
| - - name: Lint with flake8 |
33 |
| - run: | |
34 |
| - # stop the build if there are Python syntax errors or undefined names |
35 |
| - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics |
36 |
| - # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide |
37 |
| - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics |
38 |
| - deploy: |
39 |
| - runs-on: ubuntu-latest |
40 |
| - needs: build |
41 |
| - steps: |
42 |
| - - uses: actions/checkout@v3 |
43 |
| - with: |
44 |
| - fetch-depth: 0 |
45 |
| - - name: Check for version change |
46 |
| - uses: dorny/paths-filter@v2 |
47 |
| - id: filter |
48 |
| - with: |
49 |
| - filters: | |
50 |
| - version: |
51 |
| - - '**/VERSION.txt' |
52 |
| - - if: steps.filter.outputs.version == 'true' |
53 |
| - name: Cleanup README |
54 |
| - run: | |
55 |
| - sed -ri 's/^(##*)\s*:.*:\s*/\1 /g' README.md |
56 |
| - awk '{if (match($0,"## Supporters")) exit; print}' README.md > README |
57 |
| - mv -f README README.md |
58 |
| - - if: steps.filter.outputs.version == 'true' |
59 |
| - run: python3 -m pip install --upgrade build && python3 -m build |
60 |
| - - if: steps.filter.outputs.version == 'true' |
61 |
| - name: Upload to PyPi |
62 |
| - uses: pypa/gh-action-pypi-publish@release/v1 |
63 |
| - with: |
64 |
| - password: ${{ secrets.PYPI_API_TOKEN }} |
65 |
| - verbose: true |
66 |
| - verify_metadata: false |
| 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: build |
| 5 | + |
| 6 | +on: |
| 7 | + push: |
| 8 | + branches: [ "main" ] |
| 9 | + pull_request: |
| 10 | + branches: [ "main" ] |
| 11 | + |
| 12 | +jobs: |
| 13 | + build: |
| 14 | + runs-on: ${{ matrix.os }} |
| 15 | + strategy: |
| 16 | + fail-fast: false |
| 17 | + matrix: |
| 18 | + os: [ubuntu-latest] |
| 19 | + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] |
| 20 | + steps: |
| 21 | + - uses: actions/checkout@v3 |
| 22 | + - name: Set up Python ${{ matrix.python-version }} |
| 23 | + uses: actions/setup-python@v4 |
| 24 | + with: |
| 25 | + python-version: ${{ matrix.python-version }} |
| 26 | + - name: Install package |
| 27 | + run: | |
| 28 | + python -m pip install --upgrade pip |
| 29 | + python -m pip install flake8 |
| 30 | + pip install -r requirements.txt |
| 31 | + pip install . |
| 32 | + - name: Lint with flake8 |
| 33 | + run: | |
| 34 | + # stop the build if there are Python syntax errors or undefined names |
| 35 | + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics |
| 36 | + # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide |
| 37 | + flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics |
| 38 | + deploy: |
| 39 | + runs-on: ubuntu-latest |
| 40 | + needs: build |
| 41 | + steps: |
| 42 | + - uses: actions/checkout@v3 |
| 43 | + with: |
| 44 | + fetch-depth: 0 |
| 45 | + - name: Check for version change |
| 46 | + uses: dorny/paths-filter@v2 |
| 47 | + id: filter |
| 48 | + with: |
| 49 | + filters: | |
| 50 | + version: |
| 51 | + - '**/VERSION.txt' |
| 52 | + - if: steps.filter.outputs.version == 'true' |
| 53 | + name: Cleanup README |
| 54 | + run: | |
| 55 | + sed -ri 's/^(##*)\s*:.*:\s*/\1 /g' README.md |
| 56 | + awk '{if (match($0,"## Supporters")) exit; print}' README.md > README |
| 57 | + mv -f README README.md |
| 58 | + - if: steps.filter.outputs.version == 'true' |
| 59 | + run: python3 -m pip install --upgrade build && python3 -m build |
| 60 | + - if: steps.filter.outputs.version == 'true' |
| 61 | + name: Upload to PyPi |
| 62 | + uses: pypa/gh-action-pypi-publish@release/v1 |
| 63 | + with: |
| 64 | + password: ${{ secrets.PYPI_API_TOKEN }} |
| 65 | + verbose: true |
| 66 | + verify_metadata: false |
0 commit comments