Skip to content

Adding Audio Routing (#1172) #253

Adding Audio Routing (#1172)

Adding Audio Routing (#1172) #253

Workflow file for this run

name: Backend Checks
on:
push:
branches:
- main
- nextjs
- prod-deploy
pull_request:
paths:
- "training/**"
jobs:
lint:
runs-on: ubuntu-latest
steps:
#----------------------------------------------
# check-out repo and set-up mamba env
#----------------------------------------------
- name: Check out repository
uses: actions/checkout@v4
- name: Setup Mamba
uses: conda-incubator/setup-miniconda@v2
with:
miniforge-version: latest
use-mamba: true
activate-environment: dlp
- name: Cache Mamba env
id: cached-mamba-env
uses: actions/cache@v3
env:
# Increase this value to reset cache if etc/example-environment.yml has not changed
CACHE_NUMBER: 0
with:
path: /usr/share/miniconda3/envs/
key: mamba-${{ runner.os }}-${{env.CACHE_NUMBER }}-${{hashFiles('**/training/environment.yml') }}
- name: Update environment
run: mamba env update -n dlp -f
training/environment.yml
if: steps.cached-mamba-env.outputs.cache-hit != 'true'
#----------------------------------------------
# load cached venv if cache exists
#----------------------------------------------
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: /usr/share/miniconda3/envs/dlp
key: training-venv-${{ runner.os }}-${{ hashFiles('**/training/poetry.lock') }}
restore-keys: training-venv-${{ runner.os }}-
#---------------------------------------------------
# install dependencies if cache does not exist
#---------------------------------------------------
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: pwd && cd training && poetry install --no-interaction --no-root && poetry env info -p
shell: bash -el {0}
- name: Add Poetry env to PATH
run: cd training && echo "$(poetry env info --path)/bin" >> $GITHUB_PATH
shell: bash -el {0}
#----------------------------------------------
# pyright static checker
#----------------------------------------------
- name: Run Pyright Static Checker
id: pyright-static-checker
uses: jordemort/action-pyright@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }} # You need this
reporter: github-pr-review # Change reporter.
#----------------------------------------------
# black formatter
#----------------------------------------------
- uses: rickstaa/action-black@v1
id: action_black
with:
black_args: "."
- uses: stefanzweifel/git-auto-commit-action@v4
if: steps.action_black.outputs.is_formatted == 'true'
with:
commit_message: ":art: Format Python code with psf/black"
commit_options: "--no-verify"
commit_user_name: github-actions
commit_user_email: ghaction@github.com
test:
needs: lint
runs-on: ubuntu-22.04
steps:
#----------------------------------------------
# check-out repo and set-up mamba env
#----------------------------------------------
- name: Check out repository
uses: actions/checkout@v4
- name: Setup Mamba
uses: conda-incubator/setup-miniconda@v2
with:
miniforge-version: latest
use-mamba: true
activate-environment: dlp
- name: Cache Mamba env
id: cached-mamba-env
uses: actions/cache@v3
env:
# Increase this value to reset cache if etc/example-environment.yml has not changed
CACHE_NUMBER: 0
with:
path: /usr/share/miniconda3/envs/
key: mamba-${{ runner.os }}-${{env.CACHE_NUMBER }}-${{hashFiles('**/training/environment.yml') }}
- name: Update environment
run: mamba env update -n dlp -f
training/environment.yml
if: steps.cached-mamba-env.outputs.cache-hit != 'true'
#----------------------------------------------
# load cached venv if cache exists
#----------------------------------------------
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: /usr/share/miniconda3/envs/dlp
key: training-venv-${{ runner.os }}-${{ hashFiles('**/training/poetry.lock') }}
restore-keys: training-venv-${{ runner.os }}-
#----------------------------------------------
# install dependencies if cache does not exist
#----------------------------------------------
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: cd training && poetry install --no-interaction --no-root
shell: bash -el {0}
- name: Add Poetry env to PATH
run: cd training && echo "$(poetry env info --path)/bin" >> $GITHUB_PATH
shell: bash -el {0}
#----------------------------------------------
# run test suite
#----------------------------------------------
- name: Run tests with moto
run: |
export AWS_ACCESS_KEY_ID=testing
export AWS_SECRET_ACCESS_KEY=testing
export AWS_DEFAULT_REGION=us-west-2
cd training && poetry run pytest tests
shell: bash -el {0}