Unit-test backend #155
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Unit-test backend | |
on: | |
push: | |
branches: | |
- '*' | |
pull_request: | |
branches: | |
- '*' | |
schedule: | |
- cron: '0 0 * * 0' # “At 00:00 on Sunday.” | |
env: | |
CONDA_ENV_NAME: voice_smith | |
CACHE_NUMBER: 0 # increase to reset cache manually | |
jobs: | |
build: | |
strategy: | |
matrix: | |
include: | |
- | |
os: ubuntu-latest | |
label: linux-64 | |
prefix: /usr/share/miniconda3/envs/voice_smith | |
name: ${{ matrix.label }} | |
runs-on: ${{ matrix.os }} | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v2 | |
- name: Setup Mambaforge | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
miniforge-variant: Mambaforge | |
miniforge-version: latest | |
activate-environment: voice_smith | |
use-mamba: true | |
- name: Set cache date | |
run: echo "DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV | |
- uses: actions/cache@v2 | |
with: | |
path: ${{ matrix.prefix }} | |
key: ${{ matrix.label }}-conda-${{ hashFiles('./backend/environment.yml') }}-${{ env.DATE }}-${{ env.CACHE_NUMBER }} | |
id: cache | |
- name: Update environment | |
run: mamba env update -n $CONDA_ENV_NAME -f ./backend/environment.yml | |
if: steps.cache.outputs.cache-hit != 'true' | |
- name: Linting using Pylint | |
run: pylint ./backend | |
continue-on-error: true | |
- name: Run pytest in backend | |
shell: bash -l {0} | |
run: conda run -n $CONDA_ENV_NAME python -m pytest ./backend | |