Skip to content

Commit

Permalink
GitHub actions tests (#4)
Browse files Browse the repository at this point in the history
* move test script into `scripts` folder

* move dev-requirements to requirements folder

* Create test-requirements.txt

* Create lint.sh

* add more version specifiers to setup.py

* add black to linter

* Create tests.yaml

* Remove Python 3.7 support - no `functools.cached_property`
  • Loading branch information
dantownsend authored Oct 10, 2022
1 parent abcb86e commit 7f2fcb8
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 4 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Test Suite

on:
push:
branches: ["master"]
pull_request:
branches: ["master"]

jobs:
linters:
runs-on: ubuntu-latest
timeout-minutes: 5
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements/dev-requirements.txt
pip install -r requirements/test-requirements.txt
- name: Lint
run: ./scripts/lint.sh

unittests:
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements/test-requirements.txt
- name: Run unittests
run: ./scripts/run-tests.sh
3 changes: 0 additions & 3 deletions dev-requirements.txt

This file was deleted.

3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[tool.black]
line-length = 79
target-version = ['py37', 'py38', 'py39', 'py310']
3 changes: 3 additions & 0 deletions requirements/dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
black
flake8
twine==4.0.1
1 change: 1 addition & 0 deletions requirements/test-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pytest
7 changes: 7 additions & 0 deletions scripts/lint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash

echo "Running black..."
black --check asyncio_tools.py

echo "Running flake8..."
flake8 asyncio_tools.py
1 change: 0 additions & 1 deletion tests/run-tests.sh → scripts/run-tests.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
#!/bin/bash
cd ..
python -m pytest -s
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: Implementation :: CPython",
],
)

0 comments on commit 7f2fcb8

Please sign in to comment.