Merge pull request #107 from cokelaer/main #460
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 wrappers | |
on: | |
push: | |
branches: | |
- main | |
- dev | |
workflow_dispatch: | |
pull_request: | |
branches-ignore: [] | |
schedule: | |
- cron: '0 0 4 * *' | |
jobs: | |
testing: | |
runs-on: ubuntu-latest | |
strategy: | |
max-parallel: 5 | |
matrix: | |
python: ['3.10'] | |
steps: | |
- name: checkout git repo | |
uses: actions/checkout@v4 | |
with: | |
# by default fetch depth is 1 leading to error | |
# when using git diff HEAD^ --name-only so we need to set | |
# fetch depth to 0 manualy | |
fetch-depth: '0' | |
- name: mamba | |
uses: "mamba-org/setup-micromamba@v1" | |
with: | |
# snakemake complains it cannot find mamba. the micromamba does not seem | |
# to install mamba by itself so we add it specifically | |
create-args: >- | |
python=${{ matrix.python }} | |
snakemake-minimal | |
pytest | |
mamba | |
environment-name: snakemake | |
init-shell: >- | |
bash | |
condarc: | | |
channels: | |
- conda-forge | |
- bioconda | |
channel_priority: strict | |
- name: Fetch main | |
shell: bash -el {0} | |
if: ${{ github.ref != 'refs/heads/main' }} | |
run: | | |
git fetch origin main | |
- name: Test with pytest | |
shell: micromamba-shell {0} | |
env: | |
DIFF_MASTER: ${{ github.event_name == 'pull_request' }} | |
DIFF_LAST_COMMIT: ${{ github.ref == 'refs/heads/main' }} | |
run: | | |
if [ $(git rev-parse --verify HEAD^ > /dev/null 2>&1; echo $?) -eq 0 ]; then | |
git diff HEAD^ --name-only | |
else | |
echo "No parent commit. Skipping git diff." | |
fi | |
pytest test.py -vv |