-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from pranaychandekar/tests
added unit test workflow and integrated with codecov
- Loading branch information
Showing
7 changed files
with
90 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
name: Unit Tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
# file paths to consider in the event | ||
paths: | ||
- 'conf/**' | ||
- 'src/**' | ||
- 'tests/**' | ||
- 'docs/**' | ||
- '!**.md' | ||
- '.github/workflows/**' | ||
pull_request: | ||
branches: | ||
- master | ||
# file paths to consider in the event | ||
paths: | ||
- 'conf/**' | ||
- 'src/**' | ||
- 'tests/**' | ||
- 'docs/**' | ||
- '!**.md' | ||
- '.github/workflows/**' | ||
workflow_dispatch: | ||
|
||
jobs: | ||
unit-test-main: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: ["3.11"] | ||
fail-fast: false | ||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Install dependencies | ||
shell: bash | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install wheel | ||
pip3 install -r requirements.txt | ||
- name: Remove coverage xml | ||
run: | | ||
rm -rf ./coverage.xml | ||
- name: Unit Tests | ||
timeout-minutes: 2 | ||
shell: bash | ||
run: | | ||
export IS_CI=true | ||
export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python | ||
python3 -m pytest | ||
- name: Print coverage report | ||
timeout-minutes: 2 | ||
shell: bash | ||
run: | | ||
coverage run -m pytest | ||
coverage report -m | ||
- name: Upload coverage reports to Codecov | ||
uses: codecov/codecov-action@v3 | ||
env: | ||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | ||
|
||
|
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
from fastapi.testclient import TestClient | ||
# from fastapi.testclient import TestClient | ||
|
||
from app import app | ||
# from app import app | ||
|
||
client = TestClient(app) | ||
# client = TestClient(app) | ||
|
||
|
||
def test_build(): | ||
response = client.get("/") | ||
assert response.status_code == 200 | ||
assert response.json()["status"] == 200 | ||
# def test_build(): | ||
# response = client.get("/") | ||
# assert response.status_code == 200 | ||
# assert response.json()["status"] == 200 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters