Merge pull request #278 from jonchenn/llm-indexing #1
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
# 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 Frontend Streamlit | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
paths: | |
- "components/common/**" | |
- "components/frontend_streamlit/**" | |
- ".github/workflows/unit_test_linter_frontend_streamlit.yaml" | |
- ".pylintrc" | |
- "!components/frontend_streamlit/**.md" | |
workflow_dispatch: | |
env: | |
PROJECT_ID: ${{ vars.PROJECT_ID }} | |
jobs: | |
unit-test: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: [3.9] | |
target-folder: [components/frontend_streamlit] | |
steps: | |
- uses: actions/checkout@v3 | |
- id: auth | |
name: Auth with Service Account | |
uses: google-github-actions/auth@v1 | |
with: | |
credentials_json: "${{ secrets.GCP_CREDENTIALS }}" | |
# FIXME: Use workload identity instead of service account key. | |
# workload_identity_provider: '' | |
# service_account: 'deployment-dev@${{ env.PROJECT_ID }}.iam.gserviceaccount.com' | |
- name: Set up Cloud SDK | |
uses: google-github-actions/setup-gcloud@v1 | |
with: | |
install_components: gke-gcloud-auth-plugin | |
- name: Install Firebase CLI and emulator | |
run: | | |
curl -sL https://firebase.tools | bash | |
firebase setup:emulators:firestore | |
- 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 | |
python -m pip install pytest pytest-custom_exit_code pytest-cov pylint pytest-mock mock | |
if [ -f $BASE_DIR/components/common/requirements.txt ]; then pip install -r $BASE_DIR/components/common/requirements.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 | |
run: | | |
BASE_DIR=$(pwd) | |
cd ${{ matrix.target-folder }}/src | |
PYTEST_ADDOPTS="--cache-clear --cov . " PYTHONPATH=$BASE_DIR/components/common/src python -m pytest || true | |
linter: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: [3.9] | |
target-folder: [components/frontend_streamlit] | |
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: | | |
cd ${{ matrix.target-folder }} | |
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 |