-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (52 loc) · 2.13 KB
/
test-python.yml
File metadata and controls
63 lines (52 loc) · 2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
name: Test Python Notebooks
# NOTE: This workflow is now integrated into build-and-push.yml
# It remains available for manual testing of already-pushed images
# For new builds, tests are automatically run before pushing the image
on:
workflow_dispatch:
permissions:
contents: read
jobs:
test-python:
runs-on: ubuntu-latest
# Only run if manually triggered
if: ${{ github.event_name == 'workflow_dispatch' }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull the Docker image
run: |
docker pull ghcr.io/${{ github.repository_owner }}/container-images/${{ github.event.repository.name }}:latest
- name: Configure NASA Earthdata Login
continue-on-error: true
env:
EARTHDATA_USER: ${{ secrets.EARTHDATA_USER}}
EARTHDATA_PASS: ${{ secrets.EARTHDATA_PASS }}
run: |
echo "machine urs.earthdata.nasa.gov login $EARTHDATA_USER password $EARTHDATA_PASS" > tests/.netrc
chmod 0600 tests/.netrc
- name: Make tests dir writable for jovyan (uid 1000)
run: |
sudo chown -R 1000:1000 tests
sudo chmod -R u+rwX tests
- name: Run Python xarray test notebook
run: |
echo "Running test notebook..."
docker run --rm \
-v "$PWD/tests:/tests" \
ghcr.io/${{ github.repository_owner }}/container-images/${{ github.event.repository.name }}:latest \
bash -c "set -e && cp /tests/.netrc ~/.netrc && chmod 0600 ~/.netrc && jupyter nbconvert --to notebook --execute /tests/test-python-xarray.ipynb --output /tests/test-python-xarray-output.ipynb"
echo "✓ Notebook executed successfully"
- name: Upload test results
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results
path: tests/test-python-xarray-output.ipynb
if-no-files-found: warn