1
+ # Related documentation:
2
+ # https://jacobian.org/til/github-actions-poetry/
3
+ # https://github.com/snok/install-poetry
1
4
name : m000/j2cli
2
5
on :
3
6
push :
@@ -9,13 +12,51 @@ concurrency:
9
12
cancel-in-progress : true
10
13
jobs :
11
14
test :
12
- runs-on : ubuntu-latest
13
- env :
14
- TOXENV : py3.10-pyyaml6
15
+ strategy :
16
+ fail-fast : false
17
+ matrix :
18
+ os : [ "ubuntu-latest" ]
19
+ python-version : [ "3.10", "3.11" ]
20
+ runs-on : ${{ matrix.os }}
21
+ # env:
22
+ # TOXENV: py${{ matrix.python-version }}-pyyaml6
15
23
steps :
16
- - uses : actions/checkout@v4.1.0
17
- - uses : actions/setup-python@v4.7.0
24
+ - name : Repository checkout
25
+ uses : actions/checkout@v4
26
+ - name : Python ${{ matrix.python-version }} setup
27
+ uses : actions/setup-python@v4
18
28
with :
19
- python-version : " 3.10"
20
- - run : pip install tox
21
- - run : tox
29
+ python-version : ${{ matrix.python-version }}
30
+ - name : Load cached Poetry installation
31
+ id : cached-poetry
32
+ uses : actions/cache@v3
33
+ with :
34
+ path : ~/.local # the path depends on the OS
35
+ key : poetry-0 # increment to reset cache
36
+ - name : Install Poetry
37
+ if : steps.cached-poetry.outputs.cache-hit != 'true'
38
+ uses : snok/install-poetry@v1
39
+ with :
40
+ version : 1.7.0
41
+ virtualenvs-create : true
42
+ virtualenvs-in-project : true # create .venv in test directory
43
+ - name : Install Poetry development dependencies # main dependencies are handled by tox
44
+ if : steps.cached-poetry.outputs.cache-hit != 'true'
45
+ run : poetry install --no-interaction --no-root --only=dev
46
+ - name : Load cached tox environment
47
+ id : cached-toxenv
48
+ uses : actions/cache@v3
49
+ with :
50
+ path : .tox/py${{ matrix.python-version }}-**
51
+ key : toxenv-py${{ matrix.python-version }}-${{ hashFiles('tox.ini') }}
52
+ - name : Tox tests (py${{ matrix.python-version }})
53
+ run : poetry run tox
54
+ - name : Send coverage reports to Codecov
55
+ uses : codecov/codecov-action@v3
56
+ with :
57
+ token : ${{ secrets.CODECOV_TOKEN }}
58
+ # files: ./coverage1.xml,./coverage2.xml # optional
59
+ # flags: unittests # optional
60
+ # name: codecov-umbrella # optional
61
+ fail_ci_if_error : false
62
+ verbose : true
0 commit comments