Skip to content

[ONNX] LLM compression example for ONNX (#3513) #42

[ONNX] LLM compression example for ONNX (#3513)

[ONNX] LLM compression example for ONNX (#3513) #42

Workflow file for this run

name: sdl
permissions: read-all
on:
workflow_dispatch:
push:
branches:
- develop
- release_v*
pull_request:
jobs:
bandit:
name: Bandit
runs-on: ubuntu-latest
timeout-minutes: 10
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: 3.10.14
- name: Install bandit
run: pip install bandit[toml]==1.7.4
- name: Run bandit
run: bandit -c pyproject.toml -r .
codeql:
name: CodeQL
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
security-events: write
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
lfs: true
- name: Initialize CodeQL
uses: github/codeql-action/init@ff0a06e83cb2de871e5a09832bc6a81e7276941f # v3.28.18
with:
languages: python
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@ff0a06e83cb2de871e5a09832bc6a81e7276941f # v3.28.18
with:
category: "/language:python"
# pdf reports always empty for pull_request
- name: Generate Security Report
if: ${{ github.event_name != 'pull_request' }}
uses: rsdmike/github-security-report-action@a149b24539044c92786ec39af8ba38c93496495d # v3.0.4
with:
template: report
token: ${{ secrets.GITHUB_TOKEN }}
- name: Rename Report
shell: bash
if: ${{ github.event_name != 'pull_request' }}
run: |
DATE=$(date +"%Y-%m-%d")
REF_NAME="${{ github.ref_name }}"
mv "report.pdf" "codeql_nncf_report_${DATE}_${REF_NAME//\//-}_${{ github.sha }}.pdf"
- name: Upload CodeQL Artifacts
if: ${{ github.event_name != 'pull_request' }}
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 #v4.6.2
with:
name: codeql-scan-results
path: "./codeql*.pdf"
trivy:
name: Trivy
runs-on: ubuntu-latest
timeout-minutes: 10
# Skip trivy for PRs to avoid blocking merge PRs by found vulnerabilities in requirements
if: ${{ github.event_name != 'pull_request' }}
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Run trivy
uses: aquasecurity/trivy-action@6c175e9c4083a92bbca2f9724c8a5e33bc2d97a5 # v0.30.0
with:
scan-type: "fs"
scan-ref: .
scanners: "misconfig,license,vuln"
format: template
template: "@.github/scripts/trivy_html.tpl"
output: trivy_report.html
cache: false
hide-progress: true
exit-code: 1
- name: Rename Report
if: ${{ !cancelled() }}
shell: bash
run: |
DATE=$(date +"%Y-%m-%d")
REF_NAME="${{ github.ref_name }}"
mv "trivy_report.html" "trivy_report_${DATE}_${REF_NAME//\//-}_${{ github.sha }}.html"
- name: Upload Scan Results
if: ${{ !cancelled() }}
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 #v4.6.2
with:
name: trivy-report
path: "./trivy_report*.html"
retention-days: 30
antivirus:
name: Antivirus
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
lfs: true
- name: Get changed files
if: ${{ github.event_name == 'pull_request' }}
id: changed-files
uses: tj-actions/changed-files@ed68ef82c095e0d48ec87eccea555d944a631a4c # v46.0.5
- name: Run ClamAV scan
id: run-clamav
uses: docker://clamav/clamav:stable
with:
entrypoint: sh
args: |
-cx "
# Update virus definitions
freshclam --quiet
# Run scan based on scope
if [ '${{ github.event_name == 'pull_request' }}' = 'true' ] && [ -n '${{ steps.changed-files.outputs.all_changed_files }}' ]; then
echo 'Running ClamAV on changed files'
SCAN_ARGS='${{ steps.changed-files.outputs.all_changed_files }}'
else
echo 'Running ClamAV on all files'
SCAN_ARGS='-r'
fi
# Run scan and capture output
clamscan $SCAN_ARGS > clamav_report.txt
"
- name: Print Scan Results
if: ${{ !cancelled() }}
shell: bash
run: cat clamav_report.txt
- name: Rename Report
if: ${{ !cancelled() }}
shell: bash
run: |
DATE=$(date +"%Y-%m-%d")
REF_NAME="${{ github.ref_name }}"
mv "clamav_report.txt" "clamav_report_${DATE}_${REF_NAME//\//-}_${{ github.sha }}.txt"
- name: Upload Scan Results
if: ${{ !cancelled() }}
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 #v4.6.2
with:
name: clamav-report
path: "./clamav_report*.txt"
retention-days: 30