mirror of
https://github.com/trailofbits/algo.git
synced 2026-08-29 11:19:40 +02:00
* ci: modernize tooling with prek, ty, and security scanning Migrate from pre-commit to prek (Rust-native, faster hooks) and add comprehensive CI improvements for code quality and security. Changes: - Replace pre-commit with prek for git hooks - Add ty type checker (Rust-based, replaces mypy) - Expand ruff rules: security (S), simplify (SIM), commented code (ERA) - Add pip-audit workflow for Python dependency CVE scanning - Add actionlint and zizmor for GitHub Actions linting/security - Add ruff format check to CI - Enable stricter ansible-lint rules (no-changed-when, risky-file-permissions) - Remove obsolete Claude workflow files - Apply ruff formatting fixes to test files Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(ci): resolve actionlint install and ty type errors - Use actionlint's official install script instead of broken URL pattern - Exclude test mock modules from ty type checking - Run workflows on push only for main/master to avoid duplicate PR runs Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(ci): use glob pattern for actionlint, exclude all tests from ty - actionlint requires *.yml glob, not directory path - Exclude all tests from ty type checking (test code has looser typing) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(ci): quote shell variables to fix shellcheck warnings Fix SC2046/SC2086 warnings in workflow scripts: - Quote $(uname -r) in apt-get install - Quote $(pwd) in docker volume mount - Quote $existing in gh issue comment Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(ci): move key-order[task] to warn_list Too many existing violations in the codebase to enable as error. Move to warn_list for gradual fixes over time. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
70 lines
2.2 KiB
YAML
70 lines
2.2 KiB
YAML
---
|
|
name: Test Effectiveness Tracking
|
|
|
|
'on':
|
|
schedule:
|
|
- cron: '0 0 * * 0' # Weekly on Sunday
|
|
workflow_dispatch: # Allow manual runs
|
|
|
|
permissions:
|
|
contents: write
|
|
issues: write
|
|
pull-requests: read
|
|
actions: read
|
|
|
|
jobs:
|
|
track-effectiveness:
|
|
name: Analyze Test Effectiveness
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@0c366fd6a839edf440554fa01a7085ccba70ac98 # v5.0.1
|
|
with:
|
|
persist-credentials: true
|
|
|
|
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
|
|
with:
|
|
python-version: '3.11'
|
|
|
|
- name: Analyze test effectiveness
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
run: |
|
|
python scripts/track-test-effectiveness.py
|
|
|
|
- name: Upload metrics
|
|
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
|
|
with:
|
|
name: test-effectiveness-metrics
|
|
path: .metrics/
|
|
|
|
- name: Create issue if tests are ineffective
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
run: |
|
|
# Check if we need to create an issue
|
|
if grep -q "⚠️" .metrics/test-effectiveness-report.md; then
|
|
# Check if issue already exists
|
|
existing=$(gh issue list --label "test-effectiveness" --state open --json number --jq '.[0].number')
|
|
|
|
if [ -z "$existing" ]; then
|
|
gh issue create \
|
|
--title "Test Effectiveness Review Needed" \
|
|
--body-file .metrics/test-effectiveness-report.md \
|
|
--label "test-effectiveness,maintenance"
|
|
else
|
|
# Update existing issue
|
|
gh issue comment "$existing" --body-file .metrics/test-effectiveness-report.md
|
|
fi
|
|
fi
|
|
|
|
- name: Commit metrics if changed
|
|
run: |
|
|
git config --local user.email "github-actions[bot]@users.noreply.github.com"
|
|
git config --local user.name "github-actions[bot]"
|
|
|
|
if [[ -n $(git status -s .metrics/) ]]; then
|
|
git add .metrics/
|
|
git commit -m "chore: Update test effectiveness metrics [skip ci]"
|
|
git push
|
|
fi
|