Skip to content

Commit 32a2e24

Browse files
authored
Add github actions for tests (#1)
1 parent 6390253 commit 32a2e24

File tree

2 files changed

+53
-3
lines changed

2 files changed

+53
-3
lines changed

.github/workflows/test.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Tests
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
strategy:
15+
matrix:
16+
python-version: [3.8, 3.9]
17+
steps:
18+
- uses: actions/checkout@v2
19+
- name: Set up Python ${{ matrix.python-version }}
20+
uses: actions/setup-python@v2
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
- name: Install Poetry
24+
uses: snok/install-poetry@v1.1.1
25+
with:
26+
version: 1.1.4
27+
virtualenvs-create: true
28+
virtualenvs-in-project: true
29+
- name: Load cached venv
30+
id: cached-poetry-dependencies
31+
uses: actions/cache@v2
32+
with:
33+
path: .venv
34+
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
35+
- name: Install dependencies
36+
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
37+
run: poetry install --no-interaction --no-root
38+
- name: Install library
39+
run: poetry install --no-interaction
40+
- name: Linting
41+
run: |
42+
poetry run tox -e isort-check
43+
poetry run tox -e black-check
44+
- name: Run tests
45+
env:
46+
TOX_ENV: py${{ matrix.python-version }}
47+
run: |
48+
poetry run tox -e $TOX_ENV

tox.ini

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
[tox]
22
isolated_build = True
33
skipsdist = True
4-
envlist = py39,py38
4+
envlist = py3.9,py3.8
55
requires =
66
tox-poetry-dev-dependencies
77

88
[tox:.package]
99
# note tox will use the same python version as under what tox is installed to package
1010
# so unless this is python 3 you can require a given python version for the packaging
1111
# environment via the basepython key
12-
basepython = python3
12+
basepython =
13+
py3.9: python3.9
14+
py3.8: python3.8
1315

1416
[testenv:isort-check]
1517
commands = isort -c --diff clerk/ tests/
@@ -18,7 +20,7 @@ commands = isort -c --diff clerk/ tests/
1820
commands = black --check clerk/ tests/
1921

2022
[testenv]
21-
env =
23+
setenv =
2224
PYTHONHASHSEED = 1
2325
deps = .
2426
commands = pytest {posargs}

0 commit comments

Comments
 (0)