|
1 | | -name: Continuous integration |
| 1 | +name: "Continuous integration" |
2 | 2 |
|
3 | 3 | on: [push, pull_request] |
4 | 4 |
|
| 5 | +env: |
| 6 | + PIP_CACHE_DIR: ${{ github.workspace }}/.cache/pip |
| 7 | + POETRY_CACHE_DIR: ${{ github.workspace }}/.cache/pypoetry |
| 8 | + DEFAULT_PYTHON: "3.8" |
| 9 | + |
5 | 10 | jobs: |
6 | 11 | test: |
7 | | - name: Test Python ${{ matrix.python-version }} on ${{ matrix.os }} |
| 12 | + name: "Test Python ${{ matrix.python-version }} on ${{ matrix.os }}" |
8 | 13 | runs-on: ${{ matrix.os }} |
9 | 14 | strategy: |
10 | 15 | matrix: |
11 | 16 | os: [ubuntu-latest, windows-latest, macos-latest] |
12 | 17 | python-version: ["3.7", "3.8", "3.9"] |
13 | 18 | steps: |
14 | | - - uses: actions/checkout@v2 |
15 | | - - uses: actions/setup-python@v2 |
| 19 | + - name: "Check out repository" |
| 20 | + uses: actions/checkout@v2 |
| 21 | + |
| 22 | + - name: "Set up Python" |
| 23 | + uses: actions/setup-python@v2 |
16 | 24 | with: |
17 | 25 | python-version: ${{ matrix.python-version }} |
18 | | - - name: Install dependencies |
| 26 | + |
| 27 | + - name: "Set up dependency cache" |
| 28 | + uses: actions/cache@v2 |
| 29 | + with: |
| 30 | + key: deps-${{ secrets.GH_CACHE }}-${{ runner.os }}-python${{ matrix.python-version }}-${{ hashFiles('**/*.lock') }} |
| 31 | + path: | |
| 32 | + ${{ env.PIP_CACHE_DIR }} |
| 33 | + ${{ env.POETRY_CACHE_DIR }} |
| 34 | +
|
| 35 | + - name: "Install dependencies" |
19 | 36 | run: pip install poetry && poetry install |
20 | | - - name: Run tests |
| 37 | + |
| 38 | + - name: "Run tests" |
21 | 39 | run: poetry run pytest |
22 | 40 |
|
23 | 41 | check: |
24 | | - name: Lint and type checks |
| 42 | + name: "Lint and type checks" |
25 | 43 | runs-on: ubuntu-latest |
26 | 44 | steps: |
27 | | - - uses: actions/checkout@v2 |
28 | | - - uses: actions/setup-python@v2 |
| 45 | + - name: "Check out repository" |
| 46 | + uses: actions/checkout@v2 |
| 47 | + |
| 48 | + - name: "Set up Python" |
| 49 | + uses: actions/setup-python@v2 |
29 | 50 | with: |
30 | | - python-version: "3.8" |
31 | | - - name: Install dependencies |
| 51 | + python-version: ${{ env.DEFAULT_PYTHON }} |
| 52 | + |
| 53 | + - name: "Set up dependency cache" |
| 54 | + uses: actions/cache@v2 |
| 55 | + with: |
| 56 | + key: deps-${{ secrets.GH_CACHE }}-${{ runner.os }}-python${{ env.DEFAULT_PYTHON }}-${{ hashFiles('**/*.lock') }} |
| 57 | + path: | |
| 58 | + ${{ env.PIP_CACHE_DIR }} |
| 59 | + ${{ env.POETRY_CACHE_DIR }} |
| 60 | +
|
| 61 | + - name: "Install dependencies" |
32 | 62 | run: pip install poetry && poetry install |
33 | | - - name: Format checks |
| 63 | + |
| 64 | + - name: "Check formatting" |
34 | 65 | run: poetry run black --check . |
35 | | - - name: Lint checks |
| 66 | + |
| 67 | + - name: "Check linter" |
36 | 68 | run: poetry run flake8 |
37 | | - - name: Type checks |
| 69 | + |
| 70 | + - name: "Checks types" |
38 | 71 | run: poetry run mypy |
39 | 72 |
|
40 | 73 | build: |
41 | 74 | name: Build assets and deploy on tags |
42 | 75 | runs-on: ubuntu-latest |
43 | 76 | needs: [test, check] |
44 | 77 | steps: |
45 | | - - uses: actions/checkout@v2 |
46 | | - - uses: actions/setup-python@v2 |
| 78 | + - name: "Check out repository" |
| 79 | + uses: actions/checkout@v2 |
| 80 | + |
| 81 | + - name: "Set up Python" |
| 82 | + uses: actions/setup-python@v2 |
47 | 83 | with: |
48 | | - python-version: "3.8" |
49 | | - - name: Install dependencies |
| 84 | + python-version: ${{ env.DEFAULT_PYTHON }} |
| 85 | + |
| 86 | + - name: "Set up dependency cache" |
| 87 | + uses: actions/cache@v2 |
| 88 | + with: |
| 89 | + key: deps-${{ secrets.GH_CACHE }}-${{ runner.os }}-python${{ env.DEFAULT_PYTHON }}-${{ hashFiles('**/*.lock') }} |
| 90 | + path: | |
| 91 | + ${{ env.PIP_CACHE_DIR }} |
| 92 | + ${{ env.POETRY_CACHE_DIR }} |
| 93 | +
|
| 94 | + - name: "Install dependencies" |
50 | 95 | run: pip install poetry && poetry install |
51 | | - - name: Build artifacts |
| 96 | + |
| 97 | + - name: "Build artifacts" |
52 | 98 | run: | |
53 | 99 | poetry build |
54 | 100 | poetry run mkdocs build |
55 | | - - if: startsWith(github.ref, 'refs/tags/v') |
56 | | - name: Deploy to PyPI and GitHub Pages |
| 101 | +
|
| 102 | + - name: "Deploy to PyPI and GitHub Pages" |
| 103 | + if: startsWith(github.ref, 'refs/tags/v') |
57 | 104 | env: |
58 | 105 | USER_NAME: ${{ github.actor }} |
59 | 106 | USER_ID: ${{ github.event.sender.id }} |
|
0 commit comments