|
| 1 | +--- |
| 2 | +name: CI |
| 3 | + |
| 4 | +on: |
| 5 | + push: |
| 6 | + branches: ["master"] |
| 7 | + pull_request: |
| 8 | + branches: ["master"] |
| 9 | + workflow_dispatch: |
| 10 | + |
| 11 | +jobs: |
| 12 | + tests: |
| 13 | + name: "Python ${{ matrix.python-version }}" |
| 14 | + runs-on: "ubuntu-latest" |
| 15 | + env: |
| 16 | + USING_COVERAGE: "3.6,3.7,3.8,3.9" |
| 17 | + |
| 18 | + strategy: |
| 19 | + matrix: |
| 20 | + python-version: ["3.6", "3.7", "3.8", "3.9"] |
| 21 | + |
| 22 | + steps: |
| 23 | + - uses: "actions/checkout@v2" |
| 24 | + - uses: "actions/setup-python@v2" |
| 25 | + with: |
| 26 | + python-version: "${{ matrix.python-version }}" |
| 27 | + - name: "Install dependencies" |
| 28 | + run: | |
| 29 | + set -xe |
| 30 | + python -VV |
| 31 | + python -m site |
| 32 | + python -m pip install --upgrade pip wheel poetry |
| 33 | + python -m pip install --upgrade coverage[toml] virtualenv tox tox-gh-actions |
| 34 | + - name: "Run tox targets for ${{ matrix.python-version }}" |
| 35 | + run: "python -m tox" |
| 36 | + |
| 37 | + # We always use a modern Python version for combining coverage to prevent |
| 38 | + # parsing errors in older versions for modern code. |
| 39 | + - uses: "actions/setup-python@v2" |
| 40 | + with: |
| 41 | + python-version: "3.9" |
| 42 | + |
| 43 | + - name: "Upload coverage to Codecov" |
| 44 | + if: "contains(env.USING_COVERAGE, matrix.python-version)" |
| 45 | + uses: "codecov/codecov-action@v1" |
| 46 | + with: |
| 47 | + fail_ci_if_error: true |
| 48 | + |
| 49 | + package: |
| 50 | + name: "Build & verify package" |
| 51 | + runs-on: "ubuntu-latest" |
| 52 | + |
| 53 | + steps: |
| 54 | + - uses: "actions/checkout@v2" |
| 55 | + - uses: "actions/setup-python@v2" |
| 56 | + with: |
| 57 | + python-version: "3.9" |
| 58 | + |
| 59 | + - name: "Install poetry, check-wheel-content, and twine" |
| 60 | + run: "python -m pip install twine check-wheel-contents" |
| 61 | + - name: "Build package" |
| 62 | + run: "python setup.py sdist bdist_wheel" |
| 63 | + - name: "List result" |
| 64 | + run: "ls -l dist" |
| 65 | + - name: "Check wheel contents" |
| 66 | + run: "check-wheel-contents dist/*.whl" |
| 67 | + - name: "Check long_description" |
| 68 | + run: "python -m twine check dist/*" |
0 commit comments