| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
name: Python package |
| 5 |
|
| 6 |
on: |
| 7 |
push: |
| 8 |
branches: [ main, v2 ] |
| 9 |
pull_request: |
| 10 |
branches: [ main, v2 ] |
| 11 |
|
| 12 |
jobs: |
| 13 |
build: |
| 14 |
|
| 15 |
runs-on: ubuntu-latest |
| 16 |
strategy: |
| 17 |
matrix: |
| 18 |
python-version: [3.9, "3.10", "3.11", "3.12", "3.13", "pypy3.10"] |
| 19 |
|
| 20 |
steps: |
| 21 |
- uses: actions/checkout@v4 |
| 22 |
- name: Set up Python ${{ matrix.python-version }} |
| 23 |
uses: actions/setup-python@v5 |
| 24 |
with: |
| 25 |
python-version: ${{ matrix.python-version }} |
| 26 |
- name: Install dependencies |
| 27 |
run: | |
| 28 |
python -m pip install --upgrade pip |
| 29 |
pip install . |
| 30 |
pip install flake8 pytest pytest-cov pydiff |
| 31 |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi |
| 32 |
- name: Lint with flake8 |
| 33 |
run: | |
| 34 |
flake8 autopep8.py |
| 35 |
pycodestyle autopep8.py |
| 36 |
- name: doctest for readme |
| 37 |
if: matrix.python-version == 3.11 |
| 38 |
run: | |
| 39 |
python -m doctest -v README.rst |
| 40 |
- name: Test with pytest |
| 41 |
run: | |
| 42 |
pytest --cov-report xml --cov=autopep8 |
| 43 |
python test/acid.py -aaa --experimental test/example.py |
| 44 |
python test/acid.py -aaa --experimental test/example_with_reduce.py |
| 45 |
python test/acid.py --pycodestyle= -aaa --compare-bytecode --experimental test/example.py |
| 46 |
python test/acid.py --pycodestyle= --aggressive --line-range 550 610 test/inspect_example.py |
| 47 |
python test/acid.py --pycodestyle= --line-range 289 925 test/vectors_example.py |
| 48 |
python test/test_suite.py |
| 49 |
- name: Upload coverage to Codecov |
| 50 |
uses: codecov/codecov-action@v5 |
| 51 |
if: (matrix.python-version == 3.11 || matrix.python-version == 3.12) && success() |
| 52 |
with: |
| 53 |
fail_ci_if_error: true |
| 54 |
flags: ${{ matrix.python-version }} |
| 55 |
token: ${{ secrets.CODECOV_TOKEN }} |