Skip to content

feat: Make instrumentator work with just Starlette #204

feat: Make instrumentator work with just Starlette

feat: Make instrumentator work with just Starlette #204

Workflow file for this run

name: CI
#
# Primary workflow for continues integration.
#
on:
workflow_dispatch:
pull_request:
push:
branches: [master, dev]
schedule:
# At 04:04 on Monday.
- cron: 4 4 * * 1
env:
poetry_version: "1.8.2"
jobs:
ci:
name: CI
strategy:
fail-fast: false
matrix:
python-version: ["3.12", "3.8"]
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
# ------------------------------------------------------------------------
# Python & Poetry.
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Cache Poetry installation
uses: actions/cache@v4
with:
path: |
~/.local/bin/poetry
~/.local/share/pypoetry
key: |-
${{ runner.os }}-poetry-installation-${{ matrix.python-version }}-${{ env.poetry_version }}-0
- name: Install Poetry
run: curl -sSL https://install.python-poetry.org | python -
env:
POETRY_VERSION: ${{ env.poetry_version }}
- name: Cache Poetry cache
uses: actions/cache@v4
with:
path: ~/.cache/pypoetry
key: |-
${{ runner.os }}-poetry-cache-${{ matrix.python-version }}-${{ env.poetry_version }}-${{ hashFiles('poetry.lock') }}-0
restore-keys: |
${{ runner.os }}-poetry-cache-${{ matrix.python-version }}-${{ env.poetry_version }}-
${{ runner.os }}-poetry-cache-${{ matrix.python-version }}-
- name: Install deps with Poetry
run: poetry install --no-interaction
# ------------------------------------------------------------------------
# Tests.
- name: Run tests with Pytest
run: |
poetry run pytest --cov-report=term-missing --cov-report=xml --cov=src
- name: Run multi process tests with Pytest
run: |
export PROMETHEUS_MULTIPROC_DIR=/tmp/pfi-tests/multiproc
rm -rf $PROMETHEUS_MULTIPROC_DIR
mkdir -p $PROMETHEUS_MULTIPROC_DIR
poetry run pytest -k test_multiproc \
--cov-append --cov-report=term-missing --cov-report=xml --cov=src
- name: Upload coverage to Codecov
if: strategy.job-index == 0
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
- name: Check version equality
run: |
pattern="__version__ = \"$(poetry version --short)\""
if ! grep -q -R -F --include="__init__.py" "$pattern" src; then
echo "::error::Version set with Poetry does not match __version__ variable."; exit 1
fi