Skip to content

Commit

Permalink
add no-llm tests into pre-commit hook
Browse files Browse the repository at this point in the history
  • Loading branch information
davorrunje committed Oct 9, 2024
1 parent 8918857 commit fb72bed
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/pipeline.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ jobs:
pre-commit-check:
runs-on: ubuntu-latest
env:
SKIP: "static-analysis"
SKIP: "static-analysis, test"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
Expand Down
11 changes: 11 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,17 @@ repos:
require_serial: true
verbose: true

- repo: local
hooks:
- id: test
name: Test
entry: "scripts/test-no-llm-pre-commit.sh"
language: python
# language_version: python3.9
types: [python]
require_serial: true
verbose: true

- repo: local
hooks:
- id: static-analysis
Expand Down
32 changes: 32 additions & 0 deletions scripts/test-no-llm-pre-commit.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env bash

# from: https://jaredkhan.com/blog/mypy-pre-commit

# A script for running mypy,
# with all its dependencies installed.

set -o errexit

# Change directory to the project root directory.
cd "$(dirname "$0")"/..

# Install the dependencies into the mypy env.
# Note that this can take seconds to run.
# In my case, I need to use a custom index URL.
# Avoid pip spending time quietly retrying since
# likely cause of failure is lack of VPN connection.
pip install --editable ".[dev]" \
--retries 1 \
--no-input \
--quiet

# Run on all files,
# ignoring the paths passed to this script,
# so as not to miss type errors.
# My repo makes use of namespace packages.
# Use the namespace-packages flag
# and specify the package to run on explicitly.
# Note that we do not use --ignore-missing-imports,
# as this can give us false confidence in our results.
# mypy fastagency
./scripts/test-no-llm.sh

0 comments on commit fb72bed

Please sign in to comment.