Skip to content

feat: add a max-rule-time flag, and use it in the rule execution #794

feat: add a max-rule-time flag, and use it in the rule execution

feat: add a max-rule-time flag, and use it in the rule execution #794

on:
push:
branches:
- "**"
name: Check for regressions in static analysis kernel
jobs:
check_regressions:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
repo:
- { org: "golang", name: "go" }
- { org: "numpy", name: "numpy" }
- { org: "npm", name: "cli" }
- { org: "JamesNK", name: "Newtonsoft.Json" }
- { org: "google", name: "guava" }
- { org: "reduxjs", name: "redux" }
- { org: "ruby", name: "spec" }
- { org: "laravel", name: "framework" }
- { org: "muh-nee", name: "BenchmarkJava" }
- { org: "muh-nee", name: "NodeGoat" }
- { org: "muh-nee", name: "WebGoat" }
- { org: "muh-nee", name: "WebGoat.NET" }
- { org: "muh-nee", name: "FlowBlot.NET" }
- { org: "muh-nee", name: "Damn-Vulnerable-GraphQL-Application" }
- { org: "muh-nee", name: "SecurityShepherd" }
- { org: "muh-nee", name: "DSVW" }
- { org: "muh-nee", name: "NIST-Juliet-CSharp-1.3" }
- { org: "muh-nee", name: "DVWA" }
env:
DD_API_KEY: ${{ secrets.DD_API_KEY }}
DD_APP_KEY: ${{ secrets.DD_APP_KEY }}
DD_SITE: ${{ vars.DD_SITE }}
steps:
- uses: actions/checkout@v4
with:
ref: main
- name: Set up Rust
uses: actions-rust-lang/setup-rust-toolchain@v1.10.1
- name: Checkout test repositories
uses: actions/checkout@v4
with:
repository: ${{ matrix.repo.org }}/${{ matrix.repo.name }}
path: ${{ matrix.repo.org }}/${{ matrix.repo.name }}
- name: Obtain results before changes
run: |
rm -f Cargo.lock
cargo clean
cargo run --release --bin datadog-static-analyzer -- -i ${{ matrix.repo.org }}/${{ matrix.repo.name }} -o result-pre.json -b -f sarif
- name: Fetch all branches and checkout PR
run: |
git fetch --all
git checkout ${{ github.sha }}
echo 'checked out ${{ github.sha }}'
- name: Obtain results after changes
run: |
rm -f Cargo.lock
cargo clean
cargo run --release --bin datadog-static-analyzer -- -i ${{ matrix.repo.org }}/${{ matrix.repo.name }} -o result-post.json -b -f sarif
- name: Install Node.js dependencies
run: npm install
working-directory: .github/scripts
- name: Run Unit Tests
run: npm test
working-directory: .github/scripts
- name: Run Regression Checks
id: regression
run: node ./.github/scripts/check-regressions.js ${{ matrix.repo.org }}/${{ matrix.repo.name }} result-pre.json result-post.json
- name: Upload unique changes from before
uses: actions/upload-artifact@v4
if: steps.regression.outputs.diff1files != ''
with:
name: failures-before-${{ matrix.repo.org }}-${{ matrix.repo.name }}
path: ${{ steps.regression.outputs.diff1files }}
- name: Upload unique changes from after
uses: actions/upload-artifact@v4
if: steps.regression.outputs.diff2files != ''
with:
name: failures-after-${{ matrix.repo.org }}-${{ matrix.repo.name }}
path: ${{ steps.regression.outputs.diff2files }}
- name: Fail
if: steps.regression.outputs.diff1files != '' || steps.regression.outputs.diff2files != ''
run: exit 1