summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2021-03-20 16:27:50 +0100
committerFabian Mastenbroek <mail.fabianm@gmail.com>2021-03-20 16:41:19 +0100
commitfce499eaafa0afecee5c14346ff7d75e2fe999b6 (patch)
treee8f9b8acc214f871187b910febe70a7453abe232
parent05331ae9927d487ed89733dcb32cb883a0b6bedf (diff)
ci: Add reports and coverage tracking for API
-rw-r--r--.github/workflows/build-api.yml20
-rw-r--r--api/.gitignore2
-rw-r--r--api/pytest.ini1
-rw-r--r--api/requirements.txt1
-rw-r--r--codecov.yml3
5 files changed, 23 insertions, 4 deletions
diff --git a/.github/workflows/build-api.yml b/.github/workflows/build-api.yml
index 989e416f..4ae261db 100644
--- a/.github/workflows/build-api.yml
+++ b/.github/workflows/build-api.yml
@@ -26,8 +26,20 @@ jobs:
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Lint with pylint
- run: |
- ./check.sh
+ run: ./check.sh
- name: Test with pytest
- run: |
- pytest opendc
+ run: pytest --cov=opendc/ --junitxml=.junit-report.xml
+ - name: Publish report
+ if: always()
+ uses: mikepenz/action-junit-report@v2
+ with:
+ check_name: test (Python ${{ matrix.python }})
+ report_paths: '**/.junit-report.xml'
+ github_token: ${{ secrets.GITHUB_TOKEN }}
+ - name: Upload code coverage
+ uses: codecov/codecov-action@v1
+ with:
+ token: ${{ secrets.CODECOV_TOKEN }}
+ files: ./api/.coverage
+ flags: api
+
diff --git a/api/.gitignore b/api/.gitignore
index 0e4f0a70..b0390689 100644
--- a/api/.gitignore
+++ b/api/.gitignore
@@ -14,3 +14,5 @@ _mailinglist
config.json
test.json
.env*
+.coverage
+.junit-report.xml
diff --git a/api/pytest.ini b/api/pytest.ini
index 8c28be16..8e7964ba 100644
--- a/api/pytest.ini
+++ b/api/pytest.ini
@@ -2,3 +2,4 @@
env =
OPENDC_FLASK_TESTING=True
OPENDC_FLASK_SECRET=Secret
+junit_family = xunit2
diff --git a/api/requirements.txt b/api/requirements.txt
index 21a1c0a1..e1061945 100644
--- a/api/requirements.txt
+++ b/api/requirements.txt
@@ -30,6 +30,7 @@ pylint==2.5.3
pymongo==3.10.1
pyparsing==2.4.7
pytest==5.4.3
+pytest-cov==2.11.1
pytest-env==0.6.2
pytest-mock==3.2.0
python-dotenv==0.14.0
diff --git a/codecov.yml b/codecov.yml
index 3cbb3e31..6b69e117 100644
--- a/codecov.yml
+++ b/codecov.yml
@@ -2,3 +2,6 @@ flags:
simulator:
paths:
- simulator/
+ api:
+ paths:
+ - api/