-
Notifications
You must be signed in to change notification settings - Fork 2
63 lines (54 loc) · 1.6 KB
/
ci.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
name: Run tests
on:
push:
pull_request:
branches:
- main
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-22.04
services:
# Label used to access the service container
postgres:
# Docker Hub image
image: postgres:14
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: ci_test
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v4
with:
python-version: 3.11
cache: pip
cache-dependency-path: requirements.txt
- name: psycopg2 prerequisites
run: sudo apt-get install libpq-dev
- name: Install dependencies
run: |
set -xe
python -m pip install --upgrade pip
python -m venv venv
venv/bin/pip install --progress-bar=off -r requirements.txt
- name: Run tests
env:
DATABASE_URL: postgres://postgres:postgres@localhost/ci_test
run: |
source ${{ github.workspace }}/venv/bin/activate
pytest --cov-config=.coveragerc --cov=. -k 'serial'
pytest --cov-config=.coveragerc --cov=. --cov-append -n auto -k 'not serial'
- name: Coveralls
uses: AndreMiras/coveralls-python-action@develop
with:
github-token: ${{ secrets.GITHUB_TOKEN }}