Skip to content

Bump fastapi from 0.85.1 to 0.109.1 in /components/common #8

Bump fastapi from 0.85.1 to 0.109.1 in /components/common

Bump fastapi from 0.85.1 to 0.109.1 in /components/common #8

# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
# copier:raw
name: Unit test & lint for Authentication Service
on:
pull_request:
branches:
- main
paths:
- "components/common/**"
- "components/authentication/**"
- ".github/workflows/unit_test_linter_authentication.yaml"
- ".pylintrc"
- "!components/authentication/**.md"
workflow_dispatch:
env:
PROJECT_ID: ${{ vars.PROJECT_ID }}
NODE_VERSION: 18
jobs:
unit-test:
runs-on: ubuntu-latest
environment: develop
strategy:
fail-fast: false
matrix:
python-version: [3.9]
target-folder: [components/authentication]
steps:
- uses: actions/checkout@v3
# https://github.com/google-github-actions/auth
- id: "auth"
name: Auth with Service Account
uses: "google-github-actions/auth@v1"
with:
credentials_json: "${{ secrets.GCP_CREDENTIALS }}"
#workload_identity_provider: "${{ secrets.WI_PROVIDER }}"
service_account: "deployment@${{ env.PROJECT_ID }}.iam.gserviceaccount.com"
- name: Set up Cloud SDK
uses: "google-github-actions/setup-gcloud@v1"
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: ${{env.NODE_VERSION}}
- name: Install Firebase CLI and emulator
run: |
utils/install_firebase.sh v13.1.0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
BASE_DIR=$(pwd)
python -m pip install --upgrade pip
if [ -f $BASE_DIR/components/common/requirements.txt ]; then pip install -r $BASE_DIR/components/common/requirements.txt; fi
if [ -f $BASE_DIR/components/common/requirements-test.txt ]; then pip install -r $BASE_DIR/components/common/requirements-test.txt; fi
cd ${{ matrix.target-folder }}
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if [ -f requirements-test.txt ]; then pip install -r requirements-test.txt; fi
- name: Run pytest with coverage
# We run tests separately for routes and services in the LLM service due to mocking conflicts
run: |
BASE_DIR=$(pwd)
firebase emulators:start --only firestore --project fake-project &
sleep 10
cd ${{ matrix.target-folder }}/src
PYTEST_ADDOPTS="--cache-clear --cov . " PYTHONPATH=$BASE_DIR/components/common/src python -m pytest routes/*_test.py
PYTEST_ADDOPTS="--cache-clear --cov . " PYTHONPATH=$BASE_DIR/components/common/src python -m pytest services/*_test.py
linter:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: [3.9]
target-folder: [components/authentication]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pylint
- name: Lint with pylint
run: |
BASE_DIR=$(pwd)
cd ${{ matrix.target-folder }}/src
python -m pylint $(git ls-files '*.py') --rcfile=$BASE_DIR/.pylintrc
# copier:endraw