Skip to content

Commit

Permalink
19314 - update CI for BE jobs (#2421)
Browse files Browse the repository at this point in the history
* update email reminder ci

* poetry lock change

* lint error for emailer

* colin filings and future effective

* legal filings

* double checking

* missing black check for email reminder

* missing error

* update yml file

* add empty tests folder

* rename email-reminder

* change other 3 folders name

* make future-effective able to run

* retrive folder name and update pylint config

* typo

* try adding readme for testing pass

* update email-reminder with new config

* future-effective-filings

* add pytest-cov = "^4.0.0"

* add coverage.xml
  • Loading branch information
tshyun24 authored Feb 1, 2024
1 parent f90ba37 commit a822f82
Show file tree
Hide file tree
Showing 45 changed files with 2,858 additions and 833 deletions.
69 changes: 7 additions & 62 deletions .github/workflows/business-email-reminder-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,72 +5,17 @@ on:
types: [assigned, synchronize]
paths:
- "jobs/email-reminder/**"
workflow_dispatch:

defaults:
run:
shell: bash
working-directory: ./jobs/email-reminder

jobs:
setup-job:
runs-on: ubuntu-20.04

if: github.repository == 'bcgov/lear'

steps:
- uses: actions/checkout@v3
- run: "true"

linting:
needs: setup-job
runs-on: ubuntu-20.04

strategy:
matrix:
python-version: [3.8]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
make setup
- name: Lint with pylint
id: pylint
run: |
make pylint
- name: Lint with flake8
id: flake8
run: |
make flake8
# testing:
# needs: setup-job
# runs-on: ubuntu-20.04
# steps:
# - uses: actions/checkout@v3
# - name: Set up Python ${{ matrix.python-version }}
# uses: actions/setup-python@v1
# with:
# python-version: ${{ matrix.python-version }}
# - name: Install dependencies
# run: |
# make setup
# - name: Test with pytest
# id: test
# run: |
# make test

build-check:
needs: setup-job
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v3
- name: build to check strictness
id: build
run: |
make build-nc
business-email-reminder-ci:
uses: bcgov/bcregistry-sre/.github/workflows/backend-ci.yaml@main
with:
app_name: "business-email-reminder"
working_directory: "./jobs/email-reminder"
codecov_flag: "emailreminder"
76 changes: 7 additions & 69 deletions .github/workflows/business-future-effective-filings-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,79 +5,17 @@ on:
types: [assigned, synchronize]
paths:
- "jobs/future-effective-filings/**"
workflow_dispatch:

defaults:
run:
shell: bash
working-directory: ./jobs/future-effective-filings

jobs:
setup-job:
runs-on: ubuntu-20.04

if: github.repository == 'bcgov/lear'

steps:
- uses: actions/checkout@v3
- run: "true"

linting:
needs: setup-job
runs-on: ubuntu-20.04

strategy:
matrix:
python-version: [3.8]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
make setup
- name: Lint with pylint
id: pylint
run: |
make pylint
- name: Lint with flake8
id: flake8
run: |
make flake8
testing:
needs: setup-job
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
make setup
- name: Test with pytest
id: test
run: |
make test
#- name: Upload coverage to Codecov
# uses: codecov/codecov-action@v3
# with:
# file: ./queue_services/entity-pay/coverage.xml
# flags: entitypay
# name: codecov-entity-pay
# fail_ci_if_error: true

build-check:
needs: setup-job
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v3
- name: build to check strictness
id: build
run: |
make build-nc
business-future-effective-filings-ci:
uses: bcgov/bcregistry-sre/.github/workflows/backend-ci.yaml@main
with:
app_name: "business-future_effective_filings"
working_directory: "./jobs/future-effective-filings"
codecov_flag: "futureeffective"
76 changes: 7 additions & 69 deletions .github/workflows/business-update-colin-filings-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,79 +5,17 @@ on:
types: [assigned, synchronize]
paths:
- "jobs/update-colin-filings/**"
workflow_dispatch:

defaults:
run:
shell: bash
working-directory: ./jobs/update-colin-filings

jobs:
setup-job:
runs-on: ubuntu-20.04

if: github.repository == 'bcgov/lear'

steps:
- uses: actions/checkout@v3
- run: "true"

linting:
needs: setup-job
runs-on: ubuntu-20.04

strategy:
matrix:
python-version: [3.8]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
make setup
- name: Lint with pylint
id: pylint
run: |
make pylint
- name: Lint with flake8
id: flake8
run: |
make flake8
testing:
needs: setup-job
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
make setup
- name: Test with pytest
id: test
run: |
make test
#- name: Upload coverage to Codecov
# uses: codecov/codecov-action@v3
# with:
# file: ./queue_services/entity-pay/coverage.xml
# flags: entitypay
# name: codecov-entity-pay
# fail_ci_if_error: true

build-check:
needs: setup-job
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v3
- name: build to check strictness
id: build
run: |
make build-nc
business-update-colin-filings-ci:
uses: bcgov/bcregistry-sre/.github/workflows/backend-ci.yaml@main
with:
app_name: "business-update-colin-filings"
working_directory: "./jobs/update-colin-filings"
codecov_flag: "updatecolin"
76 changes: 7 additions & 69 deletions .github/workflows/business-update-legal-filings-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,79 +5,17 @@ on:
types: [assigned, synchronize]
paths:
- "jobs/update-legal-filings/**"
workflow_dispatch:

defaults:
run:
shell: bash
working-directory: ./jobs/update-legal-filings

jobs:
setup-job:
runs-on: ubuntu-20.04

if: github.repository == 'bcgov/lear'

steps:
- uses: actions/checkout@v3
- run: "true"

linting:
needs: setup-job
runs-on: ubuntu-20.04

strategy:
matrix:
python-version: [3.8]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
make setup
- name: Lint with pylint
id: pylint
run: |
make pylint
- name: Lint with flake8
id: flake8
run: |
make flake8
testing:
needs: setup-job
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
make setup
- name: Test with pytest
id: test
run: |
make test
#- name: Upload coverage to Codecov
# uses: codecov/codecov-action@v3
# with:
# file: ./queue_services/entity-pay/coverage.xml
# flags: entitypay
# name: codecov-entity-pay
# fail_ci_if_error: true

build-check:
needs: setup-job
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v3
- name: build to check strictness
id: build
run: |
make build-nc
business-update-legal-filings-ci:
uses: bcgov/bcregistry-sre/.github/workflows/backend-ci.yaml@main
with:
app_name: "business-future-effective-filings"
working_directory: "./jobs/update-legal-filings"
codecov_flag: "legalfilings"
16 changes: 6 additions & 10 deletions jobs/email-reminder/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
}


class _Config(object): # pylint: disable=too-few-public-methods
class _Config: # pylint: disable=too-few-public-methods
"""Base class configuration."""

PROJECT_ROOT = os.path.abspath(os.path.dirname(__file__))
Expand Down Expand Up @@ -57,22 +57,18 @@ class _Config(object): # pylint: disable=too-few-public-methods
DB_PORT = os.getenv("DATABASE_PORT", "5432")

if DB_UNIX_SOCKET := os.getenv("DATABASE_UNIX_SOCKET", None):
SQLALCHEMY_DATABASE_URI = f"postgresql+pg8000://{DB_USER}:{DB_PASSWORD}@/{DB_NAME}?unix_sock={DB_UNIX_SOCKET}/.s.PGSQL.5432"
else:
SQLALCHEMY_DATABASE_URI = (
f"postgresql+pg8000://{DB_USER}:{DB_PASSWORD}@{DB_HOST}:{DB_PORT}/{DB_NAME}"
f"postgresql+pg8000://{DB_USER}:{DB_PASSWORD}@/{DB_NAME}?unix_sock={DB_UNIX_SOCKET}/.s.PGSQL.5432"
)
else:
SQLALCHEMY_DATABASE_URI = f"postgresql+pg8000://{DB_USER}:{DB_PASSWORD}@{DB_HOST}:{DB_PORT}/{DB_NAME}"

ENVIRONMENT = os.getenv("ENVIRONMENT", "prod")

GCP_AUTH_KEY = os.getenv("GCP_AUTH_KEY", None)
ENTITY_MAILER_TOPIC = os.getenv("ENTITY_MAILER_TOPIC", "mailer")
AUDIENCE = os.getenv(
"AUDIENCE", "https://pubsub.googleapis.com/google.pubsub.v1.Subscriber"
)
PUBLISHER_AUDIENCE = os.getenv(
"PUBLISHER_AUDIENCE", "https://pubsub.googleapis.com/google.pubsub.v1.Publisher"
)
AUDIENCE = os.getenv("AUDIENCE", "https://pubsub.googleapis.com/google.pubsub.v1.Subscriber")
PUBLISHER_AUDIENCE = os.getenv("PUBLISHER_AUDIENCE", "https://pubsub.googleapis.com/google.pubsub.v1.Publisher")

TESTING = False
DEBUG = False
Expand Down
Loading

0 comments on commit a822f82

Please sign in to comment.