Skip to content

Commit 16f539c

Browse files
Create release-2512.yml
1 parent 35879d1 commit 16f539c

1 file changed

Lines changed: 120 additions & 0 deletions

File tree

.github/workflows/release-2512.yml

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
name: Portfolio Optimization Notebook Runner
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- release-25.12
8+
workflow_dispatch:
9+
10+
concurrency:
11+
group: ${{ github.workflow }}-${{ github.ref }}
12+
cancel-in-progress: true
13+
14+
jobs:
15+
run-notebooks:
16+
runs-on: arc-runner-set-oke-org-nv-ai-bp
17+
env:
18+
PYTHON_VERSION: 3.12
19+
steps:
20+
- name: Checkout repository
21+
uses: actions/checkout@v3
22+
23+
- name: Install Git LFS
24+
run: |
25+
echo "===================== Install Git LFS ====================="
26+
sudo apt-get update
27+
sudo apt-get install -y git-lfs
28+
git lfs install
29+
30+
- name: Pull Git LFS files
31+
run: |
32+
echo "===================== Pull LFS files ====================="
33+
git lfs pull
34+
35+
- name: Check System Info
36+
run: |
37+
echo "===================== System Info ====================="
38+
more /etc/os-release
39+
uname -a
40+
nvidia-smi
41+
docker version
42+
43+
- name: Run container and execute notebooks
44+
run: |
45+
docker run --gpus all --rm \
46+
-v "$(pwd):/workspace" \
47+
-w /workspace \
48+
nvcr.io/nvidia/pytorch:25.08-py3 \
49+
bash -c '
50+
echo "===================== Python and GPU Info ====================="
51+
python --version
52+
nvidia-smi
53+
54+
echo "===================== Create Virtual Environment ====================="
55+
python -m venv .venv
56+
source .venv/bin/activate
57+
58+
echo "===================== Install Dependencies ====================="
59+
python -m pip install --upgrade pip
60+
pip install .
61+
62+
echo "===================== Install Development Tools ====================="
63+
pip install ".[dev]"
64+
65+
echo "===================== Install Jupyter ====================="
66+
pip install jupyter jupyterlab ipykernel papermill nbconvert
67+
68+
echo "===================== Create Jupyter Kernel ====================="
69+
python -m ipykernel install --user --name=portfolio-opt --display-name "Portfolio Optimization"
70+
71+
echo "===================== List Jupyter Kernel ====================="
72+
jupyter kernelspec list
73+
74+
echo "===================== Change to notebooks directory ====================="
75+
cd notebooks
76+
77+
echo "===================== Run cvar_basic notebook ====================="
78+
papermill cvar_basic.ipynb cvar_basic_result.ipynb --kernel portfolio-opt --log-output --log-level DEBUG
79+
80+
echo "===================== Run efficient_frontier notebook ====================="
81+
papermill efficient_frontier.ipynb efficient_frontier_result.ipynb --kernel portfolio-opt --log-output --log-level DEBUG
82+
83+
echo "===================== Run rebalancing_strategies notebook ====================="
84+
papermill rebalancing_strategies.ipynb rebalancing_strategies_result.ipynb --kernel portfolio-opt --log-output --log-level DEBUG
85+
86+
echo "===================== Convert notebooks to HTML ====================="
87+
jupyter nbconvert --to html cvar_basic_result.ipynb
88+
jupyter nbconvert --to html efficient_frontier_result.ipynb
89+
jupyter nbconvert --to html rebalancing_strategies_result.ipynb
90+
'
91+
92+
- name: Verify results
93+
if: always()
94+
env:
95+
TEST_DOCKER_PULL_KEY: ${{ secrets.TEST_DOCKER_PULL_KEY }}
96+
run: |
97+
echo "Checking for generated files...."
98+
ls -lh notebooks/*result*
99+
cd notebooks
100+
echo "$TEST_DOCKER_PULL_KEY" |docker login nvcr.io --username '$oauthtoken' --password-stdin
101+
docker run --rm \
102+
-v ./cvar_basic_result.html:/app/input/quantitative_portfolio_optimization/cvar_basic.html \
103+
-v ./efficient_frontier_result.html:/app/input/quantitative_portfolio_optimization/efficient_frontier.html \
104+
-v ./rebalancing_strategies_result.html:/app/input/quantitative_portfolio_optimization/rebalancing_strategies.html \
105+
-v "$(pwd):/workspace" \
106+
nvcr.io/rw983xdqtcdp/auto_test_team/blueprint-github-test-image:latest \
107+
pytest -m quantitative_portfolio_optimization --disable-warnings --html=/workspace/quantitative_portfolio_optimization.html --self-contained-html
108+
109+
110+
- name: Upload notebook results as artifacts
111+
if: always()
112+
uses: actions/upload-artifact@v4
113+
with:
114+
name: notebook-results
115+
path: |
116+
notebooks/cvar_basic_result.html
117+
notebooks/efficient_frontier_result.html
118+
notebooks/rebalancing_strategies_result.html
119+
notebooks/quantitative_portfolio_optimization.html
120+
retention-days: 30

0 commit comments

Comments
 (0)