Test & Deploy Automation #12
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: Test, Build & Deploy FireFrame | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
env: | |
PROJECT_ID: ${{ secrets.FIREBASE_TEST_PROJECT_ID }} | |
jobs: | |
Lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: 'actions/checkout@v4' | |
- uses: 'psf/black@stable' | |
with: | |
version: '23.11.0' | |
src: './' | |
options: '--line-length 120 --check' | |
Test: | |
needs: Lint | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ['3.8', '3.9', '3.10', '3.11'] | |
steps: | |
- uses: 'actions/checkout@v4' | |
- uses: 'google-github-actions/auth@v2' | |
with: | |
credentials_json: '${{ secrets.GOOGLE_CREDENTIALS }}' | |
- run: | | |
gcloud config set project $PROJECT_ID | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install -e .[test] | |
- name: Run tests | |
env: | |
GOOGLE_CLOUD_PROJECT: ${{ secrets.FIREBASE_TEST_PROJECT_ID }} | |
run: | | |
export GOOGLE_APPLICATION_CREDENTIALS=$GOOGLE_GHA_CREDS_PATH | |
pytest -n 4 | |
Build-Deploy: | |
needs: [Lint, Test] | |
runs-on: ubuntu-latest | |
if: github.event_name == 'release' | |
steps: | |
- uses: 'actions/checkout@v4' | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install build | |
- name: Build package | |
run: python -m build | |
- name: Publish package | |
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} |