@@ -16,114 +16,62 @@ jobs:
1616 run : |
1717 pip install pre-commit
1818 pre-commit run --all-files
19- Linux :
19+
20+ Tests :
2021 needs : Linting
21- runs-on : ubuntu-latest
22+ name : ${{ matrix.os }} / ${{ matrix.python-version }}
23+ runs-on : ${{ matrix.os }}-latest
2224 strategy :
2325 matrix :
24- python-version : [2.7, 3.5, 3.6, 3.7, 3.8, pypy2, pypy3]
26+ os : [Ubuntu, MacOS, Windows]
27+ python-version : [3.6, 3.7, 3.8, 3.9]
2528
2629 steps :
27- - uses : actions/checkout@v2
28- - name : Set up Python ${{ matrix.python-version }}
29- uses : actions/setup-python@v1
30- with :
31- python-version : ${{ matrix.python-version }}
32- - name : Get full python version
33- id : full-python-version
34- run : |
35- echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")
36- - name : Install and set up Poetry
37- run : |
38- curl -fsS -o get-poetry.py https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py
39- python get-poetry.py --preview -y
40- source $HOME/.poetry/env
41- poetry config virtualenvs.in-project true
42- - name : Set up cache
43- uses : actions/cache@v1
44- with :
45- path : .venv
46- key : venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}
47- - name : Install dependencies
48- run : |
49- source $HOME/.poetry/env
50- poetry install
51- - name : Test
52- run : |
53- source $HOME/.poetry/env
54- poetry run pytest -q tests
55- poetry install
30+ - uses : actions/checkout@v2
5631
57- MacOS :
58- needs : Linting
59- runs-on : macos-latest
60- strategy :
61- matrix :
62- python-version : [2.7, 3.5, 3.6, 3.7, 3.8, pypy2, pypy3]
32+ - name : Set up Python ${{ matrix.python-version }}
33+ uses : actions/setup-python@v1
34+ with :
35+ python-version : ${{ matrix.python-version }}
6336
64- steps :
65- - uses : actions/checkout@v2
66- - name : Set up Python ${{ matrix.python-version }}
67- uses : actions/setup-python@v1
68- with :
69- python-version : ${{ matrix.python-version }}
70- - name : Get full python version
71- id : full-python-version
72- run : |
73- echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")
74- - name : Install and set up Poetry
75- run : |
76- curl -fsS -o get-poetry.py https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py
77- python get-poetry.py --preview -y
78- source $HOME/.poetry/env
79- poetry config virtualenvs.in-project true
80- - name : Set up cache
81- uses : actions/cache@v1
82- with :
83- path : .venv
84- key : venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}
85- - name : Install dependencies
86- run : |
87- source $HOME/.poetry/env
88- poetry install
89- - name : Test
90- run : |
91- source $HOME/.poetry/env
92- poetry run pytest -q tests
93- Windows :
94- needs : Linting
95- runs-on : windows-latest
96- strategy :
97- matrix :
98- python-version : [2.7, 3.5, 3.6, 3.7, 3.8]
37+ - name : Get full python version
38+ id : full-python-version
39+ shell : bash
40+ run : |
41+ echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")
42+
43+ - name : Install Poetry
44+ shell : bash
45+ run : |
46+ curl -fsS -o get-poetry.py https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py
47+ python get-poetry.py --preview -y
48+ echo "$HOME/.poetry/bin" >> $GITHUB_PATH
49+ echo "%USERPROFILE%/.poetry/bin" >> $GITHUB_PATH
9950
100- steps :
101- - uses : actions/checkout@v2
102- - name : Set up Python ${{ matrix.python-version }}
103- uses : actions/setup-python@v1
104- with :
105- python-version : ${{ matrix.python-version }}
106- - name : Get full python version
107- id : full-python-version
108- shell : bash
109- run : |
110- echo ::set-output name=version::$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")
111- - name : Install and setup Poetry
112- run : |
113- Invoke-WebRequest https://raw.githubusercontent.com/sdispater/poetry/master/get-poetry.py -O get-poetry.py
114- python get-poetry.py --preview -y
115- $env:Path += ";$env:Userprofile\.poetry\bin"
116- poetry config virtualenvs.in-project true
117- - name : Set up cache
118- uses : actions/cache@v1
119- with :
120- path : .venv
121- key : venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}
122- - name : Install dependencies
123- run : |
124- $env:Path += ";$env:Userprofile\.poetry\bin"
125- poetry install
126- - name : Test
127- run : |
128- $env:Path += ";$env:Userprofile\.poetry\bin"
129- poetry run pytest -q tests
51+ - name : Setup Poetry
52+ shell : bash
53+ run : |
54+ poetry config virtualenvs.in-project true
55+
56+ - name : Set up cache
57+ uses : actions/cache@v2
58+ id : cache
59+ with :
60+ path : .venv
61+ key : venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}
62+
63+ - name : Ensure cache is healthy
64+ if : steps.cache.outputs.cache-hit == 'true'
65+ shell : bash
66+ run : timeout 10s poetry run pip --version || rm -rf .venv
67+
68+ - name : Install dependencies
69+ shell : bash
70+ run : |
71+ poetry install
72+
73+ - name : Run tests
74+ shell : bash
75+ run : |
76+ poetry run pytest -q tests
77+ poetry install
0 commit comments