-
Notifications
You must be signed in to change notification settings - Fork 77
Add first GitHub Actions workflow to test Deploy notebook #169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
c4c4882
feat: Add first GitHub Actions workflow
ryanzhang1230 debfbc3
Add pull request trigger
efajardo-nv 9caf539
fix: update from review commnets
ryanzhang1230 979c825
Merge branch 'add-first-workflow' of https://github.com/NVIDIA-AI-Blu…
ryanzhang1230 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,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 | ||
ryanzhang1230 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| pip install python-dotenv | ||
| pip install --upgrade pip ipython ipykernel | ||
| ipython kernel install --name "python3" --user | ||
| pip install torch | ||
ryanzhang1230 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| # 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 | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.