|
6 | 6 | branches: ["main"] |
7 | 7 | pull_request: |
8 | 8 | branches: ["main"] |
| 9 | + workflow_dispatch: |
| 10 | + |
| 11 | + |
| 12 | +env: |
| 13 | + FORCE_COLOR: "1" # Make tools pretty. |
| 14 | + TOX_TESTENV_PASSENV: FORCE_COLOR |
| 15 | + PYTHON_LATEST: "3.10" |
| 16 | + |
9 | 17 |
|
10 | 18 | jobs: |
11 | 19 | tests: |
12 | | - runs-on: "ubuntu-latest" |
13 | | - |
| 20 | + name: tox on ${{ matrix.python-version }} |
| 21 | + runs-on: ubuntu-latest |
14 | 22 | strategy: |
15 | 23 | matrix: |
16 | 24 | python-version: ["3.8", "3.9", "3.10"] |
17 | | - name: "Python ${{ matrix.python-version }}" |
18 | 25 |
|
19 | 26 | steps: |
20 | | - - uses: "actions/checkout@v2" |
21 | | - - uses: "actions/setup-python@v2" |
| 27 | + - uses: actions/checkout@v2 |
| 28 | + - uses: actions/setup-python@v2 |
22 | 29 | with: |
23 | 30 | python-version: "${{ matrix.python-version }}" |
24 | | - - name: "Install dependencies" |
| 31 | + |
| 32 | + - name: Install dependencies |
25 | 33 | run: | |
26 | 34 | set -xe |
27 | 35 | python -VV |
28 | 36 | python -m site |
29 | | - python -m pip install --upgrade pip setuptools |
30 | | - python -m pip install --upgrade coverage[toml] virtualenv tox tox-gh-actions |
| 37 | + python -m pip install --upgrade pip setuptools wheel |
| 38 | + python -m pip install --upgrade virtualenv tox tox-gh-actions |
| 39 | +
|
| 40 | + - run: python -m tox |
31 | 41 |
|
32 | | - - name: "Run tox targets for ${{ matrix.python-version }}" |
33 | | - run: "python -m tox" |
| 42 | + - name: Upload coverage data |
| 43 | + uses: actions/upload-artifact@v2 |
| 44 | + with: |
| 45 | + name: coverage-data |
| 46 | + path: .coverage.* |
| 47 | + if-no-files-found: ignore |
| 48 | + |
| 49 | + |
| 50 | + coverage: |
| 51 | + name: Combine & check coverage. |
| 52 | + runs-on: ubuntu-latest |
| 53 | + needs: tests |
| 54 | + |
| 55 | + steps: |
| 56 | + - uses: actions/checkout@v2 |
| 57 | + - uses: actions/setup-python@v2 |
| 58 | + with: |
| 59 | + # Use latest Python, so it understands all syntax. |
| 60 | + python-version: ${{env.PYTHON_LATEST}} |
34 | 61 |
|
35 | | - - name: "Get coverage" |
| 62 | + - run: python -m pip install --upgrade coverage[toml] |
| 63 | + |
| 64 | + - uses: actions/download-artifact@v2 |
| 65 | + with: |
| 66 | + name: coverage-data |
| 67 | + |
| 68 | + - name: Combine coverage & fail if it's <100%. |
36 | 69 | run: | |
37 | | - set -xe |
38 | | - if compgen -G ".coverage.*" >/dev/null; then |
39 | | - python -m coverage combine |
40 | | - python -m coverage xml |
41 | | - fi |
42 | | - - name: Upload coverage to Codecov |
43 | | - uses: "codecov/codecov-action@v2" |
| 70 | + python -m coverage combine |
| 71 | + python -m coverage html --skip-covered --skip-empty |
| 72 | + python -m coverage report --fail-under=100 |
| 73 | +
|
| 74 | + - name: Upload HTML report if check failed. |
| 75 | + uses: actions/upload-artifact@v2 |
44 | 76 | with: |
45 | | - fail_ci_if_error: true |
| 77 | + name: html-report |
| 78 | + path: htmlcov |
| 79 | + if: ${{ failure() }} |
| 80 | + |
46 | 81 |
|
47 | 82 | package: |
48 | | - name: "Build & verify package" |
49 | | - runs-on: "ubuntu-latest" |
| 83 | + name: Build & verify package |
| 84 | + runs-on: ubuntu-latest |
50 | 85 |
|
51 | 86 | steps: |
52 | | - - uses: "actions/checkout@v2" |
53 | | - - uses: "actions/setup-python@v2" |
| 87 | + - uses: actions/checkout@v2 |
| 88 | + - uses: actions/setup-python@v2 |
54 | 89 | with: |
55 | | - python-version: "3.9" |
56 | | - |
57 | | - - name: "Install build, check-wheel-contents, and twine" |
58 | | - run: "python -m pip install build twine check-wheel-contents" |
59 | | - - name: "Build package" |
60 | | - run: "python -m build --sdist --wheel ." |
61 | | - - name: "List result" |
62 | | - run: "ls -l dist" |
63 | | - - name: "Check wheel contents" |
64 | | - run: "check-wheel-contents dist/*.whl" |
65 | | - - name: "Check long_description" |
66 | | - run: "python -m twine check dist/*" |
| 90 | + python-version: ${{env.PYTHON_LATEST}} |
| 91 | + |
| 92 | + - run: python -m pip install build twine check-wheel-contents |
| 93 | + - run: python -m build --sdist --wheel . |
| 94 | + - run: ls -l dist |
| 95 | + - run: check-wheel-contents dist/*.whl |
| 96 | + - name: Check long_description |
| 97 | + run: python -m twine check dist/* |
| 98 | + |
67 | 99 |
|
68 | 100 | install-dev: |
| 101 | + name: Verify dev env |
| 102 | + runs-on: "${{ matrix.os }}" |
69 | 103 | strategy: |
70 | 104 | matrix: |
71 | | - os: ["ubuntu-latest", "windows-latest", "macos-latest"] |
72 | | - |
73 | | - name: "Verify dev env" |
74 | | - runs-on: "${{ matrix.os }}" |
| 105 | + os: ["ubuntu-latest", "windows-latest"] |
75 | 106 |
|
76 | 107 | steps: |
77 | | - - uses: "actions/checkout@v2" |
78 | | - - uses: "actions/setup-python@v2" |
| 108 | + - uses: actions/checkout@v2 |
| 109 | + - uses: actions/setup-python@v2 |
79 | 110 | with: |
80 | | - python-version: "3.9" |
81 | | - - name: "Install in dev mode" |
82 | | - run: "python -m pip install -e .[dev]" |
83 | | - - name: "Import package" |
84 | | - run: "python -c 'import doc2dash; print(doc2dash.__version__)'" |
| 111 | + python-version: ${{env.PYTHON_LATEST}} |
| 112 | + - run: python -m pip install -e .[dev] |
| 113 | + - run: "python -c 'import doc2dash; print(doc2dash.__version__)'" |
| 114 | + - run: "python -m doc2dash" |
0 commit comments