Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
piyushroshan committed Feb 6, 2024
1 parent 904e421 commit 6055f12
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 4 deletions.
23 changes: 20 additions & 3 deletions .github/workflows/pr-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ jobs:


tests:
needs: build-context
runs-on: ubuntu-latest
steps:
- name: Checkout code
Expand Down Expand Up @@ -222,15 +223,31 @@ jobs:
- name: Run workshop tests
run: |
cd services/workshop
pip3 install virtualenv
virtualenv venv
source venv/bin/activate
pip install -r requirements.txt
IS_TESTING=True python3 manage.py test --no-input
pip3 install -r requirements.txt
mkdir -p test-results
IS_TESTING=True python3 manage.py test --no-input --testrunner xmlrunner.extra.djangotestrunner.XMLTestRunner --output-dir test-results
- name: Run workshop coverage
run: |
cd services/workshop
source venv/bin/activate
coverage run ./manage.py test crapi
coverage report
coverage xml -o coverage.xml
coverage xml -o coverage.xml
- name: Publish Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
if: always()
with:
files: |
**/test-results/**/*.xml
- name: Publish Coverage Report
if: always()
uses: aGallea/tests-coverage-report@v1
with:
min-coverage-percentage: '50'
fail-under-coverage-percentage: 'false'
1 change: 1 addition & 0 deletions services/community/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
test-results/
1 change: 1 addition & 0 deletions services/identity/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@ gradle-app.setting
# JDT-specific (Eclipse Java Development Tools)
.classpath
bin/
test-results/
1 change: 1 addition & 0 deletions services/workshop/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ __pycache__/
*.log
.coverage
*.xml
test-results/
4 changes: 4 additions & 0 deletions services/workshop/crapi_site/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ def get_env_value(env_variable):

ROOT_URLCONF = 'crapi_site.urls'

TEST_RUNNER = 'xmlrunner.extra.djangotestrunner.XMLTestRunner'

TEST_OUTPUT_DIR = os.path.join(BASE_DIR, 'test-reports')

TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
Expand Down
3 changes: 2 additions & 1 deletion services/workshop/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ requests==2.30.0
Werkzeug==2.0.3
Faker==22.1.0
gunicorn==21.2.0
coverage==7.4.1
coverage==7.4.1
unittest-xml-reporting==3.2.0

0 comments on commit 6055f12

Please sign in to comment.