Skip to content

Commit 406c196

Browse files
authored
Switch to poetry-based workflow (#6)
1 parent 024b1bb commit 406c196

File tree

1 file changed

+35
-20
lines changed

1 file changed

+35
-20
lines changed

.github/workflows/testing.yml

Lines changed: 35 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,50 @@
1-
# This workflow will install Python dependencies, run tests and lint with a single version of Python
2-
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3-
4-
name: Python application
1+
name: Testing
52

63
on:
74
push:
8-
branches: [ main ]
5+
branches: [ master ]
96
pull_request:
10-
branches: [ main ]
7+
branches: [ master ]
118

129
jobs:
1310
build:
1411

1512
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
python-version: [ 3.8, 3.9 ]
1616

1717
steps:
18-
- uses: actions/checkout@v2
19-
- name: Set up Python 3.9
18+
- name: Checkout
19+
uses: actions/checkout@v2
20+
21+
- name: Set up Python ${{ matrix.python-version }}
2022
uses: actions/setup-python@v2
2123
with:
22-
python-version: 3.9
24+
python-version: ${{ matrix.python-version }}
25+
26+
- name: Install Poetry
27+
uses: snok/install-poetry@v1
28+
with:
29+
virtualenvs-create: true
30+
virtualenvs-in-project: true
31+
installer-parallel: true
32+
33+
- name: Load cached venv
34+
id: cached-poetry-dependencies
35+
uses: actions/cache@v2
36+
with:
37+
path: .venv
38+
key: venv-${{ runner.os }}-${{ hashFiles('**/poetry.lock') }}
39+
2340
- name: Install dependencies
41+
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
42+
run: poetry install --no-interaction --no-root
43+
44+
- name: Install library
45+
run: poetry install --no-interaction
46+
47+
- name: Run tests
2448
run: |
25-
python -m pip install --upgrade pip
26-
pip install flake8 pytest pytest-asyncio pytest-httpx yarl httpx
27-
- name: Lint with flake8
28-
run: |
29-
# stop the build if there are Python syntax errors or undefined names
30-
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
31-
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
32-
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
33-
- name: Test with pytest
34-
run: |
35-
pytest
49+
source .venv/bin/activate
50+
pytest tests/

0 commit comments

Comments
 (0)