diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 01be991..0e3deb2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -119,7 +119,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: [ 3.10 ] + python-version: [ '3.10' ] services: postgres: image: postgres:11 @@ -140,8 +140,6 @@ jobs: run: | python -m pip install --upgrade pip pip install -r requirements.txt - pip install coverage - pip install coveralls - name: Enable Postgres Trigram Extension run: | PGPASSWORD=postgres psql -U postgres -h 127.0.0.1 -p ${{ job.services.postgres.ports[5432] }} -d ci_db_test -c "CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";" @@ -149,6 +147,5 @@ jobs: env: TEST_DATABASE_URL: postgresql://postgres:postgres@localhost/ci_db_test TEST_DATABASE_ASYNC_URL: postgresql+asyncpg://postgres:postgres@localhost/ci_db_test - run: | - python -m coverage run -m unittest - coveralls \ No newline at end of file + run: | + python -m unittest discover -s ./tests/test_implementations \ No newline at end of file diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 0000000..5a4a502 --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,52 @@ +# This is a basic workflow to help you get started with Actions + +name: Coverage + +# Controls when the workflow will run +on: + push: + branches: [ "main", "develop" ] + pull_request: + branches: [ "main", "develop" ] + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + Coverage: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: [ '3.10' ] + services: + postgres: + image: postgres:11 + env: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + POSTGRES_DB: ci_db_test + ports: + - 5432:5432 + options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 + + steps: + - uses: actions/checkout@master + + - name: Set github token + run: echo "GITHUB_TOKEN=${{ secrets.GIT_TOKEN }}" >> $GITHUB_ENV + - name: Set coveralls token + run: echo "COVERALLS_REPO_TOKEN=${{ secrets.COVERALLS_REPO_TOKEN }}" >> $GITHUB_ENV + - name: Enable Postgres Trigram Extension + run: | + PGPASSWORD=postgres psql -U postgres -h 127.0.0.1 -p ${{ job.services.postgres.ports[5432] }} -d ci_db_test -c "CREATE EXTENSION IF NOT EXISTS \"uuid-ossp\";" + - name: pip install, make coverage + env: + TEST_DATABASE_URL: postgresql://postgres:postgres@localhost/ci_db_test + TEST_DATABASE_ASYNC_URL: postgresql+asyncpg://postgres:postgres@localhost/ci_db_test + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + pip install coverage + pip install coveralls + python -m coverage run -m unittest + coveralls \ No newline at end of file diff --git a/tutorial/test.py b/tutorial/sample_case.py similarity index 95% rename from tutorial/test.py rename to tutorial/sample_case.py index 379ba8d..2d5da85 100644 --- a/tutorial/test.py +++ b/tutorial/sample_case.py @@ -34,4 +34,4 @@ class User(Base): app = FastAPI() app.include_router(crud_route_1) app.include_router(crud_route_2) -uvicorn.run(app, host="0.0.0.0", port=8002, debug=False) +uvicorn.run(app, host="0.0.0.0", port=8002)