Skip to content

Commit 43cd2c8

Browse files
committed
Add CI Step to validate & test semgrep rules
1 parent be89eb7 commit 43cd2c8

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

.github/workflows/test.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: Test Semgrep Rules
2+
3+
on: [push]
4+
5+
jobs:
6+
validate-and-test:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- name: Checkout Code
10+
uses: actions/checkout@v4
11+
12+
- name: Install Semgrep
13+
run: |
14+
pip install semgrep
15+
16+
- name: Validate Rules
17+
run: |
18+
bin/validate-rules
19+
shell: bash
20+
21+
- name: Run Rule Tests
22+
run: |
23+
bin/test
24+
shell: bash

bin/test

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
3+
# Run semgrep test cases for specific rules
4+
semgrep --test --config rules/src/ rules/test/

bin/validate-rules

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/bin/bash
2+
3+
# Validate config is valid before testing
4+
semgrep --validate --config ./rules/src

0 commit comments

Comments
 (0)