-
Notifications
You must be signed in to change notification settings - Fork 27
61 lines (55 loc) · 1.54 KB
/
test.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
name: Test Python
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
services:
postgres:
image: postgres
env:
POSTGRES_DATABASE: test
POSTGRES_PASSWORD: test
POSTGRES_USER: test
POSTGRES_HOST_AUTH_METHOD: trust
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
# Python & dependency installation
- uses: actions/checkout@v3
- name: setup Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: install Poetry
uses: snok/[email protected]
- name: cache Poetry virtualenv
uses: actions/cache@v3
id: cache
with:
path: ~/.virtualenvs/
key: poetry-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
poetry-${{ hashFiles('**/poetry.lock') }}
- name: set poetry config path
run: poetry config virtualenvs.path ~/.virtualenvs
- name: install dependencies
run: poetry install
- name: lint with flake8
run: poetry run flake8 --show-source --statistics --ignore=E203,E501,W503
- name: lint with mypy
run: poetry run mypy openstates
- name: pytest
run: poetry run pytest --cov-report=xml --cov=openstates --ds=openstates.test_settings --reuse-db -v openstates
env:
DATABASE_URL: postgresql://test:test@localhost/test