Skip to content

Commit 2c16700

Browse files
committed
Test CI/CD Workflow
1 parent cb34639 commit 2c16700

File tree

3 files changed

+101
-1
lines changed

3 files changed

+101
-1
lines changed

.github/workflows/test.yaml

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
name: test
2+
3+
on: push
4+
5+
jobs:
6+
linting:
7+
runs-on: ubuntu-latest
8+
steps:
9+
#----------------------------------------------
10+
# check-out repo and set-up python
11+
#----------------------------------------------
12+
- uses: actions/checkout@v2
13+
- uses: actions/setup-python@v2
14+
#----------------------------------------------
15+
# load pip cache if cache exists
16+
#----------------------------------------------
17+
- uses: actions/cache@v2
18+
with:
19+
path: ~/.cache/pip
20+
key: ${{ runner.os }}-pip
21+
restore-keys: ${{ runner.os }}-pip
22+
#----------------------------------------------
23+
# install and run linters
24+
#----------------------------------------------
25+
- run: python -m pip install black flake8 isort
26+
- run: |
27+
flake8 .
28+
black . --check
29+
isort .
30+
test:
31+
needs: linting
32+
strategy:
33+
fail-fast: true
34+
matrix:
35+
python-version: [ "3.7", "3.8", "3.9", "3.10" ]
36+
runs-on: "ubuntu-latest"
37+
steps:
38+
#----------------------------------------------
39+
# check-out repo and set-up python
40+
#----------------------------------------------
41+
- name: Check out repository
42+
uses: actions/checkout@v2
43+
- name: Set up python ${{ matrix.python-version }}
44+
id: setup-python
45+
uses: actions/setup-python@v2
46+
with:
47+
python-version: ${{ matrix.python-version }}
48+
#----------------------------------------------
49+
# ----- install & configure poetry -----
50+
#----------------------------------------------
51+
- name: Install Poetry
52+
uses: snok/install-poetry@v1
53+
with:
54+
virtualenvs-create: true
55+
virtualenvs-in-project: true
56+
#----------------------------------------------
57+
# load cached venv if cache exists
58+
#----------------------------------------------
59+
- name: Load cached venv
60+
id: cached-poetry-dependencies
61+
uses: actions/cache@v2
62+
with:
63+
path: .venv
64+
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
65+
#----------------------------------------------
66+
# install dependencies if cache does not exist
67+
#----------------------------------------------
68+
- name: Install dependencies
69+
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
70+
run: poetry install --no-interaction --no-root
71+
#----------------------------------------------
72+
# install your root project, if required
73+
#----------------------------------------------
74+
- name: Install library
75+
run: poetry install --no-interaction
76+
77+
- name: Run tests
78+
run: |
79+
source .venv/bin/activate
80+
pytest tests/
81+
coverage report

poetry.lock

Lines changed: 19 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ pyhumps = "^3.7.2"
1515
pytest = "^7.1.2"
1616
mypy = "^0.961"
1717
flake8 = "^4.0.1"
18+
isort = "^5.10.1"
1819

1920
[build-system]
2021
requires = ["poetry-core>=1.0.0"]

0 commit comments

Comments
 (0)