|
13 | 13 | - '**' |
14 | 14 |
|
15 | 15 | jobs: |
16 | | - Linting: |
17 | | - runs-on: ubuntu-latest |
18 | | - |
19 | | - steps: |
20 | | - - uses: actions/checkout@v2 |
21 | | - - name: Set up Python 3.9 |
22 | | - uses: actions/setup-python@v1 |
23 | | - with: |
24 | | - python-version: 3.9 |
25 | | - - name: Linting |
26 | | - run: | |
27 | | - pip install pre-commit |
28 | | - pre-commit run --all-files |
29 | | -
|
30 | 16 | Tests: |
31 | | - needs: Linting |
32 | 17 | name: ${{ matrix.os }} / ${{ matrix.python-version }} |
33 | 18 | runs-on: ${{ matrix.os }}-latest |
34 | 19 | strategy: |
35 | 20 | matrix: |
36 | 21 | os: [Ubuntu, MacOS, Windows] |
37 | 22 | python-version: [3.7, 3.8, 3.9, "3.10"] |
| 23 | + defaults: |
| 24 | + run: |
| 25 | + shell: bash |
| 26 | + |
38 | 27 | steps: |
39 | | - - uses: actions/checkout@v2 |
| 28 | + - uses: actions/checkout@v3 |
40 | 29 |
|
41 | 30 | - name: Set up Python ${{ matrix.python-version }} |
42 | | - uses: actions/setup-python@v1 |
| 31 | + uses: actions/setup-python@v4 |
43 | 32 | with: |
44 | 33 | python-version: ${{ matrix.python-version }} |
45 | 34 |
|
46 | 35 | - name: Get full Python version |
47 | 36 | id: full-python-version |
48 | | - shell: bash |
49 | | - run: echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))") |
| 37 | + run: | |
| 38 | + echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))") |
50 | 39 |
|
51 | 40 | - name: Install poetry |
52 | | - shell: bash |
53 | 41 | run: | |
54 | | - curl -fsS -o install-poetry.py https://raw.githubusercontent.com/sdispater/poetry/master/install-poetry.py |
55 | | - python install-poetry.py --preview -y |
| 42 | + curl -fsS https://install.python-poetry.org | python - --preview -y |
56 | 43 |
|
57 | 44 | - name: Update PATH |
58 | 45 | if: ${{ matrix.os != 'Windows' }} |
59 | | - shell: bash |
60 | 46 | run: echo "$HOME/.local/bin" >> $GITHUB_PATH |
61 | 47 |
|
62 | 48 | - name: Update Path for Windows |
63 | 49 | if: ${{ matrix.os == 'Windows' }} |
64 | | - shell: bash |
65 | 50 | run: echo "$APPDATA\Python\Scripts" >> $GITHUB_PATH |
66 | 51 |
|
67 | 52 | - name: Configure poetry |
68 | | - shell: bash |
69 | 53 | run: poetry config virtualenvs.in-project true |
70 | 54 |
|
71 | 55 | - name: Set up cache |
72 | | - uses: actions/cache@v2 |
| 56 | + uses: actions/cache@v3 |
73 | 57 | id: cache |
74 | 58 | with: |
75 | 59 | path: .venv |
76 | 60 | key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }} |
77 | 61 |
|
78 | 62 | - name: Ensure cache is healthy |
79 | | - if: steps.cache.outputs.cache-hit == 'true' |
80 | | - shell: bash |
81 | | - run: poetry run pip --version >/dev/null 2>&1 || rm -rf .venv |
| 63 | + # MacOS does not come with `timeout` command out of the box |
| 64 | + if: steps.cache.outputs.cache-hit == 'true' && matrix.os != 'MacOS' |
| 65 | + run: timeout 10s poetry run pip --version || rm -rf .venv |
82 | 66 |
|
83 | 67 | - name: Install dependencies |
84 | | - shell: bash |
85 | | - run: poetry install --only default --only test -vvv |
| 68 | + run: poetry install --only main --only test -vvv |
86 | 69 |
|
87 | 70 | - name: Test Pure Python |
88 | | - shell: bash |
89 | 71 | run: | |
90 | 72 | PENDULUM_EXTENSIONS=0 poetry run pytest -q tests |
91 | 73 |
|
92 | 74 | - name: Test |
93 | | - shell: bash |
94 | 75 | run: | |
95 | 76 | poetry run pytest -q tests |
0 commit comments