add nf-test to CI #177
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: nf-core CI | |
# This workflow runs the pipeline with the minimal test dataset to check that it completes without any syntax errors | |
on: | |
push: | |
branches: | |
- dev | |
- master | |
pull_request: | |
release: | |
types: [published] | |
env: | |
NXF_ANSI_LOG: false | |
NFTEST_VER: "0.8.1" | |
# cancel if a newer run is started | |
concurrency: | |
group: "${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}" | |
cancel-in-progress: true | |
jobs: | |
nftest-changes: | |
name: Check for changes (nf-test) | |
runs-on: ubuntu-latest | |
outputs: | |
tags: ${{ steps.filter.outputs.changes }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Combine all tags.yml files | |
id: get_tags | |
run: find . -name "tags.yml" -not -path "./.github/*" -exec cat {} + > .github/tags.yml | |
- name: debug | |
run: cat .github/tags.yml | |
- uses: frouioui/paths-filter@main | |
id: filter | |
with: | |
filters: ".github/tags.yml" | |
token: "" | |
nftest: | |
name: ${{ matrix.tags }} ${{ matrix.profile }} NF ${{ matrix.NXF_VER }} | |
# Only run on push if this is the nf-core dev branch (merged PRs) | |
if: needs.nftest-changes.outputs.tags != '[]' | |
runs-on: ubuntu-latest | |
needs: nftest-changes | |
strategy: | |
fail-fast: false | |
matrix: | |
tags: ["${{ fromJson(needs.nftest-changes.outputs.tags) }}"] | |
profile: ["docker"] | |
# profile: ["docker", "singularity", "conda"] | |
NXF_VER: | |
- "23.04.0" | |
- "latest-everything" | |
include: | |
- tags: "pipeline_variantbenchmarking" | |
profile: "docker" | |
steps: | |
- name: Check out pipeline code | |
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4 | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: "temurin" | |
java-version: "17" | |
- name: Install Nextflow | |
uses: nf-core/setup-nextflow@v2 | |
with: | |
version: "${{ matrix.NXF_VER }}" | |
- name: Cache nf-test installation | |
id: cache-software | |
uses: actions/cache@v3 | |
with: | |
path: | | |
/usr/local/bin/nf-test | |
/home/runner/.nf-test/nf-test.jar | |
key: ${{ runner.os }}-${{ env.NFTEST_VER }}-nftest | |
- name: Install nf-test | |
if: steps.cache-software.outputs.cache-hit != 'true' | |
run: | | |
wget -qO- https://code.askimed.com/install/nf-test | bash | |
sudo mv nf-test /usr/local/bin/ | |
- 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: Set up miniconda | |
uses: conda-incubator/setup-miniconda@v2 | |
with: | |
miniconda-version: "latest" | |
auto-update-conda: true | |
channels: conda-forge,bioconda,defaults | |
python-version: ${{ matrix.python-version }} | |
- name: Conda setup | |
run: | | |
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 | |
- name: Disk space cleanup | |
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1 | |
- name: Run nf-test | |
run: | | |
nf-test test tests/main.nf.test \ | |
--profile=${{ matrix.profile }} \ | |
--tag ${{ matrix.tags }} \ | |
--tap=test.tap \ | |
--verbose | |
confirm-pass: | |
runs-on: ubuntu-latest | |
needs: | |
- nftest | |
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) }}" |