diff options
| -rw-r--r-- | .github/workflows/build-api.yml | 20 | ||||
| -rw-r--r-- | api/.gitignore | 2 | ||||
| -rw-r--r-- | api/pytest.ini | 1 | ||||
| -rw-r--r-- | api/requirements.txt | 1 | ||||
| -rw-r--r-- | codecov.yml | 3 |
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/ |
