Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 94 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: Jupyter Notebook Runner

on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
run-notebook:
runs-on: arc-runners-org-nvidia-ai-bp-1-gpu
env:
NOTEBOOK_PATH: ./deploy/1_Deploy_CVE.ipynb
PYTHON_VERSION: 3.12
steps:
- name: Checkout BP repository
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
cache: 'pip'
cache-dependency-path: |
requirements.txt
**/*.ipynb

- name: Install dependencies
run: |
python -m pip install --upgrade pip
#pip install ipywidgets
pip install python-dotenv
pip install --upgrade pip ipython ipykernel
ipython kernel install --name "python3" --user
pip install torch

# Get System Info
echo "===================== System Info ====================="
more /etc/os-release
docker version
docker compose version

- name: Run Jupyter Notebook
env:
GHSA_API_KEY: ${{ secrets.GHSA_API_KEY }}
NVD_API_KEY: ${{ secrets.NVD_API_KEY }}
SERPAPI_API_KEY: ${{ secrets.SERPAPI_API_KEY }}
NVIDIA_API_KEY: ${{ secrets.NVIDIA_API_KEY }}
run: |
OUTPUT_NOTEBOOK="result.ipynb"
echo "Executing notebook: $NOTEBOOK_PATH"
papermill "$NOTEBOOK_PATH" "$OUTPUT_NOTEBOOK" --log-output --log-level DEBUG

- name: Convert result to html format
if: always()
run: |
OUTPUT_NOTEBOOK="result.ipynb"
jupyter nbconvert --to html "$OUTPUT_NOTEBOOK"


- name: Run Test Code
if: always()
env:
TEST_DOCKER_PULL_KEY: ${{ secrets.TEST_DOCKER_PULL_KEY }}
run: |
# Check if the HTML files exist before running tests
if [ ! -f "./result.html" ]; then
echo "Warning: result.html not found"
fi

# Run the test and capture the exit code
echo "$TEST_DOCKER_PULL_KEY" |docker login nvcr.io --username '$oauthtoken' --password-stdin
docker run --rm \
-v ./result.html:/app/input/vulnerability_analysis/Launchable-VACS-2.1.0-result.html \
-v "$(pwd):/workspace" \
nvcr.io/rw983xdqtcdp/auto_test_team/blueprint-github-test-image:latest \
pytest -m vacs --disable-warnings --html=/workspace/vacs.html --self-contained-html

- name: Upload the result notebook as artifact
if: always()
uses: actions/upload-artifact@v4
with:
name: result notebook and pytest
path: |
result.html
vacs.html
retention-days: 30