Skip to content

Commit 9e12546

Browse files
committed
updated actions
1 parent 176e36e commit 9e12546

1 file changed

Lines changed: 54 additions & 24 deletions

File tree

.github/workflows/python-package.yml

Lines changed: 54 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99

1010
jobs:
1111
# ===========================================================
12-
# Main test matrix (Python 3.11 ONLY)
12+
# Main Test Matrix - Python 3.11 only
1313
# ===========================================================
1414
test:
1515
name: Run Tests on ${{ matrix.os }} - Python 3.11
@@ -42,37 +42,51 @@ jobs:
4242
- name: Install package in development mode
4343
run: pip install -e .
4444

45-
- name: Verify service account availability
46-
run: python -c "import os; print('Service account available:', bool(os.environ.get('CLOUD_SA')))"
45+
# -------------------------------------------------------
46+
# Earth Engine Authentication (Required for EE tests)
47+
# -------------------------------------------------------
48+
- name: Create service account file
49+
if: env.CLOUD_SA != ''
50+
run: |
51+
echo "${CLOUD_SA}" > sa.json
52+
53+
- name: Authenticate Earth Engine
54+
if: env.CLOUD_SA != ''
55+
run: |
56+
earthengine --service_account_file sa.json
57+
58+
- name: Verify service account is available
59+
run: |
60+
python -c "import os; print('Service account available:', bool(os.environ.get('CLOUD_SA')))"
4761
48-
# -----------------------------------------------------------
49-
# Run non-EE tests first
50-
# -----------------------------------------------------------
62+
# -------------------------------------------------------
63+
# Run tests without EE first
64+
# -------------------------------------------------------
5165
- name: Run quick tests (no EE required)
5266
run: |
5367
pytest tests/ -v -m "not slow" --tb=short --color=yes -k "not ee_initialized"
5468
55-
# -----------------------------------------------------------
56-
# Run EE-dependent tests only if CLOUD_SA is provided
57-
# -----------------------------------------------------------
69+
# -------------------------------------------------------
70+
# Run EE tests if authentication succeeded
71+
# -------------------------------------------------------
5872
- name: Run Earth Engine tests
5973
if: env.CLOUD_SA != ''
6074
run: |
6175
pytest tests/ -v -m "not slow" --tb=short --color=yes
6276
63-
# -----------------------------------------------------------
64-
# Coverage (Ubuntu + Python 3.11 only)
65-
# -----------------------------------------------------------
77+
# -------------------------------------------------------
78+
# Coverage (Ubuntu only)
79+
# -------------------------------------------------------
6680
- name: Create test results directory
6781
if: matrix.os == 'ubuntu-latest'
6882
run: mkdir -p tests/results
6983

70-
- name: Run tests with coverage
84+
- name: Run tests with coverage (Ubuntu only)
7185
if: matrix.os == 'ubuntu-latest' && env.CLOUD_SA != ''
7286
run: |
7387
pytest tests/ --cov=geeadd \
74-
--cov-report=xml:tests/results/coverage.xml \
75-
--cov-report=html:tests/results/htmlcov
88+
--cov-report=xml:tests/results/coverage.xml \
89+
--cov-report=html:tests/results/htmlcov
7690
7791
- name: Upload coverage report
7892
if: matrix.os == 'ubuntu-latest'
@@ -84,7 +98,7 @@ jobs:
8498
tests/results/htmlcov
8599
retention-days: 30
86100

87-
- name: Upload to Codecov (optional)
101+
- name: Upload coverage to Codecov (optional)
88102
if: matrix.os == 'ubuntu-latest' && env.CLOUD_SA != ''
89103
uses: codecov/codecov-action@v3
90104
with:
@@ -94,11 +108,11 @@ jobs:
94108
fail_ci_if_error: false
95109

96110
- name: Summary
97-
run: echo "Tests completed for ${{ matrix.os }} with Python 3.11"
111+
run: echo "Tests completed on ${{ matrix.os }} with Python 3.11"
98112

99113

100114
# ===========================================================
101-
# Installation verification on all OS (Python 3.11)
115+
# Installation Verification – Python 3.11 only
102116
# ===========================================================
103117
test-installation:
104118
name: Installation Test on ${{ matrix.os }}
@@ -125,7 +139,7 @@ jobs:
125139
- name: Verify geeadd installation
126140
run: geeadd --version
127141

128-
- name: Test help commands
142+
- name: Test built-in help commands
129143
run: |
130144
geeadd --help
131145
geeadd -h
@@ -135,11 +149,11 @@ jobs:
135149
geeadd utils --help
136150
137151
- name: Summary
138-
run: echo "Installation tests passed on ${{ matrix.os }}"
152+
run: echo "Installation tests passed on ${{ matrix.os }}"
139153

140154

141155
# ===========================================================
142-
# Slow / Integration Tests (Ubuntu only, Python 3.11)
156+
# Slow Integration Tests - Ubuntu, Python 3.11
143157
# ===========================================================
144158
integration-tests:
145159
name: Integration Tests (slow)
@@ -165,10 +179,26 @@ jobs:
165179
pip install -e .
166180
pip install pytest pytest-cov earthengine-api google-auth
167181
168-
- name: Run slow integration tests
182+
# -------------------------------------------------------
183+
# Earth Engine Authentication
184+
# -------------------------------------------------------
185+
- name: Create service account file
186+
if: env.CLOUD_SA != ''
187+
run: |
188+
echo "${CLOUD_SA}" > sa.json
189+
190+
- name: Authenticate Earth Engine
191+
if: env.CLOUD_SA != ''
192+
run: |
193+
earthengine --service_account_file sa.json
194+
195+
# -------------------------------------------------------
196+
# Slow tests
197+
# -------------------------------------------------------
198+
- name: Run slow/integration tests
169199
if: env.CLOUD_SA != ''
170200
run: |
171201
pytest tests/ -v --run-slow -m "slow" --tb=short --color=yes
172202
173-
- name: Integration summary
174-
run: echo "Integration tests completed"
203+
- name: Summary
204+
run: echo "Integration tests complete"

0 commit comments

Comments
 (0)