Skip to content

Commit 6920e9c

Browse files
msch-nutrientclaude
andcommitted
Add integration tests to CI workflow for pull requests
- Separate unit tests from integration tests in CI - Add new integration-test job that runs only on PRs - Use Python 3.12 specifically for integration tests - Decrypt NUTRIENT_DWS_API_KEY secret and create integration_config.py - Run integration tests against live Nutrient DWS API 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent f2a7c4b commit 6920e9c

File tree

1 file changed

+36
-2
lines changed

1 file changed

+36
-2
lines changed

.github/workflows/ci.yml

Lines changed: 36 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ jobs:
4343
- name: Run type checking with mypy
4444
run: python -m mypy --python-version=${{ matrix.python-version }} src tests
4545

46-
- name: Run tests with pytest
47-
run: python -m pytest -v --cov=nutrient_dws --cov-report=xml --cov-report=term
46+
- name: Run unit tests with pytest
47+
run: python -m pytest tests/unit/ -v --cov=nutrient_dws --cov-report=xml --cov-report=term
4848

4949
- name: Upload coverage to Codecov
5050
uses: codecov/codecov-action@v4
@@ -55,6 +55,40 @@ jobs:
5555
name: codecov-umbrella
5656
fail_ci_if_error: false
5757

58+
integration-test:
59+
runs-on: ubuntu-latest
60+
if: github.event_name == 'pull_request'
61+
62+
steps:
63+
- uses: actions/checkout@v4
64+
65+
- name: Set up Python 3.12
66+
uses: actions/setup-python@v5
67+
with:
68+
python-version: '3.12'
69+
70+
- name: Cache pip dependencies
71+
uses: actions/cache@v4
72+
with:
73+
path: ~/.cache/pip
74+
key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }}
75+
restore-keys: |
76+
${{ runner.os }}-pip-
77+
78+
- name: Install dependencies
79+
run: |
80+
python -m pip install --upgrade pip
81+
pip install -e ".[dev]"
82+
83+
- name: Create integration config with API key
84+
run: |
85+
echo 'API_KEY = "${{ secrets.NUTRIENT_DWS_API_KEY }}"' > tests/integration/integration_config.py
86+
env:
87+
NUTRIENT_DWS_API_KEY: ${{ secrets.NUTRIENT_DWS_API_KEY }}
88+
89+
- name: Run integration tests
90+
run: python -m pytest tests/integration/ -v
91+
5892
build:
5993
runs-on: ubuntu-latest
6094
needs: test

0 commit comments

Comments
 (0)