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