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 
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+     strategy :
62+       matrix :
63+         python-version : ['3.8', '3.9', '3.10', '3.11', '3.12'] 
64+     
65+     steps :
66+     - uses : actions/checkout@v4 
67+ 
68+     - name : Set up Python ${{ matrix.python-version }} 
69+       uses : actions/setup-python@v5 
70+       with :
71+         python-version : ${{ matrix.python-version }} 
72+ 
73+     - name : Cache pip dependencies 
74+       uses : actions/cache@v4 
75+       with :
76+         path : ~/.cache/pip 
77+         key : ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }} 
78+         restore-keys : | 
79+           ${{ runner.os }}-pip- 
80+ 
81+      - name : Install dependencies 
82+       run : | 
83+         python -m pip install --upgrade pip 
84+         pip install -e ".[dev]" 
85+ 
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+ 
95+      - name : Create integration config with API key 
96+       if : env.skip_tests != 'true' 
97+       run : | 
98+         python -c " 
99+         import os 
100+         with open('tests/integration/integration_config.py', 'w') as f: 
101+             f.write(f'API_KEY = \"{os.environ[\"NUTRIENT_DWS_API_KEY\"]}\"\n') 
102+         " 
103+        env :
104+         NUTRIENT_DWS_API_KEY : ${{ secrets.NUTRIENT_DWS_API_KEY }} 
105+ 
106+     - name : Run integration tests 
107+       if : env.skip_tests != 'true' 
108+       run : python -m pytest tests/integration/ -v 
109+ 
110+     - name : Cleanup integration config 
111+       if : always() 
112+       run : rm -f tests/integration/integration_config.py 
113+ 
58114  build :
59115    runs-on : ubuntu-latest 
60116    needs : test 
82138      uses : actions/upload-artifact@v4 
83139      with :
84140        name : dist 
85-         path : dist/ 
141+         path : dist/ 
0 commit comments