Skip to content

doc add code comments (#16) #14

doc add code comments (#16)

doc add code comments (#16) #14

Workflow file for this run

name: Backend CI/CD
on:
push:
branches: [ main ]
paths:
- 'backend/**'
- '.github/workflows/backend.yml'
pull_request:
branches: [ main ]
paths:
- 'backend/**'
- '.github/workflows/backend.yml'
jobs:
test:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./backend/parser/functions
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.12'
cache: 'pip'
cache-dependency-path: './backend/parser/functions/requirements.txt'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest pytest-mock pytest-cov
- name: Run tests with coverage
run: pytest --cov=./ --cov-report=xml
env:
GOOGLE_APPLICATION_CREDENTIALS: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }}
FIREBASE_STORAGE_BUCKET: ${{ secrets.FIREBASE_STORAGE_BUCKET }}
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
flags: backend
name: backend-coverage
deploy:
needs: test
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
defaults:
run:
working-directory: ./backend/parser/functions
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.12'
cache: 'pip'
cache-dependency-path: './backend/parser/functions/requirements.txt'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install firebase-admin firebase-functions
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@v1
with:
credentials_json: '${{ secrets.FIREBASE_SERVICE_ACCOUNT }}'
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v1
- name: Deploy to Firebase Functions
run: |
npm install -g firebase-tools
firebase deploy --only functions --token "${{ secrets.FIREBASE_TOKEN }}" --non-interactive