Repository navigation
Sample code for: AI Red Teaming in Python: Attack Your LLM Agent With PyRIT #3186
This file contains hidden or 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
| # Check that code is formatted consistently | |
| # | |
| # Available Python versions: | |
| # https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json | |
| name: linters | |
| on: | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| jobs: | |
| tests: | |
| name: ${{ matrix.name }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - {name: Linux314, python: '3.14', os: ubuntu-latest} | |
| steps: | |
| - name: Check out repository | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| id: setup-python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python }} | |
| # The cached venv links to the exact interpreter it was built with, | |
| # so the key includes the resolved patch version (for example, 3.14.10). | |
| - name: Restore cache | |
| id: cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: ./venv | |
| key: ${{ matrix.name }}-${{ steps.setup-python.outputs.python-version }}-pip-${{ hashFiles('requirements.txt') }} | |
| restore-keys: | | |
| ${{ matrix.name }}-${{ steps.setup-python.outputs.python-version }}-pip- | |
| - name: Install dependencies | |
| if: steps.cache.outputs.cache-hit != 'true' | |
| run: | | |
| python -m venv venv | |
| . venv/bin/activate | |
| python -m pip install --upgrade pip | |
| python -m pip install -r requirements.txt | |
| - name: Check code style | |
| run: | | |
| . venv/bin/activate | |
| python -m ruff format --check | |
| python -m ruff check | |
| - name: Check directory layout | |
| run: | | |
| . venv/bin/activate | |
| python .github/workflows/dircheck.py |