| 1 |
name: ci/cd |
| 2 |
on: [push, pull_request] |
| 3 |
env: |
| 4 |
lowest_python_version: "3.10" |
| 5 |
python_package_distributions: python-package-distributions |
| 6 |
|
| 7 |
jobs: |
| 8 |
|
| 9 |
lint: |
| 10 |
runs-on: ubuntu-latest |
| 11 |
steps: |
| 12 |
- uses: actions/checkout@v2 |
| 13 |
- uses: actions/setup-python@v2 |
| 14 |
with: |
| 15 |
python-version: ${{ env.lowest_python_version }} |
| 16 |
- run: python -m pip install -e ./[dev] |
| 17 |
- run: python -m pre_commit run -a |
| 18 |
|
| 19 |
test: |
| 20 |
needs: lint |
| 21 |
runs-on: ubuntu-latest |
| 22 |
strategy: |
| 23 |
matrix: |
| 24 |
python-version: ["3.10", "3.11", "3.12", "3.13"] |
| 25 |
steps: |
| 26 |
- uses: actions/checkout@v2 |
| 27 |
- uses: actions/setup-python@v2 |
| 28 |
with: |
| 29 |
python-version: ${{ matrix.python-version }} |
| 30 |
- run: python -m pip install -e ./[dev] |
| 31 |
- run: python -m pytest |
| 32 |
- uses: codecov/codecov-action@v4 |
| 33 |
with: |
| 34 |
fail_ci_if_error: true |
| 35 |
verbose: true |
| 36 |
token: ${{ secrets.CODECOV_TOKEN }} |
| 37 |
|
| 38 |
build: |
| 39 |
needs: test |
| 40 |
runs-on: ubuntu-latest |
| 41 |
if: github.ref_type == 'tag' |
| 42 |
steps: |
| 43 |
- uses: actions/checkout@v2 |
| 44 |
- uses: actions/setup-python@v2 |
| 45 |
with: |
| 46 |
python-version: ${{ env.lowest_python_version }} |
| 47 |
- run: python -m pip install build |
| 48 |
- run: python -m build |
| 49 |
- uses: actions/upload-artifact@v4 |
| 50 |
with: |
| 51 |
name: ${{ env.python_package_distributions }} |
| 52 |
path: dist/* |
| 53 |
if-no-files-found: error |
| 54 |
retention-days: 14 |
| 55 |
|
| 56 |
publish: |
| 57 |
needs: build |
| 58 |
runs-on: ubuntu-latest |
| 59 |
if: github.ref_type == 'tag' |
| 60 |
permissions: |
| 61 |
id-token: write |
| 62 |
environment: |
| 63 |
name: pypi |
| 64 |
url: https://pypi.org/project/aioftp |
| 65 |
steps: |
| 66 |
- uses: actions/download-artifact@v4 |
| 67 |
with: |
| 68 |
name: ${{ env.python_package_distributions }} |
| 69 |
path: dist |
| 70 |
- uses: pypa/gh-action-pypi-publish@release/v1 |