-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add CI tests for the pre-commit hooks (#9)
- Loading branch information
Showing
4 changed files
with
61 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
jobs: | ||
test-hooks: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Configure git safedir properly | ||
run: git config --global --add safe.directory "$(pwd)" | ||
- name: Fake update file | ||
run: git mv tests/python_simple.py python_simple.py | ||
- name: Test semgrep pre-commit hook | ||
uses: pre-commit/[email protected] | ||
with: | ||
extra_args: semgrep --hook-stage manual --files python_simple.py | ||
- name: Test semgrep-ci pre-commit hook | ||
uses: pre-commit/[email protected] | ||
with: | ||
extra_args: semgrep-ci --hook-stage manual --files python_simple.py | ||
- name: Test semgrep-docker-develop pre-commit hook | ||
uses: pre-commit/[email protected] | ||
with: | ||
extra_args: semgrep-docker-develop --hook-stage manual --files python_simple.py | ||
- name: Test semgrep-docker pre-commit hook | ||
uses: pre-commit/[email protected] | ||
with: | ||
extra_args: semgrep-docker --hook-stage manual --files python_simple.py | ||
|
||
name: pre-commit-hook-test | ||
on: | ||
pull_request: null | ||
push: | ||
branches: | ||
- develop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# These hooks are meant to be triggered in CI to test the pre-commit hooks, | ||
# so rather than triggering at every commit, including locally, they are triggered | ||
# whenever the test-hooks CI workflow is run. | ||
default_stages: [manual] | ||
|
||
repos: | ||
- repo: https://github.com/semgrep/pre-commit | ||
rev: 'v1.76.0' | ||
hooks: | ||
- id: semgrep | ||
name: Pre-commit semgrep | ||
args: ["--config", "tests/python_simple.yml"] | ||
- id: semgrep-ci | ||
name: Pre-commit semgrep-ci | ||
args: ["--config", "tests/python_simple.yml"] | ||
- id: semgrep-docker-develop | ||
name: Pre-commit semgrep-docker-develop | ||
args: ["--config", "tests/python_simple.yml"] | ||
- id: semgrep-docker | ||
name: Pre-commit semgrep-docker | ||
args: ["--config", "tests/python_simple.yml"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
rules: | ||
- id: simple-python-rule | ||
pattern: "0" | ||
message: Simple python rule | ||
languages: | ||
- python | ||
severity: INFO |