Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the unit testing workflow for API CI #37

Merged
merged 5 commits into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
102 changes: 53 additions & 49 deletions .github/workflows/btr-api-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,60 +34,64 @@ jobs:
poetry run pylint --rcfile=setup.cfg src/btr_api
poetry run flake8 src/btr_api

# unit-testing:
# env:
# DATABASE_TEST_USERNAME: postgres
# DATABASE_TEST_PASSWORD: postgres
# DATABASE_TEST_NAME: btr_test
# DATABASE_TEST_HOST: db
# DATABASE_TEST_PORT: 5432

# runs-on: ubuntu-20.04
unit-testing:
env:
DATABASE_TEST_USERNAME: postgres
DATABASE_TEST_PASSWORD: postgres
DATABASE_TEST_NAME: btr
DATABASE_TEST_HOST: localhost
DATABASE_TEST_PORT: 5432
DATABASE_USERNAME: postgres
DATABASE_PASSWORD: postgres
DATABASE_HOST: localhost
DATABASE_PORT: 5432

runs-on: ubuntu-20.04

# services:
# postgres:
# image: postgres:12
# env:
# POSTGRES_USER: postgres
# POSTGRES_PASSWORD: postgres
# POSTGRES_DB: postgres
# ports:
# - 5432:5432
# options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

# steps:
# - name: Checkout code
# uses: actions/checkout@v3

# - name: Set up Python
# uses: actions/setup-python@v2
# with:
# python-version: 3.11

# - name: Install Poetry
# uses: snok/install-poetry@v1

# - name: Install dependencies
# run: poetry install
services:
postgres:
image: postgres:12
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: btr
ports:
- 5432:5432
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.11

- name: Install Poetry
uses: snok/install-poetry@v1

- name: Install dependencies
run: poetry install

# - name: Update db
# run: |
# poetry run flask db upgrade
# poetry run flask db migrate
- name: Update db
run: |
poetry run flask db upgrade
poetry run flask db migrate

# - name: Run tests
# run: poetry run pytest --cov=./ --cov-report=xml
- name: Run tests
run: poetry run pytest --cov=./ --cov-report=xml

# - name: Check coverage
# run: poetry run coverage report --fail-under=80
- name: Check coverage
run: poetry run coverage report --fail-under=80

# - name: Upload coverage to Codecov
# uses: codecov/codecov-action@v3
# with:
# file: ./btr-api/coverage.xml
# flags: btr-api
# name: codecov-btr-api
# fail_ci_if_error: false
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: ./btr-api/coverage.xml
flags: btr-api
name: codecov-btr-api
fail_ci_if_error: false

build:
runs-on: ubuntu-20.04
Expand Down
37 changes: 0 additions & 37 deletions btr-api/.env

This file was deleted.

Loading