Memberships #359
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |