Skip to content

Upgrade packages and fix pytest warnings (#388) #97

Upgrade packages and fix pytest warnings (#388)

Upgrade packages and fix pytest warnings (#388) #97

Workflow file for this run

name: CI
on:
push:
branches: [master]
pull_request:
branches: [master]
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11", "3.12"]
name: Python ${{ matrix.python-version }} Tests
services:
postgres:
# Docker Hub image
image: postgres:11
# Provide the password for postgres
env:
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
# Label used to access the service container
redis:
# Docker Hub image
image: redis
# Set health checks to wait until redis has started
ports:
# Maps port 6379 on service container to the host
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 1
- name: Configure sysctl limits
run: |
sudo swapoff -a
sudo sysctl -w vm.swappiness=1
sudo sysctl -w fs.file-max=262144
sudo sysctl -w vm.max_map_count=262144
- name: Run Elasticsearch
uses: elastic/elastic-github-actions/elasticsearch@master
with:
stack-version: 7.12.0
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- uses: actions/cache@v1
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
pip install setuptools
pip install .[test]
if: steps.cache.outputs.cache-hit != 'true'
- name: Tests
run: pytest --slow --sqlite --postgresql --elasticsearch --redis --cov=protean --cov-config .coveragerc tests
env:
TEST_CMD: pre-commit run --all-files
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
POSTGRES_PORT: ${{ job.services.postgres.ports[5432] }}
PGPASSWORD: postgres
# The hostname used to communicate with the Redis service container
REDIS_HOST: localhost
# The default Redis port
REDIS_PORT: ${{ job.services.redis.ports[6379] }}
- name: CodeCOV
uses: codecov/codecov-action@v3
env:
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
POSTGRES_PORT: ${{ job.services.postgres.ports[5432] }}
PGPASSWORD:
postgres
# The hostname used to communicate with the Redis service container
REDIS_HOST: localhost
# The default Redis port
REDIS_PORT: ${{ job.services.redis.ports[6379] }}