Skip to content

Refactor Options to subclass dict #313

Refactor Options to subclass dict

Refactor Options to subclass dict #313

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: write
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
message-db:
image: ethangarofolo/message-db:1.2.6
ports:
- 5433:5432
steps:
- uses: actions/checkout@v4
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@v5
with:
python-version: ${{ matrix.python-version }}
- uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
curl -sSL https://install.python-poetry.org | python3 -
poetry config virtualenvs.create false
poetry install --with dev,test,docs,types --all-extras
if: steps.cache.outputs.cache-hit != 'true'
- name: Tests
run: protean test -c FULL
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/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
docs-deploy:
runs-on: ubuntu-latest
needs: test
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
- name: Configure Git Credentials
run: |
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
- uses: actions/setup-python@v5
with:
python-version: 3.x
- run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
- uses: actions/cache@v4
with:
key: mkdocs-material-${{ env.cache_id }}
path: .cache
restore-keys: |
mkdocs-material-
- name: Install dependencies
run: |
curl -sSL https://install.python-poetry.org | python3 -
poetry config virtualenvs.create false
poetry install --only docs
if: steps.cache.outputs.cache-hit != 'true'
- run: mkdocs gh-deploy --force