From b562360c5350de9cfd83049cc2e60474e6ec1e7b Mon Sep 17 00:00:00 2001 From: James Kent Date: Tue, 22 Apr 2025 14:59:12 -0500 Subject: [PATCH 1/4] add testing workflow --- .github/workflows/run_notebook.yml | 80 ++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 .github/workflows/run_notebook.yml diff --git a/.github/workflows/run_notebook.yml b/.github/workflows/run_notebook.yml new file mode 100644 index 0000000..3752f8c --- /dev/null +++ b/.github/workflows/run_notebook.yml @@ -0,0 +1,80 @@ +name: Run Notebook + +on: + workflow_dispatch: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + run-notebook: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Set up Python 3.11 + uses: actions/setup-python@v4 + with: + python-version: '3.11' + + - name: Extract dependencies from colabtools + run: | + # Download setup.py + curl -s https://raw.githubusercontent.com/googlecolab/colabtools/refs/heads/main/setup.py > setup.py + # Extract DEPENDENCIES using Python + python3 - < Date: Tue, 22 Apr 2025 15:02:03 -0500 Subject: [PATCH 2/4] run it on a cron job --- .github/workflows/run_notebook.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/run_notebook.yml b/.github/workflows/run_notebook.yml index 3752f8c..224167f 100644 --- a/.github/workflows/run_notebook.yml +++ b/.github/workflows/run_notebook.yml @@ -2,6 +2,9 @@ name: Run Notebook on: workflow_dispatch: + schedule: + # Runs at 9:00 AM Central (14:00 UTC) + - cron: '0 14 * * *' push: branches: [ main ] pull_request: From 4468360948b0a0fda93cf6f1455e4c8d92eb6c17 Mon Sep 17 00:00:00 2001 From: James Kent Date: Tue, 22 Apr 2025 15:06:05 -0500 Subject: [PATCH 3/4] use v4 for upload artifact --- .github/workflows/run_notebook.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run_notebook.yml b/.github/workflows/run_notebook.yml index 224167f..a84a112 100644 --- a/.github/workflows/run_notebook.yml +++ b/.github/workflows/run_notebook.yml @@ -77,7 +77,7 @@ jobs: jupyter nbconvert --to notebook --execute run_and_explore.ipynb --output executed_notebook.ipynb - name: Upload notebook - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: executed-notebook path: executed_notebook.ipynb From 370037ab5fd31997c86b90c4c1d36ba2f4ac8efa Mon Sep 17 00:00:00 2001 From: James Kent Date: Mon, 28 Apr 2025 13:42:23 -0500 Subject: [PATCH 4/4] process notebook file to test run --- .github/workflows/run_notebook.yml | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/.github/workflows/run_notebook.yml b/.github/workflows/run_notebook.yml index a84a112..a19a336 100644 --- a/.github/workflows/run_notebook.yml +++ b/.github/workflows/run_notebook.yml @@ -57,27 +57,26 @@ jobs: # Convert notebook to Python script for easier text processing jupyter nbconvert --to script run_and_explore.ipynb + # Remove Setup environment section + sed -i '/#@title Setup environment/,/# In\[ \]:/d' run_and_explore.py + # Replace META_ID sed -i 's/META_ID = ""/META_ID = "36Dm86NVjoTJ"/' run_and_explore.py # Add no_upload parameter to run function sed -i 's/url, meta_result = run(META_ID)/url, meta_result = run(META_ID, no_upload=True)/' run_and_explore.py - # Remove View the Report section (everything after the line containing "## View the Report") - sed -i '/^## View the Report/,$d' run_and_explore.py - - # Convert back to notebook - jupyter nbconvert --to notebook run_and_explore.py - - # Move converted notebook back to original name - mv run_and_explore.nbconvert.ipynb run_and_explore.ipynb - - - name: Execute notebook + # Remove View the Report section (everything after the line containing "# View") + sed -i '/^#@title View/,$d' run_and_explore.py + + - name: Execute Python script run: | - jupyter nbconvert --to notebook --execute run_and_explore.ipynb --output executed_notebook.ipynb + python run_and_explore.py - - name: Upload notebook + - name: Upload results uses: actions/upload-artifact@v4 with: - name: executed-notebook - path: executed_notebook.ipynb + name: analysis-results + path: | + results/ + report/