Skip to content

Commit

Permalink
configure pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
williballenthin committed Mar 9, 2024
1 parent cae2ae8 commit b44cbe1
Show file tree
Hide file tree
Showing 8 changed files with 121 additions and 3 deletions.
12 changes: 12 additions & 0 deletions .github/scripts/pytest-pyflirt.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

set -o errexit;
set -o nounset;
set -o pipefail;

THIS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
PROJECT_ROOT="$( cd "$THIS_DIR"/../.. >/dev/null 2>&1 && pwd )"
cd "$PROJECT_ROOT"/pyflirt;

maturin develop --release --extras dev;
pytest;
12 changes: 12 additions & 0 deletions .github/scripts/pytest-pylancelot.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

set -o errexit;
set -o nounset;
set -o pipefail;

THIS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
PROJECT_ROOT="$( cd "$THIS_DIR"/../.. >/dev/null 2>&1 && pwd )"
cd "$PROJECT_ROOT"/pylancelot;

maturin develop --release --extras dev;
pytest;
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,4 @@ resources/evaluation/SoK/binaries.txt
*/target/
.direnv
.envrc
.envrc
93 changes: 93 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# install the pre-commit hooks:
#
# ❯ pre-commit install --hook-type pre-commit
# pre-commit installed at .git/hooks/pre-commit
#
# ❯ pre-commit install --hook-type pre-push
# pre-commit installed at .git/hooks/pre-push
#
# run all linters liks:
#
# ❯ pre-commit run --all-files
# isort....................................................................Passed
# black....................................................................Passed
# ruff.....................................................................Passed
# flake8...................................................................Passed
# mypy.....................................................................Passed
#
# run a single linter like:
#
# ❯ pre-commit run --all-files isort
# isort....................................................................Passed
#
# to run the slow linters, like tests, pass `--hook-stage manual`, like:
#
# > pre-commit run --all-files --hook-stage manual

repos:
- repo: local
hooks:
- id: check
name: check
stages: [commit, push, manual]
language: system
entry: cargo check
always_run: true
pass_filenames: false
- id: fmt
name: fmt
stages: [commit, push, manual]
language: system
entry: cargo fmt
always_run: true
pass_filenames: false
- id: clippy
name: clippy
stages: [commit, push, manual]
language: system
entry: cargo clippy
always_run: true
pass_filenames: false
- id: test-core
name: test core
stages: [manual]
language: system
entry: cargo test core
always_run: true
pass_filenames: false
- id: test-flirt
name: test flirt
stages: [manual]
language: system
entry: cargo test flirt
always_run: true
pass_filenames: false
- id: test-pylancelot-rust
name: test pylancelot (rust)
stages: [manual]
language: system
entry: cargo test pylancelot
always_run: true
pass_filenames: false
- id: test-pylancelot-py
name: test pylancelot (python)
stages: [manual]
language: system
entry: bash .github/scripts/pytest-pylancelot.sh
always_run: true
pass_filenames: false
- id: test-pyflirt-rust
name: test pyflirt (rust)
stages: [manual]
language: system
entry: cargo test pyflirt
always_run: true
pass_filenames: false
- id: test-pyflirt-py
name: test pyflirt (python)
stages: [manual]
language: system
entry: bash .github/scripts/pytest-pyflirt.sh
always_run: true
pass_filenames: false

2 changes: 1 addition & 1 deletion pyflirt/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,5 @@ dev = [
repository = "https://github.com/williballenthin/lancelot/tree/master/pyflirt"

[build-system]
requires = ["maturin>=0.13,<0.14"]
requires = ["maturin>=1,<2"]
build-backend = "maturin"
2 changes: 1 addition & 1 deletion pylancelot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

```sh
# use a py3 virtual environment
$ pip install maturin pytest
$ pip install maturin[patchelf] pytest
$ maturin develop --release --extras dev
$ pytest
```
Expand Down
2 changes: 1 addition & 1 deletion pylancelot/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,5 @@ dev = [
repository = "https://github.com/williballenthin/lancelot/tree/master/pylancelot"

[build-system]
requires = ["maturin>=0.13,<0.14"]
requires = ["maturin>=1,<2"]
build-backend = "maturin"
Binary file modified pylancelot/tests/data/k32.dll_
Binary file not shown.

0 comments on commit b44cbe1

Please sign in to comment.