Skip to content

add tool adoptions

add tool adoptions #3

Workflow file for this run

name: Quality
on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches:
- main
- release/*
schedule:
- cron: "17 3 * * 1"
workflow_dispatch:
jobs:
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 on changed Python files
if: github.event_name == 'pull_request' || github.event_name == 'push'
env:
PR_BASE_SHA: ${{ github.event.pull_request.base.sha }}
PUSH_BEFORE_SHA: ${{ github.event.before }}
run: |
set -euo pipefail
BASE_SHA="${PR_BASE_SHA:-${PUSH_BEFORE_SHA:-}}"
if [ -z "${BASE_SHA:-}" ] || [ "$BASE_SHA" = "0000000000000000000000000000000000000000" ]; then
BASE_SHA="$(git rev-list --max-parents=0 HEAD)"
fi
mapfile -t changed < <(git diff --name-only --diff-filter=ACMRT "$BASE_SHA" HEAD -- '*.py' '*.pyi')
if [ "${#changed[@]}" -eq 0 ]; then
echo "No changed Python files."
exit 0
fi
python -m ruff format --check "${changed[@]}"
- 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 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
mutation:
if: github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
timeout-minutes: 180
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 mutation tests
env:
PYTHONPATH: .
HYPOTHESIS_PROFILE: ci
run: python tools/run_mutmut.py run
fuzz:
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 bounded parser fuzz tests
env:
PYTHONPATH: .
HYPOTHESIS_PROFILE: fuzz
run: python -m pytest -q tests/property -m fuzz --hypothesis-show-statistics
random-order:
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
timeout-minutes: 30
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 tests with a changing random seed
env:
PYTHONPATH: .
run: python -m pytest -q -n auto --randomly-seed=${{ github.run_id }} --benchmark-disable
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