Skip to content

Update CI and fix Singularity Bug #11

Update CI and fix Singularity Bug

Update CI and fix Singularity Bug #11

name: Run pytest-workflow
on:
push:
branches:
# https://docs.renovatebot.com/key-concepts/automerge/#branch-vs-pr-automerging
- "renovate/**" # branches Renovate creates
pull_request:
branches: [master, develop]
merge_group:
types: [checks_requested]
branches: [master, develop]
workflow_dispatch: {}
# Cancel if a newer run is started
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
env:
NXF_SINGULARITY_CACHEDIR: ${{ github.workspace }}/.singularity
NXF_SINGULARITY_LIBRARYDIR: ${{ github.workspace }}/.singularity
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# renovate: datasource=github-releases depName=nextflow-io/nextflow versioning=semver
NXF_VER: "24.10.2"
jobs:
pytest-changes:
name: pytest-changes
runs-on: ubuntu-latest
outputs:
tags: ${{ steps.filter.outputs.changes }}
modules: ${{ steps.tags.outputs.modules }}
subworkflows: ${{ steps.tags.outputs.subworkflows }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
fetch-depth: 2 # To retrieve the preceding commit.
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3
id: filter
with:
filters: "tests/config/pytest_modules.yml"
token: ""
- name: Fetch module tags
id: tags
run: |
echo modules=$(echo '${{ steps.filter.outputs.changes }}' | jq -c '. | map(select(contains("modules"))) | map(gsub("modules/"; ""))') >> $GITHUB_OUTPUT
echo subworkflows=$(echo '${{ steps.filter.outputs.changes }}' | jq '. | map(select(contains("subworkflow"))) | map(gsub("subworkflows/"; ""))') >> $GITHUB_OUTPUT
- name: debug
run: |
echo ${{ steps.tags.outputs.modules }}
echo ${{ steps.tags.outputs.subworkflows }}
pytest:
runs-on: ubuntu-latest
name: pytest
needs: [pytest-changes]
if: needs.pytest-changes.outputs.tags != '[]'
strategy:
fail-fast: false
matrix:
tags: ["${{ fromJson(needs.pytest-changes.outputs.tags) }}"]
profile: [conda, docker, singularity]
exclude:
- tags: "nf-test"
- profile: "conda"
tags: gbcms
- profile: "conda"
tags: polysolver
- profile: "conda"
tags: snppileup
- profile: "conda"
tags: facets
- profile: "conda"
tags: mutect1
- profile: "conda"
tags: phylowgs/createinput
- profile: "conda"
tags: phylowgs/parsecnvs
- profile: "conda"
tags: phylowgs/multievolve
- profile: "conda"
tags: phylowgs/writeresults
- profile: "conda"
tags: netmhcpan4
- profile: "conda"
tags: neoantigeninput
- profile: "conda"
tags: neoantigenediting/aligntoIEDB
- profile: "conda"
tags: neoantigenediting/computeFitness
- profile: "conda"
tags: subworkflows/neoantigen_editing
- profile: "conda"
tags: subworkflows/phylowgs
- profile: "conda"
tags: netmhcstabpan
- profile: "conda"
tags: ppflagfixer
- profile: "conda"
tags: neoantigenutils/generatemutfasta
- profile: "conda"
tags: neoantigenutils/formatnetmhcpan
- profile: "conda"
tags: neoantigenutils/generatehlastring
- profile: "conda"
tags: neoantigenutils/neoantigeninput
- profile: "conda"
tags: subworkflows/netmhcstabandpan
- profile: "conda"
tags: salmon/index
- profile: "conda"
tags: genomenexus/vcf2maf
- profile: "conda"
tags: genomenexus/annotationpipeline
- profile: "conda"
tags: ppflagfixer
- profile: "conda"
tags: pvmaf/tagtraceback
- profile: "conda"
tags: pvmaf/concat
- profile: "conda"
tags: genotypevariants/all
- profile: "conda"
tags: subworkflows/traceback
- profile: "conda"
tags: salmon/index
- profile: "conda"
tags: subworkflows/genome_nexus
- profile: "conda"
tags: salmon/quant
- profile: "conda"
tags: rediscoverte
- profile: "conda"
tags: neosv
- profile: "conda"
tags: netmhc3
env:
NXF_ANSI_LOG: false
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Set up Python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5
with:
python-version: "3.11"
- uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4
id: cache-pip-pytest
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-pytest
restore-keys: |
${{ runner.os }}-pip-pytest
- name: Install Python dependencies
run: python -m pip install --upgrade pip pytest-workflow cryptography
- uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4
with:
distribution: "temurin"
java-version: "17"
- name: Setup Nextflow
uses: nf-core/setup-nextflow@v2
with:
version: ${{ env.NXF_VER }}
- name: Setup apptainer
if: matrix.profile == 'singularity'
uses: eWaterCycle/setup-apptainer@main
- name: Set up Singularity
if: matrix.profile == 'singularity'
run: |
mkdir -p $NXF_SINGULARITY_CACHEDIR
mkdir -p $NXF_SINGULARITY_LIBRARYDIR
- name: Conda setup
if: matrix.profile == 'conda'
uses: conda-incubator/setup-miniconda@d2e6a045a86077fb6cad6f5adf368e9076ddaa8d # v3
with:
auto-update-conda: true
conda-solver: libmamba
conda-remove-defaults: true
# Test the module
- name: Run pytest-workflow
# only use one thread for pytest-workflow to avoid race condition on conda cache.
run: TMPDIR=~ PROFILE=${{ matrix.profile }} pytest --tag ${{ matrix.tags }} --symlink --kwdof --git-aware --color=yes
- name: Output log on failure
if: failure()
run: |
sudo apt-get update > /dev/null
sudo apt-get install bat > /dev/null
batcat --decorations=always --color=always /home/ubuntu/pytest_workflow_*/*/log.{out,err}
- name: Setting global variables
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7
id: parsed
with:
script: |
return '${{ matrix.tags }}'.toLowerCase().replaceAll(/\//g, '-').trim('-').trim('"')
result-encoding: string
- name: Upload logs on failure
if: failure()
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4
with:
name: logs-${{ matrix.profile }}-${{ steps.parsed.outputs.result }}
path: |
/home/ubuntu/pytest_workflow_*/*/.nextflow.log
/home/ubuntu/pytest_workflow_*/*/log.out
/home/ubuntu/pytest_workflow_*/*/log.err
/home/ubuntu/pytest_workflow_*/*/work
!/home/ubuntu/pytest_workflow_*/*/work/conda
!/home/ubuntu/pytest_workflow_*/*/work/singularity
!${{ github.workspace }}/.singularity
confirm-pass:
runs-on: ubuntu-latest
needs: [pytest-changes, pytest]
if: always()
steps:
- name: All tests ok
if: ${{ success() || !contains(needs.*.result, 'failure') }}
run: exit 0
- name: One or more tests failed
if: ${{ contains(needs.*.result, 'failure') }}
run: exit 1
- name: debug-print
if: always()
run: |
echo "toJSON(needs) = ${{ toJSON(needs) }}"
echo "toJSON(needs.*.result) = ${{ toJSON(needs.*.result) }}"