Skip to content

FIX HTTP targets store decoded response text and JSON keys may contain digits or hyphens #14997

FIX HTTP targets store decoded response text and JSON keys may contain digits or hyphens

FIX HTTP targets store decoded response text and JSON keys may contain digits or hyphens #14997

Workflow file for this run

# Builds the pyrit environment and runs all tests and pre-commit hooks
name: build_and_test
env:
PRE_COMMIT_PYTHON_VERSION: '3.11'
on:
push:
branches:
- "main"
- "releases/v*"
pull_request:
branches:
- "main"
- "releases/**"
merge_group:
workflow_dispatch:
concurrency:
# This ensures after each commit the old jobs are cancelled and the new ones
# run instead.
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true
jobs:
pre-commit:
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
# Full history is required so pre-commit hooks (notably
# enforce_alembic_revision_immutability) can compute merge-bases and
# diff ranges against origin/main.
fetch-depth: 0
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: ${{ env.PRE_COMMIT_PYTHON_VERSION }}
- name: Cache pre-commit environments
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ~/.cache/pre-commit
key: pre-commit-${{ runner.os }}-${{ hashFiles('.pre-commit-config.yaml') }}
restore-keys: |
pre-commit-${{ runner.os }}-
- name: Install uv
uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
with:
# Install a specific version of uv.
version: "0.9.17"
enable-cache: true
cache-dependency-glob: |
**/pyproject.toml
**/uv.lock
- name: Install dev extras
run: uv sync --extra all
- name: disk space
shell: bash
run: df -all -h
- name: Run pre-commit (all files)
# Always lint the ENTIRE repository on every event (pull_request,
# merge_group, push to main, workflow_dispatch). Running --all-files on
# PRs -- rather than only the files changed since origin/main -- ensures
# latent violations in untouched files, including the tests/integration,
# tests/partner_integration, and tests/end_to_end tiers, are caught before
# merge instead of only on the post-merge run against main.
shell: bash
run: |
git fetch origin main
if [ -n "${GITHUB_BASE_REF:-}" ]; then
git fetch origin "$GITHUB_BASE_REF"
fi
uv run pre-commit run --all-files
# Main job runs only if pre-commit succeeded
main-job:
strategy:
fail-fast: true
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python: ["3.11", "3.12", "3.13", "3.14"]
package_name: ["pyrit"]
package_extras: ["dev", "dev_all"]
runs-on: ${{ matrix.os }}
# EnricoMi/publish-unit-test-result-action@v2 requires the following permissions
permissions:
contents: read
issues: read
checks: write
pull-requests: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
# Set up Python
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: ${{ matrix.python }}
- name: Install uv
uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
with:
# Install a specific version of uv.
version: "0.9.17"
cache-dependency-glob: |
**/pyproject.toml
**/uv.lock
# Install PyRIT with optional extras
- name: Install PyRIT with uv
# If the matrix extras is 'dev_all', then we install all extras
# otherwise just install the default dependencies
shell: bash
run: |
if [ "${{ matrix.package_extras }}" = "dev_all" ]; then
uv sync --extra all
else
uv sync
fi
- name: Run unit tests
run: make unit-test-junit
- name: Upload JUnit results
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
if: (success() || failure()) && runner.os == 'Linux'
with:
name: junit-results-${{ matrix.python }}-${{ matrix.package_extras }}
path: '**/test-*.xml'
if-no-files-found: ignore
- name: Publish Pytest Results
uses: EnricoMi/publish-unit-test-result-action@d0a4676d0e0b938bc201470d88276b7c74c712b3 # v2.24.0
if: (success() || failure()) && runner.os == 'Linux'
with:
check_name: Pytest (${{ matrix.python }}, ${{ matrix.package_extras }})
files: '**/test-*.xml'