Skip to content

release(4.0.1): public redaction helpers, ReDoS validator latency, phantom ban, singleton resets, path-level gates #253

release(4.0.1): public redaction helpers, ReDoS validator latency, phantom ban, singleton resets, path-level gates

release(4.0.1): public redaction helpers, ReDoS validator latency, phantom ban, singleton resets, path-level gates #253

Workflow file for this run

name: CI
on:
push:
branches:
- master
paths:
- 'compose.yml'
- 'data/**'
- 'Dockerfile'
- 'guard_core/**'
- 'mypy.ini'
- '.github/**'
- '.pre-commit-config.yaml'
- 'pyproject.toml'
- 'pytest.ini'
- 'reqs.pip'
- 'tests/**'
pull_request:
branches:
- master
paths:
- 'compose.yml'
- 'data/**'
- 'Dockerfile'
- 'guard_core/**'
- 'mypy.ini'
- '.github/**'
- '.pre-commit-config.yaml'
- 'pyproject.toml'
- 'pytest.ini'
- 'reqs.pip'
- 'tests/**'
workflow_dispatch:
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: '3.10'
- run: pip install uv
- run: uv sync --extra dev --extra otel --extra logfire
- run: uv run pre-commit run --all-files
quality:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-python@v7
with:
python-version: '3.10'
- run: pip install uv
- run: uv sync --extra dev --extra otel --extra logfire
- run: make quality
test:
runs-on: ubuntu-latest
services:
redis:
image: redis
ports:
- 6379:6379
options: >-
--health-cmd "redis-cli ping"
--health-interval 10s
--health-timeout 5s
--health-retries 5
permissions:
pull-requests: write
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
steps:
- name: Checkout code
uses: actions/checkout@v7
- name: Send Initial Slack Message
id: send_initial_slack_ci
uses: rennf93/good-comms@master
with:
SLACK_WEBHOOK: '${{ secrets.SLACK_WEBHOOK }}'
SLACK_TOKEN: ${{ secrets.SLACK_TOKEN }}
STATUS: 'Started'
CHANNEL_ID: '${{ secrets.SLACK_CHANNEL }}'
AUTHOR_NAME: 'Guard Core - CI & Tests - Py${{ matrix.python-version }}'
AUTHOR_LINK: 'https://github.com/rennf93/guard-core'
AUTHOR_ICON: ':test_tube:'
TITLE: 'CI & Tests Started - Py${{ matrix.python-version }}'
TITLE_LINK: 'https://github.com/rennf93/guard-core/actions'
MESSAGE: |
.
*CI & TESTS TRIGGERED!*
.
Matrix:
Python: ${{ matrix.python-version }}
Docs version:
${{ secrets.DOCS_VERSION }}
Commit:
${{ github.event.head_commit.message }}
.
COLOR: warning
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: ${{ matrix.python-version }}
- name: Install uv
run: |
pip install uv
- name: Install dependencies
run: |
uv sync --extra dev --extra otel --extra logfire
- name: Run tests
run: |
IPINFO_TOKEN='${{ secrets.IPINFO_TOKEN }}' REDIS_URL='redis://localhost:6379' GUARD_TESTS_MAX_TEST_SECONDS=60 uv run pytest -v --cov=guard_core --cov-fail-under=100 -W error
- name: Notify Success on Slack Channel
uses: rennf93/good-comms@master
with:
SLACK_WEBHOOK: '${{ secrets.SLACK_WEBHOOK }}'
SLACK_TOKEN: ${{ secrets.SLACK_TOKEN }}
STATUS: 'Success'
CHANNEL_ID: '${{ secrets.SLACK_CHANNEL }}'
AUTHOR_NAME: 'Guard Core - CI & Tests - Py${{ matrix.python-version }}'
AUTHOR_LINK: 'https://github.com/rennf93/guard-core'
AUTHOR_ICON: ':gem:'
TITLE: 'CI & Tests Successful - Py${{ matrix.python-version }}'
TITLE_LINK: 'https://github.com/rennf93/guard-core/actions'
MESSAGE: |
.
Matrix:
Python: ${{ matrix.python-version }}
Docs version:
${{ secrets.DOCS_VERSION }}
Commit message:
${{ github.event.head_commit.message }}
Commit URL:
${{ github.event.head_commit.url }}
.
COLOR: good
SLACK_THREAD_TS: ${{ steps.send_initial_slack_ci.outputs.SLACK_THREAD_TS }}
- name: Send Failure Notification to Slack
if: failure()
uses: rennf93/good-comms@master
with:
SLACK_WEBHOOK: '${{ secrets.SLACK_WEBHOOK }}'
SLACK_TOKEN: ${{ secrets.SLACK_TOKEN }}
STATUS: 'Failed'
CHANNEL_ID: '${{ secrets.SLACK_CHANNEL }}'
AUTHOR_NAME: 'Guard Core - CI & Tests - Py${{ matrix.python-version }}'
AUTHOR_LINK: 'https://github.com/rennf93/guard-core'
AUTHOR_ICON: ':skull:'
TITLE: 'CI & Tests Failed - Py${{ matrix.python-version }}'
TITLE_LINK: 'https://github.com/rennf93/guard-core/actions'
MESSAGE: |
.
Matrix:
Python: ${{ matrix.python-version }}
Docs version:
${{ secrets.DOCS_VERSION }}
CI & Tests failed for commit:
${{ github.event.head_commit.message }}
Commit URL:
${{ github.event.head_commit.url }}
Please check the logs for more details.
.
COLOR: danger
SLACK_THREAD_TS: ${{ steps.send_initial_slack_ci.outputs.SLACK_THREAD_TS }}
docker-test:
runs-on: ubuntu-latest
permissions:
pull-requests: write
timeout-minutes: 30
steps:
- name: Checkout code
uses: actions/checkout@v7
- name: Run tests in Docker
run: |
COMPOSE_BAKE=true PYTHON_VERSION=3.10 docker compose run --rm --build -e GUARD_TESTS_MAX_TEST_SECONDS=60 guard-core pytest -q -p no:cacheprovider -W error --ignore=tests/live_smoke --cov=guard_core --cov-branch --cov-fail-under=100
- name: Tear down Docker Compose
if: always()
run: |
docker compose down -v --remove-orphans