Skip to content

Commit fb96026

Browse files
authored
feat: enhance integration test workflow
1 parent 06f62f7 commit fb96026

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

.github/workflows/ci.yml

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,17 @@ jobs:
5858
integration-test:
5959
runs-on: ubuntu-latest
6060
if: github.event_name == 'pull_request'
61+
strategy:
62+
matrix:
63+
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
6164

6265
steps:
6366
- uses: actions/checkout@v4
6467

65-
- name: Set up Python 3.12
68+
- name: Set up Python ${{ matrix.python-version }}
6669
uses: actions/setup-python@v5
6770
with:
68-
python-version: '3.12'
71+
python-version: ${{ matrix.python-version }}
6972

7073
- name: Cache pip dependencies
7174
uses: actions/cache@v4
@@ -80,7 +83,17 @@ jobs:
8083
python -m pip install --upgrade pip
8184
pip install -e ".[dev]"
8285
86+
- name: Check for API key availability
87+
run: |
88+
if [ -z "${{ secrets.NUTRIENT_DWS_API_KEY }}" ]; then
89+
echo "::warning::NUTRIENT_DWS_API_KEY secret not found, skipping integration tests"
90+
echo "skip_tests=true" >> $GITHUB_ENV
91+
else
92+
echo "skip_tests=false" >> $GITHUB_ENV
93+
fi
94+
8395
- name: Create integration config with API key
96+
if: env.skip_tests != 'true'
8497
run: |
8598
python -c "
8699
import os
@@ -91,8 +104,13 @@ jobs:
91104
NUTRIENT_DWS_API_KEY: ${{ secrets.NUTRIENT_DWS_API_KEY }}
92105

93106
- name: Run integration tests
107+
if: env.skip_tests != 'true'
94108
run: python -m pytest tests/integration/ -v
95109

110+
- name: Cleanup integration config
111+
if: always()
112+
run: rm -f tests/integration/integration_config.py
113+
96114
build:
97115
runs-on: ubuntu-latest
98116
needs: test
@@ -120,4 +138,4 @@ jobs:
120138
uses: actions/upload-artifact@v4
121139
with:
122140
name: dist
123-
path: dist/
141+
path: dist/

0 commit comments

Comments
 (0)