docs #61
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
| name: Quality | |
| on: | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| push: | |
| branches: | |
| - main | |
| - release/* | |
| workflow_call: | |
| inputs: | |
| static_analysis_only: | |
| description: Skip the pytest matrix after static analysis. | |
| required: false | |
| type: boolean | |
| default: false | |
| jobs: | |
| static-analysis: | |
| name: Static Analysis | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install QA dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install -e ".[qa]" | |
| - name: Ruff lint | |
| run: python -m ruff check . | |
| - name: Ruff format | |
| run: python -m ruff format --check . | |
| - name: Bandit security scan | |
| run: bandit -c pyproject.toml -r c_parser fortran_parser semantics x2py --severity-level medium --confidence-level medium | |
| - name: pip-audit dependency scan | |
| run: pip-audit . --cache-dir /tmp/pip-audit-cache | |
| - name: Vulture dead-code scan | |
| run: vulture | |
| - name: Radon complexity policy | |
| env: | |
| PR_BASE_SHA: ${{ github.event.pull_request.base.sha }} | |
| PUSH_BEFORE_SHA: ${{ github.event.before }} | |
| run: python tools/check_radon_policy.py --base-ref auto | |
| - name: Radon complexity report | |
| continue-on-error: true | |
| run: radon cc c_parser fortran_parser semantics x2py -n C -s --total-average | |
| - name: Radon maintainability report | |
| continue-on-error: true | |
| run: radon mi c_parser fortran_parser semantics x2py -s | |
| test: | |
| name: Tests (Python ${{ matrix.python-version }}) | |
| if: ${{ !inputs.static_analysis_only }} | |
| needs: static-analysis | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| id-token: write | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python-version: ["3.10", "3.11", "3.12"] | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 2 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install test dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install -e ".[qa]" | |
| - name: Run tests | |
| env: | |
| PYTHONPATH: . | |
| COVERAGE_PROCESS_START: ${{ github.workspace }}/pyproject.toml | |
| HYPOTHESIS_PROFILE: ci | |
| run: python -m coverage run -m pytest -q --randomly-seed=1 | |
| - name: Combine coverage data | |
| run: python -m coverage combine | |
| - name: Report coverage | |
| run: python -m coverage report | |
| - name: Emit coverage XML | |
| run: python -m coverage xml -o coverage.xml | |
| - name: Upload coverage to Codecov | |
| if: matrix.python-version == '3.12' | |
| uses: codecov/codecov-action@v6 | |
| with: | |
| files: ./coverage.xml | |
| flags: py312 | |
| use_oidc: true | |
| fail_ci_if_error: true | |
| # Benchmark workflow is intentionally parked for later activation. | |
| # benchmark: | |
| # if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' | |
| # runs-on: ubuntu-latest | |
| # timeout-minutes: 15 | |
| # permissions: | |
| # contents: read | |
| # steps: | |
| # - name: Checkout repository | |
| # uses: actions/checkout@v4 | |
| # - name: Set up Python | |
| # uses: actions/setup-python@v5 | |
| # with: | |
| # python-version: "3.12" | |
| # - name: Install QA dependencies | |
| # run: | | |
| # python -m pip install --upgrade pip | |
| # python -m pip install -e ".[qa]" | |
| # - name: Run parser benchmarks | |
| # env: | |
| # PYTHONPATH: . | |
| # run: python -m pytest -q tests/benchmarks -m benchmark --benchmark-only --benchmark-json=benchmark.json | |
| # - name: Upload benchmark report | |
| # uses: actions/upload-artifact@v4 | |
| # with: | |
| # name: parser-benchmark-${{ github.run_id }} | |
| # path: benchmark.json | |
| # retention-days: 90 |