Skip to content

Commit 7c13c95

Browse files
committed
simplified ci cd
1 parent 13f5d25 commit 7c13c95

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

.github/workflows/ci-cd.yml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -134,24 +134,31 @@ jobs:
134134
REDIS_URL: "redis://:${{ secrets.REDIS_PASSWORD || 'redis_default_password_for_ci' }}@localhost:${{ secrets.REDIS_PORT || '6379' }}/${{ secrets.REDIS_DB || '0' }}"
135135
run: |
136136
cd backend
137-
# Clear cache before tests to ensure proper isolation
138-
python -c "import django; django.setup(); from django.core.cache import cache; cache.clear()"
139-
137+
# Create a small script to clear cache without Django settings issues
138+
cat > clear_cache.py << 'EOL'
139+
import os
140+
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "config.settings")
141+
import django
142+
django.setup()
143+
from django.core.cache import cache
144+
cache.clear()
145+
print("Cache cleared successfully")
146+
EOL
147+
python clear_cache.py
140148
# Run all backend tests and generate combined coverage
141149
python -m pytest --cov=. --cov-report=xml:coverage.xml --junitxml=junit.xml -o junit_family=legacy
142-
143150
# Run API-specific tests
144151
python -m pytest api/ --cov=api --cov-report=xml:api-coverage.xml --junitxml=api-junit.xml -o junit_family=legacy
145-
146152
# Run integration tests
147153
python -m pytest tests/test_integration.py --cov=. --cov-report=xml:integration-coverage.xml --junitxml=integration-junit.xml -o junit_family=legacy
148-
149154
# Ensure all coverage files exist (create empty if needed)
150155
for file in coverage.xml api-coverage.xml integration-coverage.xml; do
151156
if [ ! -f $file ]; then
152157
echo "<?xml version='1.0' encoding='utf-8'?><coverage version='1.0'><packages></packages></coverage>" > $file
153158
fi
154159
done
160+
# Clear cache after tests to ensure clean state for future runs
161+
python clear_cache.py
155162
156163
- name: Upload Coverage to Codecov
157164
uses: codecov/codecov-action@v3

0 commit comments

Comments
 (0)