From 713d2ee07dc471a78f5583f83b96f15455747fe6 Mon Sep 17 00:00:00 2001 From: Patrick Wang Date: Thu, 26 Oct 2023 12:19:28 -0700 Subject: [PATCH 1/5] update database env in API CI --- .github/workflows/btr-api-ci.yml | 98 ++++++++++++++++---------------- 1 file changed, 49 insertions(+), 49 deletions(-) diff --git a/.github/workflows/btr-api-ci.yml b/.github/workflows/btr-api-ci.yml index e2f3a9be..cc125e7b 100644 --- a/.github/workflows/btr-api-ci.yml +++ b/.github/workflows/btr-api-ci.yml @@ -34,60 +34,60 @@ 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 + + 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 From 9c847ec093fba562923564a8d3872baab5e28590 Mon Sep 17 00:00:00 2001 From: Patrick Wang Date: Thu, 26 Oct 2023 12:24:23 -0700 Subject: [PATCH 2/5] delete .env --- btr-api/.env | 37 ------------------------------------- 1 file changed, 37 deletions(-) delete mode 100644 btr-api/.env diff --git a/btr-api/.env b/btr-api/.env deleted file mode 100644 index bd948673..00000000 --- a/btr-api/.env +++ /dev/null @@ -1,37 +0,0 @@ -# third party Services -#SENTRY_DSN= -#CODECOV_TOKEN= -#LD_SDK_KEY= - -# Registry Integration Services -PAYMENT_SVC_URL= -AUTH_SVC_URL= -REPORT_SVC_URL= - -# Flask shite -FLASK_ENV=development -FLASK_APP=wsgi.py -SECRET=some md5 hash -APP_SETTINGS=dev - -# SQL Alchemy -DATABASE_USERNAME=postgres -DATABASE_PASSWORD=postgres -DATABASE_NAME=btr -DATABASE_HOST=db -DATABASE_PORT=5432 - -## TEST DB -DATABASE_TEST_USERNAME=postgres -DATABASE_TEST_PASSWORD=postgres -DATABASE_TEST_NAME=btr_test -DATABASE_TEST_HOST=db -DATABASE_TEST_PORT=5432 - -# JWT Settings -JWT_OIDC_WELL_KNOWN_CONFIG= -JWT_OIDC_ALGORITHMS=RS256 -JWT_OIDC_AUDIENCE= -JWT_OIDC_CLIENT_SECRET= -JWT_OIDC_CACHING_ENABLED=True -JWT_OIDC_JWKS_CACHE_TIMEOUT=300 From 71682b5301a3d7b562143813142ec2932e72f720 Mon Sep 17 00:00:00 2001 From: Patrick Wang Date: Thu, 26 Oct 2023 12:39:43 -0700 Subject: [PATCH 3/5] update api ci yml --- .github/workflows/btr-api-ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/btr-api-ci.yml b/.github/workflows/btr-api-ci.yml index cc125e7b..dc3fa951 100644 --- a/.github/workflows/btr-api-ci.yml +++ b/.github/workflows/btr-api-ci.yml @@ -41,6 +41,10 @@ jobs: 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 From 04f984de2193f04483522412870c8e3eb3040ba6 Mon Sep 17 00:00:00 2001 From: Patrick Wang Date: Thu, 26 Oct 2023 12:54:17 -0700 Subject: [PATCH 4/5] testing ci --- btr-api/test_ci.txt | 1 + 1 file changed, 1 insertion(+) create mode 100644 btr-api/test_ci.txt diff --git a/btr-api/test_ci.txt b/btr-api/test_ci.txt new file mode 100644 index 00000000..caeed41c --- /dev/null +++ b/btr-api/test_ci.txt @@ -0,0 +1 @@ +testing ci workflow triggered by PR \ No newline at end of file From b726faf16f6ed14a12bf158091a277a8b5e32fc1 Mon Sep 17 00:00:00 2001 From: Patrick Wang Date: Thu, 26 Oct 2023 12:58:10 -0700 Subject: [PATCH 5/5] testing ci --- btr-api/test_ci.txt | 1 - 1 file changed, 1 deletion(-) delete mode 100644 btr-api/test_ci.txt diff --git a/btr-api/test_ci.txt b/btr-api/test_ci.txt deleted file mode 100644 index caeed41c..00000000 --- a/btr-api/test_ci.txt +++ /dev/null @@ -1 +0,0 @@ -testing ci workflow triggered by PR \ No newline at end of file