2021-02-07 22:02:28 +00:00
|
|
|
name: test and deploy
|
2022-02-20 12:12:32 +00:00
|
|
|
on: [push]
|
2021-02-07 18:32:07 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2022-07-26 22:19:41 +01:00
|
|
|
python-version: ['3.10']
|
2022-07-26 22:17:39 +01:00
|
|
|
poetry-version: [1.1.14]
|
|
|
|
node: [18]
|
|
|
|
os: [ubuntu-latest]
|
2021-02-07 18:32:07 +00:00
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
steps:
|
2022-07-26 22:17:39 +01:00
|
|
|
- uses: actions/checkout@v3 # get source
|
2021-02-07 18:32:07 +00:00
|
|
|
|
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
|
2022-07-26 22:17:39 +01:00
|
|
|
uses: google-github-actions/auth@v0.7.3
|
2021-02-07 20:40:59 +00:00
|
|
|
with:
|
2022-07-26 22:17:39 +01:00
|
|
|
credentials_json: '${{ secrets.GCP_SA_KEY }}'
|
|
|
|
export_environment_variables: true
|
|
|
|
create_credentials_file: 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
|
2021-02-16 22:51:13 +00:00
|
|
|
- name: Install Node ${{ matrix.node }}
|
|
|
|
uses: actions/setup-node@v2
|
|
|
|
with:
|
|
|
|
node-version: ${{ matrix.node }}
|
2021-02-07 18:32:07 +00:00
|
|
|
|
2021-02-07 22:02:28 +00:00
|
|
|
# JS install from lock.json
|
2021-02-16 22:51:13 +00:00
|
|
|
- name: Install Node Packages
|
|
|
|
run: npm ci
|
2021-02-07 22:02:28 +00:00
|
|
|
|
2021-02-16 22:51:13 +00:00
|
|
|
# JS build for checking errors
|
|
|
|
- name: Compile Front-end
|
|
|
|
run: npm run build --if-present
|
|
|
|
|
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-03-23 22:27:58 +00:00
|
|
|
documentation:
|
2022-07-26 22:17:39 +01:00
|
|
|
runs-on: ubuntu-latest
|
2021-03-23 22:26:59 +00:00
|
|
|
needs: build # for ignoring bad builds
|
|
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
|
|
|
steps:
|
2022-07-26 22:17:39 +01:00
|
|
|
- uses: actions/checkout@v3 # get source
|
2021-03-23 22:26:59 +00:00
|
|
|
|
|
|
|
# PYTHON
|
2022-07-26 22:17:39 +01:00
|
|
|
- name: Install Python 3.10
|
2021-03-23 22:26:59 +00:00
|
|
|
uses: actions/setup-python@v2
|
|
|
|
with:
|
2022-07-26 22:17:39 +01:00
|
|
|
python-version: 3.10
|
2021-03-23 22:26:59 +00:00
|
|
|
|
|
|
|
# PYTHON for dependency export only, not installing
|
2022-07-26 22:17:39 +01:00
|
|
|
- name: Install Poetry 1.1.14
|
2021-03-23 22:26:59 +00:00
|
|
|
uses: abatilo/actions-poetry@v2.1.0
|
|
|
|
with:
|
2022-07-26 22:17:39 +01:00
|
|
|
poetry-version: 1.1.14
|
2021-03-23 22:26:59 +00:00
|
|
|
|
|
|
|
# PYTHON install dependencies
|
|
|
|
- name: Install Python Dependencies
|
|
|
|
run: poetry install
|
|
|
|
|
2021-06-11 16:36:01 +01:00
|
|
|
# JS setup for jsdoc
|
2022-07-26 22:17:39 +01:00
|
|
|
- name: Install Node 18
|
2021-06-11 16:36:01 +01:00
|
|
|
uses: actions/setup-node@v2
|
|
|
|
with:
|
2022-07-26 22:17:39 +01:00
|
|
|
node-version: 18
|
2021-06-11 16:36:01 +01:00
|
|
|
|
|
|
|
# JS setup for jsdoc
|
|
|
|
- name: Install jsdoc
|
|
|
|
run: npm install jsdoc
|
|
|
|
|
|
|
|
# JS setup for jsdoc
|
|
|
|
- name: Add node_modules/.bin to PATH
|
|
|
|
run: echo "${GITHUB_WORKSPACE}/node_modules/.bin" >> $GITHUB_PATH
|
|
|
|
|
2021-03-23 22:26:59 +00:00
|
|
|
# DEPLOY for setting up cloud API
|
2022-07-26 22:17:39 +01:00
|
|
|
- name: Set up Cloud SDK
|
|
|
|
uses: google-github-actions/auth@v0.7.3
|
2021-03-23 22:26:59 +00:00
|
|
|
with:
|
2022-07-26 22:17:39 +01:00
|
|
|
credentials_json: '${{ secrets.GCP_SA_KEY }}'
|
|
|
|
export_environment_variables: true
|
|
|
|
create_credentials_file: true
|
2021-03-23 22:26:59 +00:00
|
|
|
|
|
|
|
- name: Generate Documentation
|
2021-03-23 22:38:06 +00:00
|
|
|
run: poetry run sphinx-build docs public -b html
|
2021-03-23 22:26:59 +00:00
|
|
|
|
|
|
|
- name: Deploy To Pages
|
|
|
|
uses: peaceiris/actions-gh-pages@v3
|
|
|
|
with:
|
|
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
publish_dir: ./public
|
|
|
|
|
2021-02-07 20:40:59 +00:00
|
|
|
deploy:
|
2022-07-26 22:17:39 +01:00
|
|
|
runs-on: ubuntu-latest
|
2021-02-07 22:02:28 +00:00
|
|
|
needs: build # for ignoring bad builds
|
2021-03-20 18:21:33 +00:00
|
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
2021-02-07 20:40:59 +00:00
|
|
|
steps:
|
2022-07-26 22:17:39 +01:00
|
|
|
- uses: actions/checkout@v3 # get source
|
2021-02-07 20:40:59 +00:00
|
|
|
|
2021-02-07 22:02:28 +00:00
|
|
|
# PYTHON
|
2022-07-26 22:17:39 +01:00
|
|
|
- name: Install Python 3.10
|
2021-02-07 20:40:59 +00:00
|
|
|
uses: actions/setup-python@v2
|
|
|
|
with:
|
2022-07-26 22:17:39 +01:00
|
|
|
python-version: 3.10
|
2021-02-07 22:02:28 +00:00
|
|
|
|
|
|
|
# PYTHON for dependency export only, not installing
|
2022-07-26 22:17:39 +01:00
|
|
|
- name: Install Poetry 1.1.14
|
2021-02-07 22:02:28 +00:00
|
|
|
uses: abatilo/actions-poetry@v2.1.0
|
|
|
|
with:
|
2022-07-26 22:17:39 +01:00
|
|
|
poetry-version: 1.1.14
|
2021-02-16 22:51:13 +00:00
|
|
|
|
|
|
|
# PYTHON Export Poetry dependencies as requirements.txt
|
|
|
|
- name: Export Poetry Dependencies
|
|
|
|
run: python admin.py pydepend
|
2021-02-07 20:40:59 +00:00
|
|
|
|
2021-02-07 22:02:28 +00:00
|
|
|
# JS setup
|
2022-07-26 22:17:39 +01:00
|
|
|
- name: Install Node 18
|
2021-02-07 20:40:59 +00:00
|
|
|
uses: actions/setup-node@v2
|
|
|
|
with:
|
2022-07-26 22:17:39 +01:00
|
|
|
node-version: 18
|
2021-02-07 20:40:59 +00:00
|
|
|
|
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
|
2021-02-16 22:51:13 +00:00
|
|
|
- name: Compile Front-end
|
2021-02-07 22:02:28 +00:00
|
|
|
run: npm run build --if-present
|
|
|
|
|
2021-02-08 00:30:17 +00:00
|
|
|
# JS for compiling scss
|
|
|
|
- name: Compile Sass
|
|
|
|
uses: gha-utilities/sass-build@v0.3.5
|
|
|
|
with:
|
|
|
|
source: src/scss/style.scss
|
|
|
|
destination: build/style.css
|
|
|
|
|
2021-02-07 22:02:28 +00:00
|
|
|
# DEPLOY for setting up cloud API
|
2022-07-26 22:17:39 +01:00
|
|
|
- name: Set up Cloud SDK
|
|
|
|
uses: google-github-actions/auth@v0.7.3
|
2021-02-07 18:32:07 +00:00
|
|
|
with:
|
2022-07-26 22:17:39 +01:00
|
|
|
credentials_json: '${{ secrets.GCP_SA_KEY }}'
|
|
|
|
export_environment_variables: true
|
|
|
|
create_credentials_file: true
|
2021-02-07 18:32:07 +00:00
|
|
|
|
2021-02-16 22:51:13 +00:00
|
|
|
# DEPLOY set project
|
|
|
|
- name: Set GCP Project
|
|
|
|
run: python admin.py set_project
|
|
|
|
|
|
|
|
# DEPLOY app engine service, -nb for skipping compile
|
|
|
|
- name: Deploy App Engine Service
|
|
|
|
run: python admin.py app -nb
|
|
|
|
|
|
|
|
### MAIN FUNCTIONS
|
|
|
|
|
|
|
|
# DEPLOY update_tag function
|
|
|
|
- name: Deploy update_tag Function
|
|
|
|
run: python admin.py tag
|
|
|
|
|
|
|
|
# DEPLOY run_user_playlist function
|
|
|
|
- name: Deploy run_user_playlist Function
|
|
|
|
run: python admin.py playlist
|
|
|
|
|
|
|
|
### CRON FUNCTIONS
|
|
|
|
|
|
|
|
# DEPLOY run_all_playlists function
|
|
|
|
- name: Deploy run_all_playlists Function
|
|
|
|
run: python admin.py playlist_cron
|
|
|
|
|
|
|
|
# DEPLOY run_all_playlist_stats function
|
|
|
|
- name: Deploy run_all_playlist_stats Function
|
|
|
|
run: python admin.py playlist_stats_cron
|
2021-02-07 20:40:59 +00:00
|
|
|
|
2021-02-16 22:51:13 +00:00
|
|
|
# DEPLOY run_all_tags function
|
|
|
|
- name: Deploy run_all_tags Function
|
2022-03-24 10:14:44 +00:00
|
|
|
run: python admin.py tags_cron
|