Skip to content

remove todo

remove todo #53

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'
environment: ${{ github.ref_name }}
steps:
- 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
- name: βš™οΈ Set Service Name
run: |
echo "SERVICE_NAME=$(
if [ ${{ github.ref_name }} == 'production' ]
then echo ${{ env.SERVICE }}
else echo ${{ github.ref_name }}-${{ env.SERVICE }}
fi
)" >> $GITHUB_ENV
# https://mikefarah.gitbook.io/yq/
- name: πŸ–ŠοΈ Configure App Deployment
uses: mikefarah/yq@master
with:
cmd: |
yq -i '
.service = "${{ github.ref_name }}-${{ env.SERVICE }}" |
.env_variables.SECRET_KEY = "${{ secrets.SECRET_KEY }}" |
.env_variables.SERVICE_NAME = "${{ env.SERVICE_NAME }}"
' backend/app.yaml
- name: πŸš€ Deploy App on GCloud
working-directory: ./backend
run: gcloud app deploy