-
-
Notifications
You must be signed in to change notification settings - Fork 180
85 lines (73 loc) · 1.81 KB
/
test-pr.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
name: Test PR
on:
pull_request:
branches:
- '*'
paths:
- '**.py'
- 'example_site/pyproject.toml'
- 'example_site/poetry.lock'
- 'example_site/tox.ini'
- '.github/workflows/test-pr.yml'
jobs:
test:
name: Test
runs-on: ubuntu-latest
strategy:
matrix:
python: [3.6, 3.9]
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Python
uses: actions/[email protected]
with:
python-version: ${{ matrix.python }}
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
- name: Setup Poetry
uses: Gr1N/setup-poetry@v3
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
- name: Install Tox
run: pip install tox
- name: Run tests
env:
DATABASE_URL: postgres://postgres:postgres@localhost/postgres
run: |
cd example_site
cp -r ../address .
tox -e py
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Python
uses: actions/[email protected]
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
- name: Setup Poetry
uses: Gr1N/setup-poetry@v3
env:
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
- name: Install dependencies
run: |
poetry install
- name: Run flake8
run: poetry run flake8
- name: Run Black
run: poetry run black --check .