Skip to content

use new cfl package #22

use new cfl package

use new cfl package #22

Workflow file for this run

name: Main
on:
push:
paths-ignore:
- "README.md"
- "CHANGELOG.md"
- "LICENSE"
- ".gitignore"
- ".vscode"
workflow_dispatch:
env:
SERVICE: sso
PYTHON_VERSION: 3.8
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: πŸ›« Checkout
uses: actions/checkout@v3
- name: 🐍 Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install Python Packages
working-directory: ./backend
run: |
python -m pip install --upgrade pip
python -m pip install pipenv
pipenv install --dev
- name: Check Code Format
working-directory: ./backend
run: if ! pipenv run black --check .; then exit 1; fi
# - name: Check Migrations
# working-directory: ./backend
# run: pipenv run python manage.py makemigrations --check --dry-run
# TODO: assert code coverage target.
- name: Test Code Units
working-directory: ./backend
run: pipenv run pytest
build-and-deploy:
runs-on: ubuntu-latest
needs: [test]
# if: github.ref_name == 'production' || github.ref_name == 'development' || github.ref_name == 'staging'
steps:
# - name: βš™οΈ Set up Environment Variables
# run: |
# echo "SERVICE_BASE_ROUTE=$(
# if [ "${{ github.ref_name }}" == "production" ]
# then echo "sso"
# else echo "${{ github.ref_name }}-sso/"
# fi
# )" >> $GITHUB_ENV
- name: βš™οΈ Set up Environment Variables
run: |
echo "SERVICE_BASE_ROUTE=sso/" >> $GITHUB_ENV
- name: πŸ›« Checkout
uses: actions/checkout@v3
- name: 🐍 Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: πŸ— Authenticate with GCloud
uses: google-github-actions/auth@v1
with:
credentials_json: ${{ secrets.GCP_CREDENTIALS }}
- name: πŸ€– Set up GCloud SDK
uses: google-github-actions/setup-gcloud@v1
- name: πŸ›  Install Backend Dependencies
working-directory: ./backend
run: |
python -m pip install --upgrade pip
python -m pip install pipenv
pipenv install
- name: πŸ›  Generate requirements.txt
working-directory: ./backend
run: pipenv requirements > requirements.txt
# https://mikefarah.gitbook.io/yq/
- name: πŸ–ŠοΈ Configure App Deployment
uses: mikefarah/yq@master
with:
cmd: |
yq -i '
.service = "production-${{ env.SERVICE }}" |
.env_variables.SERVICE_BASE_ROUTE = "${{ env.SERVICE_BASE_ROUTE }}"
' backend/app.yaml
- name: πŸš€ Deploy App on GCloud
working-directory: ./backend
run: gcloud app deploy