|
14 | 14 |
|
15 | 15 | jobs: |
16 | 16 | test: |
17 | | - name: '${{ matrix.os_name }}: Python ${{ matrix.python }}' |
18 | | - runs-on: ${{ matrix.os }} |
| 17 | + name: ${{ matrix.os }} / ${{ matrix.python-version }} |
| 18 | + runs-on: ${{ matrix.os }}-latest |
| 19 | + defaults: |
| 20 | + run: |
| 21 | + shell: bash |
19 | 22 |
|
20 | 23 | strategy: |
21 | 24 | fail-fast: false |
22 | 25 | matrix: |
23 | | - os: [ubuntu-latest, macos-latest, windows-latest] |
24 | | - python: [3.7, 3.8, 3.9] |
25 | | - include: |
26 | | - - os: ubuntu-latest |
27 | | - os_name: Linux |
28 | | - poetry_cache: ~/.cache/pypoetry |
29 | | - |
30 | | - - os: macos-latest |
31 | | - os_name: macOS |
32 | | - poetry_cache: ~/Library/Caches/pypoetry |
33 | | - |
34 | | - - os: windows-latest |
35 | | - os_name: Windows |
36 | | - poetry_cache: ~\AppData\Local\pypoetry\Cache |
| 26 | + os: [Ubuntu, macOS, Windows] |
| 27 | + python-version: [3.7, 3.8, 3.9] |
37 | 28 |
|
38 | 29 | steps: |
39 | 30 | - name: Checkout |
40 | 31 | |
41 | 32 |
|
42 | | - - name: Set up Python |
| 33 | + - name: Set up Python ${{ matrix.python-version }} |
43 | 34 | |
44 | 35 | with: |
45 | | - python-version: ${{ matrix.python }} |
| 36 | + python-version: ${{ matrix.python-version }} |
46 | 37 |
|
47 | | - - name: Install Poetry |
48 | | - uses: Gr1N/setup-poetry@v4 |
| 38 | + - name: Get Python version |
| 39 | + id: python-version |
| 40 | + run: echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))") |
49 | 41 |
|
50 | | - - name: Write environment information to a file |
51 | | - run: | |
52 | | - pwd > environment |
53 | | - python --version >> environment |
| 42 | + - name: Install Poetry |
| 43 | + uses: snok/install-poetry@v1 |
| 44 | + with: |
| 45 | + virtualenvs-create: true |
| 46 | + virtualenvs-in-project: true |
54 | 47 |
|
55 | 48 | - name: Restore cache |
56 | | - id: poetry-cache |
| 49 | + id: cache |
57 | 50 | |
58 | | - if: runner.os != 'Windows' |
59 | 51 | with: |
60 | | - path: ${{ matrix.poetry_cache }} |
61 | | - key: poetry|${{ hashFiles('environment') }}|${{ hashFiles('poetry.lock') }} |
| 52 | + path: .venv |
| 53 | + key: poetry-${{ runner.os }}-${{ steps.python-version.outputs.version }}-${{ hashFiles('poetry.lock') }} |
62 | 54 |
|
63 | 55 | - name: Install dependencies |
| 56 | + if: steps.cache.outputs.cache-hit != 'true' |
64 | 57 | run: poetry install |
65 | | - if: steps.poetry-cache.outputs.cache-hit != 'true' |
66 | 58 |
|
67 | 59 | - name: Run tests |
68 | 60 | run: poetry run pytest tests/ --cov=torchts |
|
71 | 63 | run: poetry run coverage xml |
72 | 64 |
|
73 | 65 | - name: Upload coverage report |
74 | | - uses: codecov/codecov-action@v1 |
75 | 66 | if: success() |
| 67 | + uses: codecov/codecov-action@v1 |
76 | 68 | with: |
77 | 69 | token: ${{ secrets.CODECOV_TOKEN }} |
78 | 70 | file: ./coverage.xml |
0 commit comments