Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: CodeQL

on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
- cron: '45 5 * * 0'
workflow_dispatch:

permissions: {}

jobs:
analyze:
name: Analyze Python
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: read
security-events: write
actions: read

steps:
- name: Harden the runner
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0
with:
egress-policy: audit

- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false

- name: Initialize CodeQL
uses: github/codeql-action/init@c10b8064de6f491fea524254123dbe5e09572f13 # v4.35.1
with:
languages: python
build-mode: none
queries: security-extended,security-and-quality

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@c10b8064de6f491fea524254123dbe5e09572f13 # v4.35.1
with:
category: "/language:python"
37 changes: 37 additions & 0 deletions .github/workflows/gitleaks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Gitleaks

on:
pull_request:
branches: [main]
push:
branches: [main]
schedule:
- cron: '0 3 * * *'
workflow_dispatch:

permissions: {}

jobs:
gitleaks:
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write
actions: read

steps:
- name: Harden the runner
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0
with:
egress-policy: audit

- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false
fetch-depth: 0

- name: Run Gitleaks
uses: gitleaks/gitleaks-action@ff98106e4c7b2bc287b24eaf42907196329070c7 # v2.3.9
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38 changes: 38 additions & 0 deletions .github/workflows/mypy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Mypy

on:
pull_request:
branches: [main]
push:
branches: [main]
workflow_dispatch:

permissions:
contents: read

jobs:
mypy:
runs-on: ubuntu-latest
timeout-minutes: 10

steps:
- name: Harden the runner
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0
with:
egress-policy: audit

- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false

- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: '3.11'

- name: Install dependencies
run: pip install mypy pyyaml types-PyYAML huggingface_hub

- name: Run mypy
run: mypy --config-file=pyproject.toml
45 changes: 45 additions & 0 deletions .github/workflows/ossf-scorecard.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: OSSF Scorecard

on:
branch_protection_rule:
schedule:
- cron: '0 8 * * 1'
push:
branches: [main]
workflow_dispatch:

permissions: read-all

jobs:
analysis:
name: Scorecard analysis
runs-on: ubuntu-latest
permissions:
security-events: write
id-token: write
contents: read
actions: read

steps:
- name: Harden the runner
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0
with:
egress-policy: audit

- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false

- name: Run OSSF Scorecard
uses: ossf/scorecard-action@4eaacf0543bb3f2c246792bd56e8cdeffafb205a # v2.4.3
with:
results_file: results.sarif
results_format: sarif
publish_results: true

- name: Upload SARIF
uses: github/codeql-action/upload-sarif@c10b8064de6f491fea524254123dbe5e09572f13 # v4.35.1
with:
sarif_file: results.sarif
category: ossf-scorecard
26 changes: 26 additions & 0 deletions .github/workflows/osv-scanner.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: OSV-Scanner

on:
pull_request:
branches: [main]
push:
branches: [main]
schedule:
- cron: '39 12 * * 1'
workflow_dispatch:

permissions: {}

jobs:
scan:
permissions:
security-events: write
contents: read
actions: read
# yamllint disable-line rule:line-length
uses: "google/osv-scanner-action/.github/workflows/osv-scanner-reusable.yml@c5996e0193a3df57d695c1b8a1dec2a4c62e8730" # v2.3.3
with:
scan-args: |-
-r
--skip-git
./
60 changes: 60 additions & 0 deletions .github/workflows/semgrep.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Semgrep

on:
pull_request:
branches: [main]
push:
branches: [main]
schedule:
- cron: '0 4 * * 1'
workflow_dispatch:

permissions: {}

jobs:
semgrep:
name: Semgrep scan
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
contents: read
security-events: write
actions: read

steps:
- name: Harden the runner
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0
with:
egress-policy: audit

- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false

- name: Set up Python
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
with:
python-version: '3.11'

- name: Install Semgrep
run: pip install semgrep

- name: Run Semgrep
run: |
semgrep scan \
--config p/default \
--config p/python \
--config p/security-audit \
--config p/secrets \
--config p/owasp-top-ten \
--sarif --output=semgrep.sarif \
--error
continue-on-error: true

- name: Upload SARIF
if: always()
uses: github/codeql-action/upload-sarif@c10b8064de6f491fea524254123dbe5e09572f13 # v4.35.1
with:
sarif_file: semgrep.sarif
category: semgrep
45 changes: 45 additions & 0 deletions .github/workflows/zizmor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Zizmor

on:
pull_request:
paths:
- '.github/workflows/**'
push:
branches: [main]
paths:
- '.github/workflows/**'
schedule:
- cron: '0 9 * * 1'
workflow_dispatch:

permissions:
contents: read

jobs:
zizmor:
name: Lint workflows
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
contents: read
security-events: write
actions: read

steps:
- name: Harden Runner
uses: step-security/harden-runner@fa2e9d605c4eeb9fcad4c99c224cee0c6c7f3594 # v2.16.0
with:
egress-policy: audit

- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false

- name: Run zizmor
uses: zizmorcore/zizmor-action@71321a20a9ded102f6e9ce5718a2fcec2c4f70d8 # v0.5.2
with:
inputs: .github/workflows/
min-severity: low
advanced-security: true
token: ${{ secrets.GITHUB_TOKEN }}
8 changes: 6 additions & 2 deletions .yamllint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@ extends: default

rules:
line-length:
max: 200
level: warning
max: 120
level: error
document-start: disable
truthy:
check-keys: false
level: error
comments:
min-spaces-from-content: 1
indentation:
spaces: 2
indent-sequences: consistent
empty-lines:
max: 2
trailing-spaces: enable
58 changes: 58 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
[project]
name = "ldr-benchmarks"
version = "0.0.0"
description = "Community benchmark scripts for Local Deep Research"
requires-python = ">=3.11"

[tool.ruff]
line-length = 100
target-version = "py311"

[tool.ruff.lint]
select = [
"E", # pycodestyle errors
"W", # pycodestyle warnings
"F", # pyflakes
"I", # isort
"B", # flake8-bugbear
"UP", # pyupgrade
"SIM", # flake8-simplify
"S", # flake8-bandit (security)
"C4", # flake8-comprehensions
"RUF", # ruff-specific
"PTH", # use pathlib
"PL", # pylint
"TRY", # tryceratops
]
ignore = [
"PLR0913", # too many arguments
"PLR2004", # magic value comparison
"TRY003", # long exception messages
"S603", # subprocess-without-shell-equals-true (we use list args)
"S607", # start-process-with-partial-path (git is on PATH)
]

[tool.ruff.lint.per-file-ignores]
"tests/*" = ["S101", "PLR2004"] # asserts and magic values OK in tests
"scripts/validate_yamls.py" = ["PLR0912", "PLR0915"] # validator naturally branchy

[tool.mypy]
python_version = "3.11"
files = ["scripts"]
warn_unused_configs = true
warn_redundant_casts = true
warn_unused_ignores = true
no_implicit_optional = true
check_untyped_defs = true
disallow_untyped_defs = true
disallow_incomplete_defs = true
disallow_untyped_decorators = true
warn_return_any = true

[[tool.mypy.overrides]]
module = "yaml"
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = "huggingface_hub"
ignore_missing_imports = true
Loading
Loading