ipynb to py using jupytext #341
Workflow file for this run
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: tests | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
env: | |
CACHE_NUMBER: 0 # increase to reset cache manually | |
jobs: | |
run-pytests: | |
if: | | |
github.event_name == 'push' || | |
github.event.pull_request.draft == false | |
strategy: | |
matrix: | |
include: | |
- os: windows-latest | |
label: win-64 | |
prefix: C:\Miniconda3\envs\my-env | |
name: ${{ matrix.label }} | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup miniconda | |
uses: conda-incubator/setup-miniconda@v3 | |
with: | |
miniconda-version: "latest" | |
activate-environment: my-env | |
- name: Set cache date | |
run: echo "DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV | |
- uses: actions/cache@v4 | |
with: | |
path: ${{ matrix.prefix }} | |
key: ${{ matrix.label }}-conda-${{ hashFiles('envs\environment_test.yml') }}-${{ env.CACHE_NUMBER }} | |
id: cache | |
- name: Update environment | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: conda env update -n my-env -f envs\environment_test.yml | |
- name: Install hhnk-research_tools | |
shell: pwsh | |
run: pip install git+https://github.com/HHNK/hhnk-research-tools.git@main | |
- name: Test | |
shell: pwsh | |
run: | | |
conda info | |
conda list | |
pip install -e . | |
pytest --cov-report term-missing --cov=hhnk_threedi_tools --cov-report=xml tests/ | |
- name: Upload coverage | |
uses: codecov/codecov-action@v5 | |
#Hopefully reduces run time; see https://github.com/conda-incubator/setup-miniconda/issues/277 | |
#This worked in conda-incubator/setup-miniconda@v2, but not on conda-incubator/setup-miniconda@v3 | |
# - name: Rename conda package cache | |
# if: steps.cache.outputs.cache-hit != 'true' #Doesnt work when cache is used. | |
# shell: bash | |
# run: mv "${CONDA_PKGS_DIR}" "${CONDA_PKGS_DIR}_do_not_cache" | |
# fail_if_pull_request_is_draft: | |
# if: github.event.pull_request.draft == true | |
# runs-on: windows-latest | |
# steps: | |
# - name: Fails in order to indicate that pull request needs to be marked as ready to review and unit tests workflow needs to pass. | |
# run: exit 1 |