Test #33
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: Test | |
on: | |
pull_request: | |
branches: | |
- main | |
schedule: | |
- cron: '0 0 * * *' | |
env: | |
CACHE_NUMBER: 0 # increase to reset cache manually | |
jobs: | |
build: | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
label: linux-64 | |
prefix: /usr/share/miniconda3/envs/my-env | |
# Add macOS and Windows builds here if you need them | |
# - os: macos-latest | |
# label: osx-64 | |
# prefix: /Users/runner/miniconda3/envs/my-env | |
# - os: windows-latest | |
# label: win-64 | |
# prefix: C:\Miniconda3\envs\my-env | |
name: ${{ matrix.label }} | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Mambaforge | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
miniforge-variant: Mambaforge | |
miniforge-version: latest | |
activate-environment: my-env | |
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('environment.yml') }}-${{ env.DATE }}-${{ env.CACHE_NUMBER }} | |
id: cache | |
- name: Update environment | |
run: mamba env update -n my-env -f environment.yml | |
if: steps.cache.outputs.cache-hit != 'true' | |
- name: Install flake8 | |
run: | | |
conda install -n my-env flake8 | |
- name: Lint with flake8 | |
shell: bash -l {0} | |
run: | | |
# stop the build if there are Python syntax errors or undefined names | |
# Ignore scripts folder as mainly archived scripts | |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exclude ./scripts | |
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --exclude ./scripts | |
- name: Install pytest | |
run: conda install -n my-env pytest | |
- name: Activate environment | |
shell: bash -l {0} | |
run: conda activate my-env | |
- name: Install document-issue | |
shell: bash -l {0} | |
run: pip install -e ./packages/document-issue | |
- name: Install document-issue-io | |
shell: bash -l {0} | |
run: pip install -e ./packages/document-issue-io | |
- name: Install document-issue-api | |
shell: bash -l {0} | |
run: pip install -e ./packages/document-issue-api | |
- name: Install tinytex | |
shell: bash -l {0} | |
run: quarto install tinytex | |
- name: Run document-issue tests | |
working-directory: ./packages/document-issue | |
shell: bash -l {0} | |
run: pytest ./tests | |
- name: Run document-issue-io tests | |
working-directory: ./packages/document-issue-io | |
shell: bash -l {0} | |
run: pytest ./tests | |
- name: Run document-issue-api tests | |
working-directory: ./packages/document-issue-api | |
shell: bash -l {0} | |
run: pytest ./tests |