Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
df67686
copy from pydap gha
hannahilea May 12, 2026
1e963d5
initial notebook ci setup, no creds
hannahilea May 12, 2026
2b90f4c
add junk creds
hannahilea May 12, 2026
84a72a4
pin notebook dep lower
hannahilea May 12, 2026
073b4b3
change location of .netrc
hannahilea May 12, 2026
6161ff5
write .netrc with secret credentials
hannahilea May 12, 2026
8265ebc
modify permissons for netrc
hannahilea May 12, 2026
2b67ee1
check end result of notebook run
hannahilea May 12, 2026
f166888
run all notebooks maybe
hannahilea May 12, 2026
0f70104
user error
hannahilea May 12, 2026
d1e66ad
add cron job to triggers, run once weekly
hannahilea May 12, 2026
9f2b49f
fix loop
hannahilea May 12, 2026
a6493ee
fix path issue
hannahilea May 12, 2026
4b7d353
make auth more robust in one notebook
hannahilea May 12, 2026
3c08322
add clean up
hannahilea May 12, 2026
ddc3781
run all notebooks even if one fails
hannahilea May 12, 2026
16cce28
more stars
hannahilea May 12, 2026
91494fc
bashhhhh
hannahilea May 12, 2026
c59a3b2
fix cleanup formatting
hannahilea May 12, 2026
4740b98
cancel concurrency on pull requests
hannahilea May 12, 2026
8e12e5f
clean up without warning
hannahilea May 12, 2026
5b56d77
add missing counter
hannahilea May 12, 2026
a5e2ece
add headers
hannahilea May 12, 2026
9a16858
Merge branch 'main' into hr/ci-for-tutorials
hannahilea May 12, 2026
5036ac1
Merge branch 'main' into hr/ci-for-tutorials
hannahilea May 13, 2026
6d20e12
update gitignore, readme decoration
hannahilea May 13, 2026
539da27
temporarily do not fail if only one notebook fails
hannahilea May 13, 2026
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
92 changes: 92 additions & 0 deletions .github/workflows/ci-tutorials.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: Test notebooks
on:
workflow_dispatch:
push:
branches:
- main
pull_request:
branches:
- main
schedule:
# Run every monday at 7am EST
- cron: '0 12 * * 1'

concurrency:
# Cancel intermediate builds only on pull requests
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ startsWith(github.ref, 'refs/pull/') }}

defaults:
run:
shell: bash -l {0}

jobs:
run-notebook:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6

- name: Install Conda environment with Micromamba
uses: mamba-org/setup-micromamba@v3
with:
environment-file: binder/environment.yml
environment-name: Earthdata2026
create-args: >-
conda
cache-environment: true

- name: Install dependencies for testing
run: |
which python
python --version
pip install jupyter nbconvert

- name: Create EDL .netrc file
run: |
cat <<EOF > $HOME/.netrc
machine urs.earthdata.nasa.gov
login ${{ secrets.EDL_USERNAME }}
password ${{ secrets.EDL_PASSWORD }}
EOF
chmod 600 $HOME/.netrc

- name: Test each notebook sequentially
run: |
# Loop over all notebooks and count how many fail to complete
NUM_FAILED=0
NUM_TOTAL=0
for file in ./binder/*.ipynb; do
((NUM_TOTAL++))
echo ""
echo "*****************************"
echo "Running notebook \"$file\"..."
jupyter nbconvert --to notebook --execute $file --output executed_notebook.ipynb
if [ $? -eq 0 ]; then
echo "...$file succeeded!"
else
echo "...$file failed"
((NUM_FAILED++))
fi

# Clean up!
rm -f ./binder/data/*.nc4

echo "*****************************"
echo ""
done

echo ""
echo "*****************************"
echo "*****************************"
echo ""

if [[ $NUM_FAILED > 1 ]]; then
echo "$NUM_FAILED of $NUM_TOTAL notebooks failed."
exit 1
elif [[ $NUM_FAILED = 1 ]]; then
echo "$NUM_FAILED of $NUM_TOTAL notebooks failed; this is expected until MERRA2 notebook is fixed"
echo "See https://github.com/OPENDAP/NASA-tutorials/issues/28; remove this elif clause and update first check to NUM_FAILED > 0 when fixed."
else
echo "$NUM_TOTAL notebooks succeeded."
fi

2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ stare/pystare/
## any data
*.nc
*.sqlite

*.nc4
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ $ conda activate
3. Build the virtual environment for the tutorials

```
$ conda env create -f binder/environment.yml`
$ conda env create -f binder/environment.yml
```

4. After a few minutes, activate the new environment

```
$ conda activate Earthdata2026`
$ conda activate Earthdata2026
```

5. Run `jupyter lab` and the notebooks will appear in your running/default
Expand Down
8 changes: 6 additions & 2 deletions binder/Authenticate.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,14 @@
"metadata": {},
"outputs": [],
"source": [
"auth = earthaccess.login(strategy=\"interactive\", persist=True) # you will be promted to add your EDL credentials\n",
"from earthaccess.exceptions import LoginStrategyUnavailable\n",
"try:\n",
" auth = earthaccess.login(strategy=\"netrc\", persist=True) # you will be promted to add your EDL credentials\n",
"except LoginStrategyUnavailable:\n",
" auth = earthaccess.login(strategy=\"interactive\", persist=True)\n",
"\n",
"# pass Token Authorization to a new Session.\n",
"my_session = auth.get_session()"
"my_session = session=auth.get_session()"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion binder/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ dependencies:
- pyresample
- xarray=2026.1
- pip:
- git+https://github.com/pydap/pydap.git
- git+https://github.com/pydap/pydap.git