Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Tests

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.8, 3.9]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: snok/install-poetry@v1.1.1
with:
version: 1.1.4
virtualenvs-create: true
virtualenvs-in-project: true
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v2
with:
path: .venv
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
- name: Install library
run: poetry install --no-interaction
- name: Linting
run: |
poetry run tox -e isort-check
poetry run tox -e black-check
- name: Run tests
env:
TOX_ENV: py${{ matrix.python-version }}
run: |
poetry run tox -e $TOX_ENV
8 changes: 5 additions & 3 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
[tox]
isolated_build = True
skipsdist = True
envlist = py39,py38
envlist = py3.9,py3.8
requires =
tox-poetry-dev-dependencies

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

[testenv:isort-check]
commands = isort -c --diff clerk/ tests/
Expand All @@ -18,7 +20,7 @@ commands = isort -c --diff clerk/ tests/
commands = black --check clerk/ tests/

[testenv]
env =
setenv =
PYTHONHASHSEED = 1
deps = .
commands = pytest {posargs}
Expand Down