MAINT add skeleton frontend #6436
Workflow file for this run
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
| # 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" | |
| pull_request: | |
| branches: | |
| - "main" | |
| - "release/**" | |
| 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.run_id }} | |
| cancel-in-progress: true | |
| jobs: | |
| pre-commit-linux: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: actions/setup-python@v3 | |
| with: | |
| python-version: ${{ env.PRE_COMMIT_PYTHON_VERSION }} | |
| - name: Cache pre-commit environments | |
| uses: actions/cache@v3 | |
| 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@v7 | |
| 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 dev --extra all | |
| - name: disk space | |
| run: df -all -h | |
| - name: Run pre-commit incrementally (on PR) | |
| if: github.event_name == 'pull_request' | |
| env: | |
| RUN_LONG_PRECOMMIT: true | |
| run: | | |
| git fetch origin main | |
| uv run pre-commit run --from-ref origin/main --to-ref HEAD | |
| - name: Run pre-commit fully (on main) | |
| if: github.ref == 'refs/heads/main' | |
| env: | |
| RUN_LONG_PRECOMMIT: true | |
| run: | | |
| uv run pre-commit run --all-files | |
| pre-commit-windows: | |
| runs-on: windows-latest | |
| permissions: | |
| contents: read | |
| defaults: | |
| run: | |
| shell: pwsh | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - uses: actions/setup-python@v3 | |
| with: | |
| python-version: ${{ env.PRE_COMMIT_PYTHON_VERSION }} | |
| - name: Cache pre-commit environments | |
| uses: actions/cache@v3 | |
| 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@v7 | |
| 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 dev --extra all | |
| - name: disk space | |
| run: df -all -h | |
| - name: Run pre-commit incrementally (on PR) | |
| if: github.event_name == 'pull_request' | |
| env: | |
| RUN_LONG_PRECOMMIT: true | |
| run: | | |
| git fetch origin main | |
| uv run pre-commit run --from-ref origin/main --to-ref HEAD | |
| - name: Run pre-commit fully (on main) | |
| if: github.ref == 'refs/heads/main' | |
| env: | |
| RUN_LONG_PRECOMMIT: true | |
| run: | | |
| 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] | |
| python: ["3.10", "3.11", "3.12", "3.13"] | |
| 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@v3 | |
| # Set up Python | |
| - uses: actions/setup-python@v3 | |
| with: | |
| python-version: ${{ matrix.python }} | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| 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 '.[dev,all]' | |
| # otherwise just install the literal extras from the matrix | |
| shell: bash | |
| run: | | |
| if [ "${{ matrix.package_extras }}" = "dev_all" ]; then | |
| uv sync --extra dev --extra all | |
| else | |
| uv sync --extra dev | |
| fi | |
| - name: Run unit tests with code coverage | |
| run: make unit-test-cov-xml | |
| - name: Publish Pytest Results | |
| uses: EnricoMi/publish-unit-test-result-action@v2 | |
| if: runner.os == 'ubuntu-latest' | |
| with: | |
| files: '**/test-*.xml' | |
| - name: Code Coverage Report | |
| uses: irongut/CodeCoverageSummary@v1.3.0 | |
| if: runner.os == 'ubuntu-latest' | |
| with: | |
| filename: coverage.xml | |
| badge: true | |
| fail_below_min: false | |
| format: markdown | |
| hide_branch_rate: false | |
| hide_complexity: true | |
| indicators: true | |
| output: both | |
| thresholds: '60 80' |