added poetry for dependency export, compile front-end as task for flagging erros

admin script doesn't properly catch errors and stop at this point
This commit is contained in:
andy 2021-02-07 22:02:28 +00:00
parent 2ebbba6ae8
commit dd6f2e1e3c
2 changed files with 46 additions and 18 deletions

View File

@ -1,4 +1,4 @@
name: Tests
name: test and deploy
on: [push, pull_request]
jobs:
@ -9,64 +9,90 @@ jobs:
python-version: [3.8]
poetry-version: [1.1.4]
# node: [ '10', '12', '14' ]
os: [ubuntu-20.04, ubuntu-18.04, macos-latest, windows-latest]
os: [ubuntu-20.04, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2 # get source
- name: Install Python 3
# PYTHON
- name: Install Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry # PYTHON dependency management
# PYTHON dependency management
- name: Install Poetry ${{ matrix.poetry-version }}
uses: abatilo/actions-poetry@v2.1.0
with:
poetry-version: ${{ matrix.poetry-version }}
- name: Install Dependencies # PYTHON install dependencies
# PYTHON install dependencies
- name: Install Python Dependencies
run: poetry install
- name: Set up Cloud SDK
# PYTHON for authentication when testing
- 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
export_default_credentials: true # <===
- name: Run Tests # test script
# PYTHON run unit tests
- name: Run Python Tests
run: poetry run python -m unittest discover -s tests
# - name: Setup node # JS setup for testing
# JS setup for testing
# - name: Install Node ${{ matrix.node }}
# uses: actions/setup-node@v2
# with:
# node-version: ${{ matrix.node }}
# - name: Install Node Packages # JS install
# JS install from lock.json
# - name: Install Node Packages
# run: npm ci
# JS tests
# - name: Run JavaScript Tests
# run: npm test
deploy:
runs-on: ubuntu-20.04
needs: build
needs: build # for ignoring bad builds
steps:
- uses: actions/checkout@v2 # get source
- name: Install Python 3
# PYTHON
- name: Install Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8
# PYTHON for dependency export only, not installing
- name: Install Poetry 3.8
uses: abatilo/actions-poetry@v2.1.0
with:
poetry-version: 3.8
- name: Setup Node # JS setup
# JS setup
- name: Install Node 14
uses: actions/setup-node@v2
with:
node-version: 14
- name: Install Node Packages # JS install
run: npm ci
# JS for compiling scss
- name: Install Sass
run: npm install -g sass
# 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
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@master
with:
@ -74,8 +100,10 @@ jobs:
service_account_key: ${{ secrets.GCP_SA_KEY }}
export_default_credentials: true
- name: Deploy API to App Engine
# DEPLOY for deploying app engine API and main functions
- name: Deploy API & Main Functions
run: python admin.py all
# DEPLOY for deploying cron functions
- name: Deploy Cron Functions
run: python admin.py all_cron

View File

@ -1,7 +1,7 @@
[Music Tools](https://music.sarsoo.xyz)
==================
![Python Tests](https://github.com/sarsoo/music-tools/workflows/Tests/badge.svg)
![Python Tests](https://github.com/sarsoo/music-tools/workflows/test%20and%20deploy/badge.svg)
Set of utility tools for Spotify and Last.fm.
Built on my other libraries for Spotify ([spotframework](https://github.com/Sarsoo/spotframework)), Last.fm ([fmframework](https://github.com/Sarsoo/pyfmframework)) and interfacing utility tools for the two ([spotfm](https://github.com/Sarsoo/pyfmframework)). Currently running on a suite of Google Cloud Platform services. An iOS client is currently under development [here](https://github.com/Sarsoo/Music-Tools-iOS).