-
Notifications
You must be signed in to change notification settings - Fork 95
81 lines (68 loc) · 2.93 KB
/
ci.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: CI
on: [push, pull_request, workflow_dispatch]
jobs:
tests:
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9, "3.10", "3.11"]
# Current (1.7.1) version of poetry doesn't support python < 3.8, and poetry 1.1.13 is the last version with
# python 3.6 support, so use it for both python 3.6 and 3.7
include:
- poetry-version: 1.7.1
- python-version: 3.6
poetry-version: 1.1.13
- python-version: 3.7
poetry-version: 1.1.13
fail-fast: false
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Load cached Poetry installation
id: cached-poetry
uses: actions/cache@v3
with:
path: ~/.local # the path depends on the OS
key: poetry-${{ matrix.poetry-version }}-${{ matrix.python-version }}
- name: Install Poetry
if: steps.cached-poetry.outputs.cache-hit != 'true'
uses: snok/install-poetry@v1
with:
version: ${{ matrix.poetry-version }}
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Unset unsupported group directive from pyproject.toml for poetry 1.1.13
if: matrix.poetry-version == '1.1.13'
# removing the section and one string after it, that contains sphinx dependency, that isn't needed for these
# tests anyway
run: sed -i '/\[tool.poetry.group.docs.dependencies\]/,+1 d' pyproject.toml
# Checking pyproject.toml just in case
- name: Check pyproject.toml validity
run: poetry check --no-interaction
# The lock file format has changed since 1.1.3, so we just recreate it.
# Be aware that it will have different versions, than the repository lock file.
- name: Recreate lock file (for poetry 1.1.13)
if: matrix.poetry-version == '1.1.13'
# poetry.lock should be deleted before recreating it, or an error occurs
run: rm poetry.lock && poetry lock
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
# --no-root because it makes no sense to install our package into cache.
run: poetry install --no-interaction --no-root
# If we would need our package installed - here is the way. But we don't.
# - name: Install project
# run: poetry install --no-interaction
- name: Run tests
run: |
poetry run python -m unittest tests.tests