Subset nf-core/modules repo #5
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: Run tests | |
on: | |
pull_request: | |
branches: [main] | |
workflow_dispatch: | |
# Cancel if a newer run is started | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
pre-commit: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 | |
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5 | |
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1 | |
# FIXME Flip this off once we get to less than a couple hundred. Adding | |
# this so it will only run against changed files. It'll make it much | |
# easier to fix these as they come up rather than everything at once. | |
with: | |
extra_args: "" | |
prettier: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 | |
- name: Install NodeJS | |
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4 | |
with: | |
node-version: "20" | |
- name: Install Prettier | |
run: npm install -g [email protected] | |
- name: Run Prettier --check | |
run: prettier --check . | |
editorconfig: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 | |
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4 | |
with: | |
node-version: "20" | |
- name: Install editorconfig-checker | |
run: npm install -g editorconfig-checker | |
- name: Run ECLint check | |
run: editorconfig-checker -exclude README.md $(git ls-files | grep -v test) | |
nf-test-changes: | |
name: nf-test-changes | |
runs-on: ubuntu-latest | |
outputs: | |
# Expose detected tags as 'modules' and 'workflows' output variables | |
paths: ${{ steps.list.outputs.components }} | |
modules: ${{ steps.outputs.outputs.modules }} | |
subworkflows: ${{ steps.outputs.outputs.subworkflows}} | |
# Prod for version bumping | |
steps: | |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 | |
with: | |
fetch-depth: 0 | |
- name: List nf-test files | |
id: list | |
uses: adamrtalbot/detect-nf-test-changes@6e67b7a6bd3caf8571b99cab3ab764c0e758f55c # v0.0.3 | |
with: | |
head: ${{ github.sha }} | |
base: ${{ github.event.pull_request.base.sha || github.event.merge_group.base_sha }} | |
n_parents: 2 | |
- name: Separate modules and subworkflows | |
id: outputs | |
run: | | |
echo modules=$(echo '${{ steps.list.outputs.components }}' | jq -c '. | map(select(contains("modules"))) | map(gsub("modules/class-modules/"; ""))') >> $GITHUB_OUTPUT | |
echo subworkflows=$(echo '${{ steps.list.outputs.components }}' | jq '. | map(select(contains("subworkflows"))) | map(gsub("subworkflows/class-modules/"; ""))') >> $GITHUB_OUTPUT | |
- name: debug | |
run: | | |
echo ${{ steps.outputs.outputs.modules }} | |
echo ${{ steps.outputs.outputs.subworkflows }} | |
nf-core-lint-modules: | |
runs-on: ubuntu-latest | |
name: nf-core-lint-modules | |
needs: nf-test-changes | |
if: ( needs.nf-test-changes.outputs.modules != '[]') | |
strategy: | |
fail-fast: false | |
matrix: | |
tags: ["${{ fromJson(needs.nf-test-changes.outputs.modules) }}"] | |
steps: | |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 | |
- name: Set up Python | |
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5 | |
with: | |
python-version: "3.11" | |
- uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4 | |
id: cache-pip | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip | |
restore-keys: | | |
${{ runner.os }}-pip | |
- name: Install pip | |
run: python -m pip install --upgrade pip | |
- uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4 | |
with: | |
distribution: "temurin" | |
java-version: "17" | |
- name: Setup Nextflow | |
uses: nf-core/setup-nextflow@v2 | |
- name: Install nf-core tools development version | |
run: python -m pip install --upgrade --force-reinstall git+https://github.com/nf-core/tools.git@dev | |
- name: Lint module ${{ matrix.tags }} | |
run: nf-core modules --git-remote https://github.com/mirpedrol/class-modules lint ${{ matrix.tags }} | |
nf-core-lint-subworkflows: | |
runs-on: ubuntu-latest | |
name: nf-core-lint-modules | |
needs: nf-test-changes | |
if: ( needs.nf-test-changes.outputs.subworkflows != '[]') | |
strategy: | |
fail-fast: false | |
matrix: | |
tags: | |
[ | |
"${{ fromJson(needs.nf-test-changes.outputs.subworkflows) }}", | |
] | |
steps: | |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 | |
- name: Set up Python | |
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5 | |
with: | |
python-version: "3.11" | |
- name: Install pip | |
run: python -m pip install --upgrade pip | |
- uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4 | |
with: | |
distribution: "temurin" | |
java-version: "17" | |
- name: Setup Nextflow | |
uses: nf-core/setup-nextflow@561fcfc7146dcb12e3871909b635ab092a781f34 # v2 | |
- name: Install nf-core tools development version | |
run: python -m pip install --upgrade --force-reinstall git+https://github.com/nf-core/tools.git@dev | |
- name: Lint module ${{ matrix.tags }} | |
run: nf-core subworkflows --git-remote https://github.com/mirpedrol/class-modules lint ${{ matrix.tags }} | |
nf-test: | |
runs-on: ubuntu-latest | |
name: nf-test | |
needs: nf-test-changes | |
if: ( needs.nf-test-changes.outputs.paths != '[]' ) | |
strategy: | |
fail-fast: false | |
matrix: | |
path: ["${{ fromJson(needs.nf-test-changes.outputs.paths) }}"] | |
profile: [conda, docker, singularity] | |
env: | |
NXF_ANSI_LOG: false | |
NFTEST_VER: "0.8.4" | |
steps: | |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 | |
- uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4 | |
with: | |
distribution: "temurin" | |
java-version: "17" | |
- name: Setup Nextflow | |
uses: nf-core/setup-nextflow@v2 | |
- name: Install nf-test | |
uses: nf-core/setup-nf-test@v1 | |
- name: Setup apptainer | |
if: matrix.profile == 'singularity' | |
uses: eWaterCycle/setup-apptainer@main | |
- name: Set up Singularity | |
if: matrix.profile == 'singularity' | |
uses: eWaterCycle/setup-singularity@v7 | |
with: | |
singularity-version: 3.8.3 | |
- name: Set up Python | |
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5 | |
with: | |
python-version: "3.11" | |
- uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4 | |
id: cache-pip-pdiff | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-pdiff | |
restore-keys: | | |
${{ runner.os }}-pip-pdiff | |
- name: Install Python dependencies | |
run: python -m pip install --upgrade pip pdiff cryptography | |
- name: Set up miniconda | |
uses: conda-incubator/setup-miniconda@a4260408e20b96e80095f42ff7f1a15b27dd94ca # v3 | |
with: | |
miniconda-version: "latest" | |
auto-update-conda: true | |
channels: conda-forge,bioconda,defaults | |
- 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 | |
# Test the module | |
- name: Run nf-test | |
env: | |
NFT_DIFF: "pdiff" | |
NFT_DIFF_ARGS: "--line-numbers --width 120 --expand-tabs=2" | |
run: | | |
PROFILE=${{ matrix.profile }} | |
NFT_WORKDIR=~ \ | |
nf-test test \ | |
--profile=${{ matrix.profile }} \ | |
--tap=test.tap \ | |
--verbose \ | |
${{ matrix.path }} | |
- uses: pcolby/tap-summary@0959cbe1d4422e62afc65778cdaea6716c41d936 # v1 | |
with: | |
path: >- | |
test.tap | |
- name: Clean up | |
if: always() | |
run: | | |
sudo rm -rf /home/ubuntu/tests/ | |
confirm-pass: | |
runs-on: ubuntu-latest | |
needs: | |
[ | |
prettier, | |
editorconfig, | |
nf-core-lint-modules, | |
nf-core-lint-subworkflows, | |
nf-test-changes, | |
nf-test, | |
] | |
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) }}" |