(BSR) fix(api): sonarcloud alerts fixes #96
Workflow file for this run
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
name: "CI API Reco" | |
on: | |
pull_request: | |
paths: | |
- 'apps/recommendation/**' | |
workflow_call: | |
jobs: | |
linter: | |
name: "linter job" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: 3.9 | |
- uses: yezz123/setup-uv@v4 | |
- name : "Install Ruff Linter " | |
run: uv pip install --system -r linter-requirements.txt | |
- name: "Run Ruff" | |
run: make ruff-check | |
api-reco-coverage-test: | |
name: "API Reco Coverage test" | |
needs: linter | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: "apps/recommendation/api" | |
services: | |
postgres: | |
image: kartoza/postgis:12.4 | |
env: | |
POSTGRES_PASS: postgres | |
POSTGRES_USER: postgres | |
POSTGRES_DBNAME: db | |
# Set health checks to wait until postgres has started | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
ports: | |
- 5432:5432 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/[email protected] | |
with: | |
python-version: "3.10" | |
- uses: yezz123/setup-uv@v4 | |
- name : "Install requirements" | |
run: uv pip install --system -r requirements.txt | |
- name : "Install psql client " | |
run: sudo apt update && sudo apt install -y postgresql-client | |
- name : "Run tests" | |
env: | |
PG_HOST: "localhost" | |
DB_NAME: "db" | |
DATA_GCP_TEST_POSTGRES_PORT: 5432 | |
API_LOCAL: 1 | |
PYTHONPATH: $PYTHONPATH:~/data-gcp/apps/recommendation/api | |
run: | | |
export API_LOCAL=1 | |
pytest --cov |