2021-02-07 22:02:28 +00:00
|
|
|
name: test and deploy
|
2021-02-07 18:32:07 +00:00
|
|
|
on: [push, pull_request]
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
python-version: [3.8]
|
|
|
|
poetry-version: [1.1.4]
|
2021-02-07 20:40:59 +00:00
|
|
|
# node: [ '10', '12', '14' ]
|
2021-02-07 22:02:28 +00:00
|
|
|
os: [ubuntu-20.04, windows-latest]
|
2021-02-07 18:32:07 +00:00
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2 # get source
|
|
|
|
|
2021-02-07 22:02:28 +00:00
|
|
|
# PYTHON
|
|
|
|
- name: Install Python ${{ matrix.python-version }}
|
2021-02-07 18:32:07 +00:00
|
|
|
uses: actions/setup-python@v2
|
|
|
|
with:
|
|
|
|
python-version: ${{ matrix.python-version }}
|
|
|
|
|
2021-02-07 22:02:28 +00:00
|
|
|
# PYTHON dependency management
|
|
|
|
- name: Install Poetry ${{ matrix.poetry-version }}
|
2021-02-07 18:32:07 +00:00
|
|
|
uses: abatilo/actions-poetry@v2.1.0
|
|
|
|
with:
|
|
|
|
poetry-version: ${{ matrix.poetry-version }}
|
|
|
|
|
2021-02-07 22:02:28 +00:00
|
|
|
# PYTHON install dependencies
|
|
|
|
- name: Install Python Dependencies
|
2021-02-07 18:32:07 +00:00
|
|
|
run: poetry install
|
|
|
|
|
2021-02-07 22:02:28 +00:00
|
|
|
# PYTHON for authentication when testing
|
|
|
|
- name: Set up Cloud SDK
|
2021-02-07 20:40:59 +00:00
|
|
|
uses: google-github-actions/setup-gcloud@master
|
|
|
|
with:
|
|
|
|
project_id: ${{ secrets.GCP_PROJECT_ID }}
|
|
|
|
service_account_key: ${{ secrets.GCP_SA_KEY }}
|
2021-02-07 22:02:28 +00:00
|
|
|
export_default_credentials: true # <===
|
2021-02-07 20:40:59 +00:00
|
|
|
|
2021-02-07 22:02:28 +00:00
|
|
|
# PYTHON run unit tests
|
|
|
|
- name: Run Python Tests
|
2021-02-07 20:40:59 +00:00
|
|
|
run: poetry run python -m unittest discover -s tests
|
|
|
|
|
2021-02-07 22:02:28 +00:00
|
|
|
# JS setup for testing
|
|
|
|
# - name: Install Node ${{ matrix.node }}
|
2021-02-07 18:32:07 +00:00
|
|
|
# uses: actions/setup-node@v2
|
|
|
|
# with:
|
|
|
|
# node-version: ${{ matrix.node }}
|
|
|
|
|
2021-02-07 22:02:28 +00:00
|
|
|
# JS install from lock.json
|
|
|
|
# - name: Install Node Packages
|
2021-02-07 18:32:07 +00:00
|
|
|
# run: npm ci
|
2021-02-07 22:02:28 +00:00
|
|
|
|
|
|
|
# JS tests
|
|
|
|
# - name: Run JavaScript Tests
|
|
|
|
# run: npm test
|
2021-02-07 18:32:07 +00:00
|
|
|
|
2021-02-07 20:40:59 +00:00
|
|
|
deploy:
|
|
|
|
runs-on: ubuntu-20.04
|
2021-02-07 22:02:28 +00:00
|
|
|
needs: build # for ignoring bad builds
|
2021-02-07 20:40:59 +00:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2 # get source
|
|
|
|
|
2021-02-07 22:02:28 +00:00
|
|
|
# PYTHON
|
|
|
|
- name: Install Python 3.8
|
2021-02-07 20:40:59 +00:00
|
|
|
uses: actions/setup-python@v2
|
|
|
|
with:
|
|
|
|
python-version: 3.8
|
2021-02-07 22:02:28 +00:00
|
|
|
|
|
|
|
# PYTHON for dependency export only, not installing
|
2021-02-07 22:21:37 +00:00
|
|
|
- name: Install Poetry 1.1.4
|
2021-02-07 22:02:28 +00:00
|
|
|
uses: abatilo/actions-poetry@v2.1.0
|
|
|
|
with:
|
2021-02-07 22:21:37 +00:00
|
|
|
poetry-version: 1.1.4
|
2021-02-07 20:40:59 +00:00
|
|
|
|
2021-02-07 22:02:28 +00:00
|
|
|
# JS setup
|
|
|
|
- name: Install Node 14
|
2021-02-07 20:40:59 +00:00
|
|
|
uses: actions/setup-node@v2
|
|
|
|
with:
|
|
|
|
node-version: 14
|
|
|
|
|
2021-02-07 22:02:28 +00:00
|
|
|
# JS for compiling scss
|
2021-02-07 20:47:54 +00:00
|
|
|
- name: Install Sass
|
|
|
|
run: npm install -g sass
|
|
|
|
|
2021-02-07 22:02:28 +00:00
|
|
|
# JS install from lock.json
|
|
|
|
- name: Install Node Packages
|
|
|
|
run: npm ci
|
|
|
|
|
|
|
|
# JS will be built again, for flagging errors
|
|
|
|
- name: Compile front-end
|
|
|
|
run: npm run build --if-present
|
|
|
|
|
|
|
|
# DEPLOY for setting up cloud API
|
2021-02-07 18:32:07 +00:00
|
|
|
- name: Set up Cloud SDK
|
|
|
|
uses: google-github-actions/setup-gcloud@master
|
|
|
|
with:
|
|
|
|
project_id: ${{ secrets.GCP_PROJECT_ID }}
|
|
|
|
service_account_key: ${{ secrets.GCP_SA_KEY }}
|
|
|
|
export_default_credentials: true
|
|
|
|
|
2021-02-07 22:02:28 +00:00
|
|
|
# DEPLOY for deploying app engine API and main functions
|
|
|
|
- name: Deploy API & Main Functions
|
2021-02-07 20:40:59 +00:00
|
|
|
run: python admin.py all
|
|
|
|
|
2021-02-07 22:02:28 +00:00
|
|
|
# DEPLOY for deploying cron functions
|
2021-02-07 20:40:59 +00:00
|
|
|
- name: Deploy Cron Functions
|
|
|
|
run: python admin.py all_cron
|