1
+ name : test
2
+
3
+ on : pull_request
4
+
5
+ jobs :
6
+ test :
7
+ strategy :
8
+ fail-fast : true
9
+ matrix :
10
+ os : [ "ubuntu-latest", "macos-latest" ]
11
+ python-version : [ '3.7', '3.8', '3.9', '3.10' ]
12
+ name : Python ${{ matrix.python-version }} OS ${{ matrix.os }}
13
+ runs-on : ${{ matrix.os }}
14
+ steps :
15
+ # ----------------------------------------------
16
+ # check-out repo and set-up python
17
+ # ----------------------------------------------
18
+ - name : Check out repository
19
+ uses : actions/checkout@v2
20
+ - name : Set up python ${{ matrix.python-version }}
21
+ id : setup-python
22
+ uses : actions/setup-python@v2
23
+ with :
24
+ python-version : ${{ matrix.python-version }}
25
+
26
+ # ----------------------------------------------
27
+ # ----- install & configure poetry -----
28
+ # ----------------------------------------------
29
+ - name : Install Poetry
30
+ uses : snok/install-poetry@v1
31
+ with :
32
+ version : 1.2.0
33
+ virtualenvs-path : .venv
34
+ virtualenvs-create : true
35
+ virtualenvs-in-project : false
36
+ installer-parallel : true
37
+
38
+ # ----------------------------------------------
39
+ # load cached venv if cache exists
40
+ # ----------------------------------------------
41
+ - name : Load cached venv
42
+ id : cached-poetry-dependencies
43
+ uses : actions/cache@v2
44
+ with :
45
+ path : .venv
46
+ key : venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
47
+ # ----------------------------------------------
48
+ # install dependencies if cache does not exist
49
+ # ----------------------------------------------
50
+
51
+ - name : Install dependencies
52
+ if : steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
53
+ run : poetry install --no-interaction --no-root
54
+ # ----------------------------------------------
55
+ # install your root project, if required
56
+ # ----------------------------------------------
57
+ - name : Install library
58
+ run : poetry install --no-interaction --with tests
59
+ # ----------------------------------------------
60
+ # run test suite
61
+ # ----------------------------------------------
62
+ - name : Check black
63
+ run : |
64
+ poetry add --dev black --allow-prereleases
65
+ poetry run black . --check
66
+
67
+ - name : Run tests
68
+ run : |
69
+ poetry run pytest
0 commit comments