-
-
Notifications
You must be signed in to change notification settings - Fork 2
109 lines (95 loc) · 2.76 KB
/
run-tests.yml
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# Checks that we can build and validate the Unittest
name: Run Tests
on:
push:
branches:
- main
pull_request:
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
- uses: pre-commit/action@v3.0.0
test:
name: Run Tests
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10']
steps:
- name: Check out the code
uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: snok/install-poetry@v1.3.3
with:
version: 1.4.0
- name: Setup Poetry
run: |
poetry config virtualenvs.in-project true
- name: Cache
id: cache
uses: actions/cache@v3.2.2
with:
path: '.venv'
key: run-tests-${{ hashFiles('poetry.lock') }}
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: |
if [ -d ".venv" ]; then rm -rf .venv; fi
poetry run pip install -U certifi
poetry install
- name: Install Package
run: |
poetry install
- name: Run Tests
run: poetry run pytest --cov=simple_pytree --cov-report=term-missing --cov-report=xml
- name: Upload coverage
uses: codecov/codecov-action@v3
test-import:
name: Test Import without Dev Dependencies
if: ${{ !contains(github.event.pull_request.title, 'WIP') }}
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.8', '3.9', '3.10']
steps:
- name: Check out the code
uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: snok/install-poetry@v1.3.3
with:
version: 1.4.0
- name: Setup Poetry
run: |
poetry config virtualenvs.in-project true
- name: Cache
id: cache
uses: actions/cache@v3.2.2
with:
path: '.venv'
key: test-import-${{ hashFiles('poetry.lock') }}
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: |
poetry run pip install -U certifi
poetry install --only main
- name: Install Package
run: |
poetry install --only main
- name: Test Import
run: |
poetry run python -c "import simple_pytree"