-
Notifications
You must be signed in to change notification settings - Fork 60
65 lines (62 loc) · 1.95 KB
/
pr.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
name: hammer-pr-ci
on:
pull_request:
branches:
- master
push:
branches:
- master
env:
POETRY_VERSION: "1.5.0"
jobs:
tests:
runs-on: ubuntu-latest
continue-on-error: true
outputs:
pytestOutput: ${{ steps.unit-tests.outputs.test }}
mypyOutput: ${{ steps.type-checks.outputs.test }}
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11"]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Load Cached Poetry Install
id: cached-poetry
uses: actions/cache@v3
with:
path: ~/.local
key: poetry-${{ runner.os }}-${{ matrix.python-version }}-${{ env.POETRY_VERSION }}
- name: Install Poetry
uses: snok/install-poetry@v1
if: steps.cached-poetry.outputs.cache-hit != 'true'
with:
virtualenvs-create: true
virtualenvs-in-project: true
version: ${{ env.POETRY_VERSION }}
- name: Load Cached Poetry virtualenv
id: cached-venv
uses: actions/cache@v3
with:
path: .venv
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Create Poetry env
if: steps.cached-venv.outputs.cache-hit != 'true'
run: |
poetry config virtualenvs.in-project true
poetry install --no-ansi
- name: Run unit tests
id: unit-tests
run: |
poetry run pytest tests/ -v
- name: Type checking
id: type-checks
run: |
touch .venv/lib/python${{ matrix.python-version }}/site-packages/ruamel/py.typed
touch .venv/lib/python${{ matrix.python-version }}/site-packages/networkx/py.typed
poetry run mypy --namespace-packages -p hammer
poetry run mypy --namespace-packages -p tests