Skip to content

Commit

Permalink
Sso 19 (#20)
Browse files Browse the repository at this point in the history
* delete frontend folder

* rename backend folder to api

* fix root-level files

* add .gitkeep

* fix git ignore

* fix api

* add

* new cfl package

* new cfl package

* use backend workflow

* remove signals
  • Loading branch information
SKairinos authored Sep 30, 2024
1 parent 409d822 commit aaa2acb
Show file tree
Hide file tree
Showing 72 changed files with 2,279 additions and 28,023 deletions.
13 changes: 13 additions & 0 deletions .gcloudignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/Pipfile
/Pipfile.lock
/manage.py
/.devcontainer.json
/.github
/.venv
/.vscode
/.gitignore
/codecov.yml
/*.toml
/*.code-*
/*.md
/scripts
98 changes: 4 additions & 94 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,100 +2,10 @@ name: Main

on:
push:
paths-ignore:
- "**/*.md"
- "**/.*"
pull_request:
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
main:
uses: ocadotechnology/codeforlife-workspace/.github/workflows/backend.yaml@main
secrets: inherit
56 changes: 8 additions & 48 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# ------------------------------------------------------------------------------
# Backend
# ------------------------------------------------------------------------------
# Based off of https://github.com/github/gitignore/blob/main/Python.gitignore

# Byte-compiled / optimized / DLL files
__pycache__/
Expand Down Expand Up @@ -112,8 +109,10 @@ ipython_config.py
#pdm.lock
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
# in version control.
# https://pdm.fming.dev/#use-with-ide
# https://pdm.fming.dev/latest/usage/project/#working-with-version-control
.pdm.toml
.pdm-python
.pdm-build/

# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
__pypackages__/
Expand Down Expand Up @@ -163,46 +162,7 @@ cython_debug/
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
# and can be added to the global gitignore or merged into this file. For a more nuclear
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
.idea/

# ------------------------------------------------------------------------------
# Frontend
# ------------------------------------------------------------------------------

# dependencies
*/node_modules
/.pnp
.pnp.js

# testing
coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*

# Custom
.nyc_output
cypress/videos
cypress/screenshots
/backend/.python-version
/backend/*/static/react
/backend/*/templates/portal.html
/backend/static
*.sqlite3
/frontend/build
node_modules
.cache
package-lock.json
/package.json
/yarn.lock
#.idea/

# Django
static/
File renamed without changes.
12 changes: 6 additions & 6 deletions backend/Pipfile → Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ name = "pypi"
# 5. Run `pipenv install --dev` in your terminal.

[packages]
codeforlife = {ref = "v0.8.3", git = "https://github.com/ocadotechnology/codeforlife-package-python.git"}
# 🚫 Don't add [packages] below that are inhertited from the CFL package
codeforlife = {ref = "v0.19.1", git = "https://github.com/ocadotechnology/codeforlife-package-python.git"}
# 🚫 Don't add [packages] below that are inherited from the CFL package.

[dev-packages]
codeforlife = {ref = "v0.8.3", git = "https://github.com/ocadotechnology/codeforlife-package-python.git", extras = ["dev"]}
# codeforlife = {file = "../../codeforlife-package-python", editable = true, extras = ["dev"]}
# 🚫 Don't add [dev-packages] below that are inhertited from the CFL package.
codeforlife = {ref = "v0.19.1", git = "https://github.com/ocadotechnology/codeforlife-package-python.git", extras = ["dev"]}
# codeforlife = {file = "../codeforlife-package-python", editable = true, extras = ["dev"]}
# 🚫 Don't add [dev-packages] below that are inherited from the CFL package.

[requires]
python_version = "3.8"
python_version = "3.12"
Loading

0 comments on commit aaa2acb

Please sign in to comment.