Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TEMPLATE: Parallelize pipeline GHA tests over docker/conda/singularity #3214

Merged
merged 17 commits into from
Oct 11, 2024
Merged
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 47 additions & 19 deletions nf_core/pipeline-template/.github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,16 @@ on:

env:
NXF_ANSI_LOG: false
NXF_SINGULARITY_CACHEDIR: {% raw %}${{ github.workspace }}{% endraw %}/.singularity
NXF_SINGULARITY_LIBRARYDIR: {% raw %}${{ github.workspace }}{% endraw %}/.singularity

concurrency:
group: "{% raw %}${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}{% endraw %}"
concurrency:
maxulysse marked this conversation as resolved.
Show resolved Hide resolved
group: "{% raw %}${{ github.workflow }}{% endraw %}-{% raw %}${{ github.event.pull_request.number || github.ref }}{% endraw %}"
maxulysse marked this conversation as resolved.
Show resolved Hide resolved
cancel-in-progress: true

jobs:
test:
name: Run pipeline with test data
name: "Run pipeline with test data ({% raw %}${{ matrix.NXF_VER }}{% endraw %} | {% raw %}${{ matrix.test }}{% endraw %} | {% raw %}${{ matrix.profile }}{% endraw %})"
# Only run on push if this is the nf-core dev branch (merged PRs)
if: "{% raw %}${{{% endraw %} github.event_name != 'push' || (github.event_name == 'push' && github.repository == '{{ name }}') {% raw %}}}{% endraw %}"
runs-on: ubuntu-latest
Expand All @@ -27,33 +29,59 @@ jobs:
NXF_VER:
- "24.04.2"
- "latest-everything"
profile:
- "conda"
- "docker"
- "singularity"
test:
maxulysse marked this conversation as resolved.
Show resolved Hide resolved
# TODO nf-core: You can customise CI pipeline run tests as required
maxulysse marked this conversation as resolved.
Show resolved Hide resolved
- "test"
isMaster:
- {% raw %}${{ github.base_ref == 'master' }}{% endraw %}
exclude:
- isMaster: false
profile: "conda"
- isMaster: false
profile: "singularity"
steps:
- name: Check out pipeline code
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4

- name: Install Nextflow
- name: Set up Nextflow
uses: nf-core/setup-nextflow@v2
with:
version: "{% raw %}${{ matrix.NXF_VER }}{% endraw %}"

- name: Disk space cleanup
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1
- name: Set up Apptainer
if: matrix.profile == 'singularity'
uses: eWaterCycle/setup-apptainer@main

- name: Run pipeline with test data (docker)
# TODO nf-core: You can customise CI pipeline run tests as required
# For example: adding multiple test runs with different parameters
# Remember that you can parallelise this by using strategy.matrix
- name: Set up Singularity
if: matrix.profile == 'singularity'
run: |
nextflow run ${GITHUB_WORKSPACE} -profile test,docker --outdir ./results
mkdir -p $NXF_SINGULARITY_CACHEDIR
mkdir -p $NXF_SINGULARITY_LIBRARYDIR

- name: Set up Miniconda
if: matrix.profile == 'conda'
uses: conda-incubator/setup-miniconda@a4260408e20b96e80095f42ff7f1a15b27dd94ca # v3
with:
miniconda-version: "latest"
auto-update-conda: true
maxulysse marked this conversation as resolved.
Show resolved Hide resolved
channels: conda-forge,bioconda

- name: Run pipeline with test data (singularity)
# TODO nf-core: You can customise CI pipeline run tests as required
- name: Set up Conda
if: matrix.profile == 'conda'
run: |
nextflow run ${GITHUB_WORKSPACE} -profile test,singularity --outdir ./results
if: "{% raw %}${{ github.base_ref == 'master' }}{% endraw %}"
conda clean -a
conda install -n base conda-libmamba-solver
conda config --set solver libmamba
echo $(realpath $CONDA)/condabin >> $GITHUB_PATH
echo $(realpath python) >> $GITHUB_PATH
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these shouldn't be needed

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just copy pasted from modules

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so which part should I remove there?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maxulysse marked this conversation as resolved.
Show resolved Hide resolved

- name: Clean up Disk space
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1

- name: Run pipeline with test data (conda)
# TODO nf-core: You can customise CI pipeline run tests as required
- name: "Run pipeline with test data {% raw %}${{ matrix.NXF_VER }}{% endraw %} | {% raw %}${{ matrix.test }}{% endraw %} | {% raw %}${{ matrix.profile }}{% endraw %}"
run: |
nextflow run ${GITHUB_WORKSPACE} -profile test,conda --outdir ./results
if: "{% raw %}${{ github.base_ref == 'master' }}{% endraw %}"
nextflow run ${GITHUB_WORKSPACE} -profile {% raw %}${{ matrix.test }}{% endraw %},{% raw %}${{ matrix.profile }}{% endraw %} --outdir ./results
Loading