Skip to content

Commit

Permalink
Streamline workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
hynek committed Dec 27, 2021
1 parent 3333e74 commit 26c0cef
Showing 1 changed file with 27 additions and 30 deletions.
57 changes: 27 additions & 30 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,25 @@ on:

env:
FORCE_COLOR: "1" # Make tools pretty.
TOX_TESTENV_PASSENV: "FORCE_COLOR"
TOX_TESTENV_PASSENV: FORCE_COLOR
PYTHON_LATEST: "3.10"


jobs:
tests:
name: "tox on ${{ matrix.python-version }}"
runs-on: "ubuntu-latest"
name: tox on ${{ matrix.python-version }}
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
python-version: ["2.7", "3.5", "3.6", "3.7", "3.8", "3.9", "3.10", "pypy-2.7", "pypy-3.7"]

steps:
- uses: "actions/checkout@v2"
- uses: "actions/setup-python@v2"
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: "${{ matrix.python-version }}"
python-version: ${{ matrix.python-version }}

- name: "Install dependencies"
run: |
Expand All @@ -37,8 +37,7 @@ jobs:
python -m pip install --upgrade pip setuptools wheel
python -m pip install --upgrade virtualenv tox tox-gh-actions
- name: "Run tox targets for ${{ matrix.python-version }}"
run: "python -m tox"
- run: "python -m tox"

- name: Upload coverage data
uses: "actions/upload-artifact@v2"
Expand All @@ -49,7 +48,7 @@ jobs:


coverage:
runs-on: "ubuntu-latest"
runs-on: ubuntu-latest
needs: tests

steps:
Expand All @@ -59,21 +58,20 @@ jobs:
# Use latest Python, so it understands all syntax.
python-version: ${{env.PYTHON_LATEST}}

- name: Install Coverage.py
run: python -m pip install --upgrade coverage[toml]
- run: python -m pip install --upgrade coverage[toml]

- name: Download coverage data
uses: actions/download-artifact@v2
with:
name: coverage-data

- name: Combine coverage and fail if it's <100%
- name: Combine coverage and fail if it's <100%.
run: |
python -m coverage combine
python -m coverage html --skip-covered --skip-empty
python -m coverage report --fail-under=100
- name: Upload HTML report for failed check
- name: Upload HTML report if check failed.
uses: actions/upload-artifact@v2
with:
name: html-report
Expand All @@ -82,35 +80,34 @@ jobs:


package:
name: "Build & verify package"
runs-on: "ubuntu-latest"
name: Build & verify package
runs-on: ubuntu-latest

steps:
- uses: "actions/checkout@v2"
- uses: "actions/setup-python@v2"
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: ${{env.PYTHON_LATEST}}

- run: "python -m pip install build twine check-wheel-contents"
- run: "python -m build --sdist --wheel ."
- run: "ls -l dist"
- run: "check-wheel-contents dist/*.whl"
- name: "Check long_description"
run: "python -m twine check dist/*"
- run: python -m pip install build twine check-wheel-contents
- run: python -m build --sdist --wheel .
- run: ls -l dist
- run: check-wheel-contents dist/*.whl
- name: Check long_description
run: python -m twine check dist/*


install-dev:
name: "Verify dev env"
runs-on: "${{ matrix.os }}"
name: Verify dev env
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: ["ubuntu-latest", "windows-latest"]

steps:
- uses: "actions/checkout@v2"
- uses: "actions/setup-python@v2"
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: ${{env.PYTHON_LATEST}}
- run: "python -m pip install -e .[dev]"
- name: "Import package"
run: "python -c 'import attr; print(attr.__version__)'"
- run: python -m pip install -e .[dev]
- run: python -c 'import attr; print(attr.__version__)'

0 comments on commit 26c0cef

Please sign in to comment.