build(deps): bump sqlalchemy from 2.0.36 to 2.0.37 #650
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: tests | |
on: | |
push: | |
env: | |
PYTHON_VERSION: '3.12' | |
POETRY_VERSION: '1.8.3' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
id: setup-python | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
version: ${{ env.POETRY_VERSION }} | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
virtualenvs-path: .venv | |
installer-parallel: true | |
- name: Load cached venv | |
id: cached-poetry-dependencies | |
uses: actions/cache@v4 | |
with: | |
path: .venv | |
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} | |
- name: poetry install | |
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' | |
run: poetry install --no-interaction | |
test_first_update_keywords: | |
needs: build | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:15 | |
env: | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_USER: user | |
POSTGRES_DB: postgres | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5432:5432 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
id: setup-python | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
version: ${{ env.POETRY_VERSION }} | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
virtualenvs-path: .venv | |
installer-parallel: true | |
- name: Load cached venv | |
id: cached-poetry-dependencies | |
uses: actions/cache@v4 | |
with: | |
path: .venv | |
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} | |
- name: pytest run test_first_update_keywords | |
run: | | |
set -o pipefail | |
source .venv/bin/activate | |
poetry run pytest -k 'test_update_pg_keywords' | |
env: | |
ENV: dev | |
POSTGRES_USER: user | |
POSTGRES_DB: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_HOST: localhost | |
POSTGRES_PORT: 5432 | |
COMPARE_DURATION: "true" | |
stop_word: | |
needs: build | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:15 | |
env: | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_USER: user | |
POSTGRES_DB: postgres | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5432:5432 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
id: setup-python | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
version: ${{ env.POETRY_VERSION }} | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
virtualenvs-path: .venv | |
installer-parallel: true | |
- name: Load cached venv | |
id: cached-poetry-dependencies | |
uses: actions/cache@v4 | |
with: | |
path: .venv | |
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} | |
- name: pytest run stop_word | |
run: | | |
set -o pipefail | |
source .venv/bin/activate | |
poetry run pytest -k 'stop_word' | |
env: | |
ENV: dev | |
POSTGRES_USER: user | |
POSTGRES_DB: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_HOST: localhost | |
POSTGRES_PORT: 5432 | |
COMPARE_DURATION: "true" | |
test_everything_else: | |
needs: build | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:15 | |
env: | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_USER: user | |
POSTGRES_DB: postgres | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5432:5432 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
id: setup-python | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
version: ${{ env.POETRY_VERSION }} | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
virtualenvs-path: .venv | |
installer-parallel: true | |
- name: Load cached venv | |
id: cached-poetry-dependencies | |
uses: actions/cache@v4 | |
with: | |
path: .venv | |
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} | |
- name: docker compose up nginx | |
run: docker compose up -d nginxtest | |
- name: pytest run everything else | |
run: | | |
set -o pipefail | |
source .venv/bin/activate | |
poetry run pytest -k 'not test_update_pg_keywords and not stop_word' --junitxml=pytest.xml \ | |
--cov-report=term-missing:skip-covered \ | |
--cov=quotaclimat --cov=postgres test/ | \ | |
tee pytest-coverage.txt | |
env: | |
ENV: dev | |
POSTGRES_USER: user | |
POSTGRES_DB: postgres | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_HOST: localhost | |
POSTGRES_PORT: 5432 | |
COMPARE_DURATION: "true" | |
- name: Archive code coverage results | |
uses: actions/upload-artifact@v4 | |
with: | |
retention-days: 1 | |
name: code-coverage-report | |
path: | # from pytest run everything else job | |
pytest.xml | |
pytest-coverage.txt | |
overwrite: true | |
verify_poetry_lock: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
id: setup-python | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
version: ${{ env.POETRY_VERSION }} | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
virtualenvs-path: .venv | |
installer-parallel: true | |
- name: Load cached venv | |
id: cached-poetry-dependencies | |
uses: actions/cache@v4 | |
with: | |
path: .venv | |
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} | |
- name: Verify poetry.lock agrees with pyproject.toml | |
run: poetry check --lock | |
coverage_and_reporting: | |
needs: [test_first_update_keywords, test_everything_else, stop_word, verify_poetry_lock] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
id: setup-python | |
with: | |
python-version: ${{ env.PYTHON_VERSION }} | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
version: ${{ env.POETRY_VERSION }} | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
virtualenvs-path: .venv | |
installer-parallel: true | |
- name: Load cached venv | |
id: cached-poetry-dependencies | |
uses: actions/cache@v4 | |
with: | |
path: .venv | |
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} | |
- name: Download a single artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: code-coverage-report | |
- name: Pytest coverage comment | |
if: github.actor != 'dependabot[bot]' | |
id: coverageComment | |
uses: MishaKav/pytest-coverage-comment@main | |
with: | |
pytest-coverage-path: pytest-coverage.txt | |
junitxml-path: ./pytest.xml | |
- name: Check the output coverage | |
if: github.actor != 'dependabot[bot]' | |
run: | | |
echo "Coverage Percentage - ${{ steps.coverageComment.outputs.coverage }}" | |
- name: Create Awesome Badge | |
if: github.ref == 'refs/heads/main' | |
uses: schneegans/[email protected] | |
with: | |
auth: ${{ secrets.GIST_SECRET }} | |
gistID: 579237daab71afbb359338e2706b7f36 | |
filename: test.json | |
label: Coverage | |
message: "${{ steps.coverageComment.outputs.tests }} tests - ${{ steps.coverageComment.outputs.coverage }}" | |
color: ${{ steps.coverageComment.outputs.color }} | |
namedLogo: python |