From 8c2c995446b69e409b07d0692a52161caa7868a2 Mon Sep 17 00:00:00 2001 From: Robert Ernst Date: Thu, 9 Nov 2023 12:11:53 +0100 Subject: [PATCH 01/29] Ignore ignored config variables --- nf_core/lint/nextflow_config.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/nf_core/lint/nextflow_config.py b/nf_core/lint/nextflow_config.py index 71c908b7b..24f1e5c12 100644 --- a/nf_core/lint/nextflow_config.py +++ b/nf_core/lint/nextflow_config.py @@ -203,6 +203,8 @@ def nextflow_config(self): # Check the variables that should be set to 'true' for k in ["timeline.enabled", "report.enabled", "trace.enabled", "dag.enabled"]: + if k in ignore_configs: + continue if self.nf_config.get(k) == "true": passed.append(f"Config ``{k}`` had correct value: ``{self.nf_config.get(k)}``") else: From 4ad4bb70d2eff96d113db9ddee293413e9d317b6 Mon Sep 17 00:00:00 2001 From: Robert Ernst Date: Thu, 9 Nov 2023 13:26:54 +0100 Subject: [PATCH 02/29] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4442f35e5..c84f8fa4f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ - Fix incorrectly failing linting if 'modules' was not found in meta.yml ([#2447](https://github.com/nf-core/tools/pull/2447)) - Correctly pass subworkflow linting test if `COMPONENT.out.versions` is used in the script ([#2448](https://github.com/nf-core/tools/pull/2448)) - Check for spaces in modules container URLs ([#2452](https://github.com/nf-core/tools/issues/2452)) +- Correctly ignore `timeline.enabled`, `report.enabled`, `trace.enabled`, `dag.enabled` variables. ([#2507](https://github.com/nf-core/tools/pull/2507)) ### Modules From e936ac308662d531de27344c9f0fcd23b1e21afc Mon Sep 17 00:00:00 2001 From: Robert Ernst Date: Mon, 13 Nov 2023 20:05:45 +0100 Subject: [PATCH 03/29] Update CHANGELOG.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: JĂșlia Mir Pedrol --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c84f8fa4f..8d2cecb39 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,7 @@ - Fix incorrectly failing linting if 'modules' was not found in meta.yml ([#2447](https://github.com/nf-core/tools/pull/2447)) - Correctly pass subworkflow linting test if `COMPONENT.out.versions` is used in the script ([#2448](https://github.com/nf-core/tools/pull/2448)) - Check for spaces in modules container URLs ([#2452](https://github.com/nf-core/tools/issues/2452)) -- Correctly ignore `timeline.enabled`, `report.enabled`, `trace.enabled`, `dag.enabled` variables. ([#2507](https://github.com/nf-core/tools/pull/2507)) +- Correctly ignore `timeline.enabled`, `report.enabled`, `trace.enabled`, `dag.enabled` variables when linting a pipeline. ([#2507](https://github.com/nf-core/tools/pull/2507)) ### Modules From 295a44aba893cc7f430670e334e486d8265475ff Mon Sep 17 00:00:00 2001 From: "Moritz E. Beber" Date: Mon, 27 Nov 2023 14:06:55 +0100 Subject: [PATCH 04/29] fix: use double quotes for interpretable string --- nf_core/module-template/modules/main.nf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nf_core/module-template/modules/main.nf b/nf_core/module-template/modules/main.nf index a2cabfd2f..9b9493843 100644 --- a/nf_core/module-template/modules/main.nf +++ b/nf_core/module-template/modules/main.nf @@ -27,7 +27,7 @@ process {{ component_name_underscore|upper }} { // For Conda, the build (i.e. "h9402c20_2") must be EXCLUDED to support installation on different operating systems. // TODO nf-core: See section in main README for further information regarding finding and adding container addresses to the section below. {% endif -%} - conda '${modulesDir}/environment.yml' + conda "${modulesDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? '{{ singularity_container if singularity_container else 'https://depot.galaxyproject.org/singularity/YOUR-TOOL-HERE' }}': '{{ docker_container if docker_container else 'biocontainers/YOUR-TOOL-HERE' }}' }" From 7a4ddfce68f9892b44ed1cb0aac856f30bf36abb Mon Sep 17 00:00:00 2001 From: "Moritz E. Beber" Date: Mon, 27 Nov 2023 14:07:18 +0100 Subject: [PATCH 05/29] fix: correct implicit variable name https://www.nextflow.io/docs/latest/script.html#implicit-variables --- nf_core/module-template/modules/main.nf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nf_core/module-template/modules/main.nf b/nf_core/module-template/modules/main.nf index 9b9493843..d482fa0b4 100644 --- a/nf_core/module-template/modules/main.nf +++ b/nf_core/module-template/modules/main.nf @@ -27,7 +27,7 @@ process {{ component_name_underscore|upper }} { // For Conda, the build (i.e. "h9402c20_2") must be EXCLUDED to support installation on different operating systems. // TODO nf-core: See section in main README for further information regarding finding and adding container addresses to the section below. {% endif -%} - conda "${modulesDir}/environment.yml" + conda "${moduleDir}/environment.yml" container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? '{{ singularity_container if singularity_container else 'https://depot.galaxyproject.org/singularity/YOUR-TOOL-HERE' }}': '{{ docker_container if docker_container else 'biocontainers/YOUR-TOOL-HERE' }}' }" From 1faff58f62aab008652d3659692e234d83fc5ce4 Mon Sep 17 00:00:00 2001 From: "Moritz E. Beber" Date: Mon, 27 Nov 2023 14:12:20 +0100 Subject: [PATCH 06/29] docs: describe fix in changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f64047db4..6ae69fc7a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ - Fix writing files to a remote outdir in the NfcoreTemplate helper functions ([#2465](https://github.com/nf-core/tools/pull/2465)) - Fancier syntax highlighting for example samplesheets in the usage.md template ([#2503](https://github.com/nf-core/tools/pull/2503)) - Use closure for multiqc ext.args ([#2509](https://github.com/nf-core/tools/pull/2509)) +- Fix how the modules template references the conda environment file ([#2540](https://github.com/nf-core/tools/pull/2540)) ### Linting From 8f9b8515c55e4d88a1c053f3c7d56588c2be23f1 Mon Sep 17 00:00:00 2001 From: mashehu Date: Mon, 27 Nov 2023 15:38:27 +0100 Subject: [PATCH 07/29] split jobs up to only run once on dev --- .github/workflows/pytest.yml | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 0fc7f3d09..4d5853499 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -24,7 +24,7 @@ env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} jobs: - pytest: + setup: runs-on: ${{ matrix.runner }} strategy: matrix: @@ -34,16 +34,32 @@ jobs: - runner: "ubuntu-20.04" python-version: "3.8" steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v2 name: Check out source-code repository - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + cache: "pip" + + - name: Check conditions + id: conditions + run: echo "run-tests=${{ github.ref == 'refs/heads/master' || (matrix.runner == 'ubuntu-20.04' && matrix.python-version == '3.8') }}" >> $GITHUB_ENV + + test: + needs: setup + if: ${{ needs.setup.outputs.run-tests == 'true' }} + runs-on: ${{ matrix.runner }} + steps: + - uses: actions/checkout@v2 + name: Check out source-code repository + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} cache: "pip" - # run full test matrix only on PRs to the master branch - if: github.ref == 'refs/heads/master' || matrix.runner == 'ubuntu-20.04' && matrix.python-version == '3.8' - name: Install dependencies run: | From 442b17a0e6eedc4f2675e6981c78d72c06958ae8 Mon Sep 17 00:00:00 2001 From: mashehu Date: Mon, 27 Nov 2023 15:44:29 +0100 Subject: [PATCH 08/29] check condition before setting up anything --- .github/workflows/pytest.yml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 4d5853499..6886656ca 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -33,19 +33,22 @@ jobs: include: - runner: "ubuntu-20.04" python-version: "3.8" + steps: - - uses: actions/checkout@v2 - name: Check out source-code repository + - name: Check conditions + id: conditions + run: echo "run-tests=${{ github.ref == 'refs/heads/master' || (matrix.runner == 'ubuntu-20.04' && matrix.python-version == '3.8') }}" >> $GITHUB_ENV + + - name: Check out source-code repository + uses: actions/checkout@v4 + if: ${{ needs.conditions.outputs.run-tests == 'true' }} - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v2 with: python-version: ${{ matrix.python-version }} cache: "pip" - - - name: Check conditions - id: conditions - run: echo "run-tests=${{ github.ref == 'refs/heads/master' || (matrix.runner == 'ubuntu-20.04' && matrix.python-version == '3.8') }}" >> $GITHUB_ENV + if: ${{ needs.conditions.outputs.run-tests == 'true' }} test: needs: setup From 26cc37b0e628dbcd02021025abaf71a1adfdd49b Mon Sep 17 00:00:00 2001 From: mashehu Date: Mon, 27 Nov 2023 15:49:55 +0100 Subject: [PATCH 09/29] fix copy-paste error --- .github/workflows/pytest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 6886656ca..cd0d58530 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -44,7 +44,7 @@ jobs: if: ${{ needs.conditions.outputs.run-tests == 'true' }} - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} cache: "pip" From f54b9f26b966d78a982d37705fbc4b851e641e5d Mon Sep 17 00:00:00 2001 From: mashehu Date: Mon, 27 Nov 2023 16:18:02 +0100 Subject: [PATCH 10/29] fix variable name in lint test --- nf_core/modules/lint/environment_yml.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nf_core/modules/lint/environment_yml.py b/nf_core/modules/lint/environment_yml.py index d9c0cbf7f..1367054c8 100644 --- a/nf_core/modules/lint/environment_yml.py +++ b/nf_core/modules/lint/environment_yml.py @@ -32,7 +32,7 @@ def environment_yml(module_lint_object: ComponentLint, module: NFCoreComponent) # check if the module's main.nf requires a conda environment with open(Path(module.component_dir, "main.nf"), "r") as fh: main_nf = fh.read() - if "conda '${modulesDir}/environment.yml'" in main_nf: + if "conda '${moduleDir}/environment.yml'" in main_nf: module.failed.append( ("environment_yml_exists", "Module's `environment.yml` does not exist", module.environment_yml) ) From 36ec7930c6de9bc7fdda7313a3a0befc1e2a8ae0 Mon Sep 17 00:00:00 2001 From: mashehu Date: Mon, 27 Nov 2023 16:36:47 +0100 Subject: [PATCH 11/29] fix incorrectly guessed syntax --- .github/workflows/pytest.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index cd0d58530..340768b83 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -41,14 +41,16 @@ jobs: - name: Check out source-code repository uses: actions/checkout@v4 - if: ${{ needs.conditions.outputs.run-tests == 'true' }} + if: ${{ steps.conditions.outputs.run-tests == 'true' }} - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} cache: "pip" - if: ${{ needs.conditions.outputs.run-tests == 'true' }} + if: ${{ steps.conditions.outputs.run-tests == 'true' }} + outputs: + run-tests: ${{ env.run-tests }} test: needs: setup From 84f92bc09c1ba167403656c32b2046402bef5079 Mon Sep 17 00:00:00 2001 From: "Moritz E. Beber" Date: Mon, 27 Nov 2023 18:52:23 +0100 Subject: [PATCH 12/29] fix: adjust quotes to match template --- nf_core/modules/lint/environment_yml.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nf_core/modules/lint/environment_yml.py b/nf_core/modules/lint/environment_yml.py index 1367054c8..a05242553 100644 --- a/nf_core/modules/lint/environment_yml.py +++ b/nf_core/modules/lint/environment_yml.py @@ -32,7 +32,7 @@ def environment_yml(module_lint_object: ComponentLint, module: NFCoreComponent) # check if the module's main.nf requires a conda environment with open(Path(module.component_dir, "main.nf"), "r") as fh: main_nf = fh.read() - if "conda '${moduleDir}/environment.yml'" in main_nf: + if 'conda "${moduleDir}/environment.yml"' in main_nf: module.failed.append( ("environment_yml_exists", "Module's `environment.yml` does not exist", module.environment_yml) ) From d2c5400877b2458a9c7faeef183f553cd64f05d9 Mon Sep 17 00:00:00 2001 From: mashehu Date: Tue, 28 Nov 2023 14:17:14 +0100 Subject: [PATCH 13/29] add mypy to pre-commit config, fix mypy errors --- .pre-commit-config.yaml | 10 +++++ docs/api/_src/conf.py | 5 ++- mypy.ini | 1 + nf_core/__main__.py | 56 +++++++++++++-------------- nf_core/params_file.py | 2 +- nf_core/subworkflows/lint/__init__.py | 12 +++--- pyproject.toml | 5 --- requirements-dev.txt | 1 + tests/test_lint.py | 20 +++++----- 9 files changed, 58 insertions(+), 54 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b7aeeb5bc..578d17f76 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -11,3 +11,13 @@ repos: rev: "v2.7.1" hooks: - id: prettier + - repo: https://github.com/pre-commit/mirrors-mypy + rev: "v1.7.1" # Use the sha / tag you want to point at + hooks: + - id: mypy + additional_dependencies: + - types-PyYAML + - types-requests + - types-jsonschema + - types-Markdown + - types-setuptools diff --git a/docs/api/_src/conf.py b/docs/api/_src/conf.py index 4d8ae661d..27eaf9bcb 100644 --- a/docs/api/_src/conf.py +++ b/docs/api/_src/conf.py @@ -14,6 +14,7 @@ # import os import sys +from typing import Dict sys.path.insert(0, os.path.abspath("../../../nf_core")) import nf_core @@ -58,7 +59,7 @@ # # This is also used if you do content translation via gettext catalogs. # Usually you set "language" from the command line for these cases. -language = None +language: str = "en" # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. @@ -113,7 +114,7 @@ # -- Options for LaTeX output ------------------------------------------------ -latex_elements = { +latex_elements: Dict[str, str] = { # The paper size ('letterpaper' or 'a4paper'). # # 'papersize': 'letterpaper', diff --git a/mypy.ini b/mypy.ini index f869fa7e4..c48aa5884 100644 --- a/mypy.ini +++ b/mypy.ini @@ -1,2 +1,3 @@ [mypy] warn_unused_configs = True +ignore_missing_imports = true diff --git a/nf_core/__main__.py b/nf_core/__main__.py index 232f1bf11..ec5ddeeaa 100644 --- a/nf_core/__main__.py +++ b/nf_core/__main__.py @@ -151,7 +151,7 @@ def nf_core_cli(ctx, verbose, hide_progress, log_file): # nf-core list -@nf_core_cli.command() +@nf_core_cli.command("list") @click.argument("keywords", required=False, nargs=-1, metavar="") @click.option( "-s", @@ -162,7 +162,7 @@ def nf_core_cli(ctx, verbose, hide_progress, log_file): ) @click.option("--json", is_flag=True, default=False, help="Print full output as JSON") @click.option("--show-archived", is_flag=True, default=False, help="Print archived workflows") -def list(keywords, sort, json, show_archived): +def list_pipelines(keywords, sort, json, show_archived): """ List available nf-core pipelines with local info. @@ -553,9 +553,9 @@ def subworkflows(ctx, git_remote, branch, no_pull): # nf-core modules list subcommands -@modules.group() +@modules.group("list") @click.pass_context -def list(ctx): +def modules_list(ctx): """ List modules in a local pipeline or remote repository. """ @@ -563,11 +563,11 @@ def list(ctx): # nf-core modules list remote -@list.command() +@modules_list.command("remote") @click.pass_context @click.argument("keywords", required=False, nargs=-1, metavar="") @click.option("-j", "--json", is_flag=True, help="Print as JSON to stdout") -def remote(ctx, keywords, json): +def modules_list_remote(ctx, keywords, json): """ List modules in a remote GitHub repo [dim i](e.g [link=https://github.com/nf-core/modules]nf-core/modules[/])[/]. """ @@ -588,7 +588,7 @@ def remote(ctx, keywords, json): # nf-core modules list local -@list.command() +@modules_list.command("local") @click.pass_context @click.argument("keywords", required=False, nargs=-1, metavar="") @click.option("-j", "--json", is_flag=True, help="Print as JSON to stdout") @@ -599,7 +599,7 @@ def remote(ctx, keywords, json): default=".", help=r"Pipeline directory. [dim]\[default: Current working directory][/]", ) -def local(ctx, keywords, json, dir): # pylint: disable=redefined-builtin +def modules_list_local(ctx, keywords, json, dir): # pylint: disable=redefined-builtin """ List modules installed locally in a pipeline """ @@ -620,7 +620,7 @@ def local(ctx, keywords, json, dir): # pylint: disable=redefined-builtin # nf-core modules install -@modules.command() +@modules.command("install") @click.pass_context @click.argument("tool", type=str, required=False, metavar=" or ") @click.option( @@ -633,7 +633,7 @@ def local(ctx, keywords, json, dir): # pylint: disable=redefined-builtin @click.option("-p", "--prompt", is_flag=True, default=False, help="Prompt for the version of the module") @click.option("-f", "--force", is_flag=True, default=False, help="Force reinstallation of module if it already exists") @click.option("-s", "--sha", type=str, metavar="", help="Install module at commit SHA") -def install(ctx, tool, dir, prompt, force, sha): +def modules_install(ctx, tool, dir, prompt, force, sha): """ Install DSL2 modules within a pipeline. @@ -660,7 +660,7 @@ def install(ctx, tool, dir, prompt, force, sha): # nf-core modules update -@modules.command() +@modules.command("update") @click.pass_context @click.argument("tool", type=str, required=False, metavar=" or ") @click.option( @@ -699,7 +699,7 @@ def install(ctx, tool, dir, prompt, force, sha): default=False, help="Automatically update all linked modules and subworkflows without asking for confirmation", ) -def update(ctx, tool, directory, force, prompt, sha, install_all, preview, save_diff, update_deps): +def modules_update(ctx, tool, directory, force, prompt, sha, install_all, preview, save_diff, update_deps): """ Update DSL2 modules within a pipeline. @@ -767,7 +767,7 @@ def patch(ctx, tool, dir, remove): # nf-core modules remove -@modules.command() +@modules.command("remove") @click.pass_context @click.argument("tool", type=str, required=False, metavar=" or ") @click.option( @@ -777,7 +777,7 @@ def patch(ctx, tool, dir, remove): default=".", help=r"Pipeline directory. [dim]\[default: current working directory][/]", ) -def remove(ctx, dir, tool): +def modules_remove(ctx, dir, tool): """ Remove a module from a pipeline. """ @@ -887,7 +887,7 @@ def test_module(ctx, tool, dir, no_prompts, update, once): # nf-core modules lint -@modules.command() +@modules.command("lint") @click.pass_context @click.argument("tool", type=str, required=False, metavar=" or ") @click.option("-d", "--dir", type=click.Path(exists=True), default=".", metavar="") @@ -912,9 +912,7 @@ def test_module(ctx, tool, dir, no_prompts, update, once): show_default=True, ) @click.option("--fix-version", is_flag=True, help="Fix the module version if a newer version is available") -def lint( - ctx, tool, dir, registry, key, all, fail_warned, local, passed, sort_by, fix_version -): # pylint: disable=redefined-outer-name +def modules_lint(ctx, tool, dir, registry, key, all, fail_warned, local, passed, sort_by, fix_version): """ Lint one or more modules in a directory. @@ -959,7 +957,7 @@ def lint( # nf-core modules info -@modules.command() +@modules.command("info") @click.pass_context @click.argument("tool", type=str, required=False, metavar=" or ") @click.option( @@ -969,7 +967,7 @@ def lint( default=".", help=r"Pipeline directory. [dim]\[default: Current working directory][/]", ) -def info(ctx, tool, dir): +def modules_info(ctx, tool, dir): """ Show developer usage information about a given module. @@ -1095,9 +1093,9 @@ def test_subworkflow(ctx, subworkflow, dir, no_prompts, update, once): # nf-core subworkflows list subcommands -@subworkflows.group() +@subworkflows.group("list") @click.pass_context -def list(ctx): +def subworkflows_list(ctx): """ List subworkflows in a local pipeline or remote repository. """ @@ -1105,7 +1103,7 @@ def list(ctx): # nf-core subworkflows list remote -@list.command() +@subworkflows_list.command("remote") @click.pass_context @click.argument("keywords", required=False, nargs=-1, metavar="") @click.option("-j", "--json", is_flag=True, help="Print as JSON to stdout") @@ -1131,7 +1129,7 @@ def remote(ctx, keywords, json): # nf-core subworkflows list local -@list.command() +@subworkflows_list.command("local") @click.pass_context @click.argument("keywords", required=False, nargs=-1, metavar="") @click.option("-j", "--json", is_flag=True, help="Print as JSON to stdout") @@ -1163,7 +1161,7 @@ def local(ctx, keywords, json, dir): # pylint: disable=redefined-builtin # nf-core subworkflows lint -@subworkflows.command() +@subworkflows.command("lint") @click.pass_context @click.argument("subworkflow", type=str, required=False, metavar="subworkflow name") @click.option("-d", "--dir", type=click.Path(exists=True), default=".", metavar="") @@ -1187,9 +1185,7 @@ def local(ctx, keywords, json, dir): # pylint: disable=redefined-builtin help="Sort lint output by subworkflow or test name.", show_default=True, ) -def lint( - ctx, subworkflow, dir, registry, key, all, fail_warned, local, passed, sort_by -): # pylint: disable=redefined-outer-name +def subworkflows_lint(ctx, subworkflow, dir, registry, key, all, fail_warned, local, passed, sort_by): """ Lint one or more subworkflows in a directory. @@ -1496,11 +1492,11 @@ def build(dir, no_prompts, web_only, url): # nf-core schema lint -@schema.command() +@schema.command("lint") @click.argument( "schema_path", type=click.Path(exists=True), default="nextflow_schema.json", metavar="" ) -def lint(schema_path): +def schema_lint(schema_path): """ Check that a given pipeline schema is valid. diff --git a/nf_core/params_file.py b/nf_core/params_file.py index 39986b95c..5c50c53fb 100644 --- a/nf_core/params_file.py +++ b/nf_core/params_file.py @@ -89,7 +89,7 @@ def __init__( self, pipeline=None, revision=None, - ): + ) -> None: """Initialise the ParamFileBuilder class Args: diff --git a/nf_core/subworkflows/lint/__init__.py b/nf_core/subworkflows/lint/__init__.py index 44c7c21a3..ffba41f9d 100644 --- a/nf_core/subworkflows/lint/__init__.py +++ b/nf_core/subworkflows/lint/__init__.py @@ -29,12 +29,12 @@ class SubworkflowLint(ComponentLint): """ # Import lint functions - from .main_nf import main_nf - from .meta_yml import meta_yml - from .subworkflow_changes import subworkflow_changes - from .subworkflow_tests import subworkflow_tests - from .subworkflow_todos import subworkflow_todos - from .subworkflow_version import subworkflow_version + from .main_nf import main_nf # type: ignore[misc] + from .meta_yml import meta_yml # type: ignore[misc] + from .subworkflow_changes import subworkflow_changes # type: ignore[misc] + from .subworkflow_tests import subworkflow_tests # type: ignore[misc] + from .subworkflow_todos import subworkflow_todos # type: ignore[misc] + from .subworkflow_version import subworkflow_version # type: ignore[misc] def __init__( self, diff --git a/pyproject.toml b/pyproject.toml index f0702742f..238007310 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -20,8 +20,3 @@ norecursedirs = [ ".*", "build", "dist", "*.egg", "data", "__pycache__", ".githu profile = "black" known_first_party = ["nf_core"] multi_line_output = 3 - -[tool.mypy] -ignore_missing_imports = true -follow_imports = "skip" -disable_error_code = "no-redef" diff --git a/requirements-dev.txt b/requirements-dev.txt index 12183eb98..3ef059308 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -11,3 +11,4 @@ types-PyYAML types-requests types-jsonschema types-Markdown +types-setuptools diff --git a/tests/test_lint.py b/tests/test_lint.py index 67104e3ad..69917b279 100644 --- a/tests/test_lint.py +++ b/tests/test_lint.py @@ -178,44 +178,44 @@ def test_sphinx_md_files(self): ####################### # SPECIFIC LINT TESTS # ####################### - from .lint.actions_awsfulltest import ( + from .lint.actions_awsfulltest import ( # type: ignore[misc] test_actions_awsfulltest_fail, test_actions_awsfulltest_pass, test_actions_awsfulltest_warn, ) - from .lint.actions_awstest import ( + from .lint.actions_awstest import ( # type: ignore[misc] test_actions_awstest_fail, test_actions_awstest_pass, ) - from .lint.actions_ci import ( + from .lint.actions_ci import ( # type: ignore[misc] test_actions_ci_fail_wrong_nf, test_actions_ci_fail_wrong_trigger, test_actions_ci_pass, ) - from .lint.actions_schema_validation import ( + from .lint.actions_schema_validation import ( # type: ignore[misc] test_actions_schema_validation_fails_for_additional_property, test_actions_schema_validation_missing_jobs, test_actions_schema_validation_missing_on, ) - from .lint.files_exist import ( + from .lint.files_exist import ( # type: ignore[misc] test_files_exist_depreciated_file, test_files_exist_missing_config, test_files_exist_missing_main, test_files_exist_pass, ) - from .lint.files_unchanged import ( + from .lint.files_unchanged import ( # type: ignore[misc] test_files_unchanged_fail, test_files_unchanged_pass, ) - from .lint.merge_markers import test_merge_markers_found - from .lint.modules_json import test_modules_json_pass - from .lint.nextflow_config import ( + from .lint.merge_markers import test_merge_markers_found # type: ignore[misc] + from .lint.modules_json import test_modules_json_pass # type: ignore[misc] + from .lint.nextflow_config import ( # type: ignore[misc] test_nextflow_config_bad_name_fail, test_nextflow_config_dev_in_release_mode_failed, test_nextflow_config_example_pass, test_nextflow_config_missing_test_profile_failed, ) - from .lint.version_consistency import test_version_consistency + from .lint.version_consistency import test_version_consistency # type: ignore[misc] # TODO nf-core: Assess and strip out if no longer required for DSL2 From 62ee35e4d44339569206f79437a3a5076b7db175 Mon Sep 17 00:00:00 2001 From: mashehu Date: Tue, 28 Nov 2023 14:37:52 +0100 Subject: [PATCH 14/29] try different condition and without accessing the matrix --- .github/workflows/pytest.yml | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 340768b83..03d5bc65e 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -41,29 +41,31 @@ jobs: - name: Check out source-code repository uses: actions/checkout@v4 - if: ${{ steps.conditions.outputs.run-tests == 'true' }} + if: ${{ env.run-tests == 'true' }} - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} cache: "pip" - if: ${{ steps.conditions.outputs.run-tests == 'true' }} + if: ${{ env.run-tests == 'true' }} outputs: + python-version: ${{ matrix.python-version }} + runner: ${{ matrix.runner }} run-tests: ${{ env.run-tests }} test: needs: setup if: ${{ needs.setup.outputs.run-tests == 'true' }} - runs-on: ${{ matrix.runner }} + runs-on: ${{ needs.setup.outputs.runner }} steps: - uses: actions/checkout@v2 name: Check out source-code repository - - name: Set up Python ${{ matrix.python-version }} + - name: Set up Python ${{ needs.setup.outputs.python-version }} uses: actions/setup-python@v2 with: - python-version: ${{ matrix.python-version }} + python-version: ${{ needs.setup.outputs.python-version }} cache: "pip" - name: Install dependencies @@ -72,7 +74,7 @@ jobs: pip install -e . - name: Downgrade git to the Ubuntu official repository's version - if: ${{ matrix.runner == 'ubuntu-20.04' && matrix.python-version == '3.8' }} + if: ${{ needs.setup.outputs.runner == 'ubuntu-20.04' && needs.setup.outputs.python-version == '3.8' }} run: | sudo apt update sudo apt remove git git-man From b442d50adc5ec9b87ca045eb23dca4be5b5d9212 Mon Sep 17 00:00:00 2001 From: mashehu Date: Tue, 28 Nov 2023 15:01:11 +0100 Subject: [PATCH 15/29] use same naming for modules and subworkflo commands --- nf_core/__main__.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/nf_core/__main__.py b/nf_core/__main__.py index ec5ddeeaa..43095bc19 100644 --- a/nf_core/__main__.py +++ b/nf_core/__main__.py @@ -1107,7 +1107,7 @@ def subworkflows_list(ctx): @click.pass_context @click.argument("keywords", required=False, nargs=-1, metavar="") @click.option("-j", "--json", is_flag=True, help="Print as JSON to stdout") -def remote(ctx, keywords, json): +def subworkflows_list_remote(ctx, keywords, json): """ List subworkflows in a remote GitHub repo [dim i](e.g [link=https://github.com/nf-core/modules]nf-core/modules[/])[/]. """ @@ -1140,7 +1140,7 @@ def remote(ctx, keywords, json): default=".", help=r"Pipeline directory. [dim]\[default: Current working directory][/]", ) -def local(ctx, keywords, json, dir): # pylint: disable=redefined-builtin +def subworkflows_list_local(ctx, keywords, json, dir): # pylint: disable=redefined-builtin """ List subworkflows installed locally in a pipeline """ @@ -1229,7 +1229,7 @@ def subworkflows_lint(ctx, subworkflow, dir, registry, key, all, fail_warned, lo # nf-core subworkflows info -@subworkflows.command() +@subworkflows.command("info") @click.pass_context @click.argument("tool", type=str, required=False, metavar="subworkflow name") @click.option( @@ -1239,7 +1239,7 @@ def subworkflows_lint(ctx, subworkflow, dir, registry, key, all, fail_warned, lo default=".", help=r"Pipeline directory. [dim]\[default: Current working directory][/]", ) -def info(ctx, tool, dir): +def subworkflows_info(ctx, tool, dir): """ Show developer usage information about a given subworkflow. @@ -1268,7 +1268,7 @@ def info(ctx, tool, dir): # nf-core subworkflows install -@subworkflows.command() +@subworkflows.command("install") @click.pass_context @click.argument("subworkflow", type=str, required=False, metavar="subworkflow name") @click.option( @@ -1283,7 +1283,7 @@ def info(ctx, tool, dir): "-f", "--force", is_flag=True, default=False, help="Force reinstallation of subworkflow if it already exists" ) @click.option("-s", "--sha", type=str, metavar="", help="Install subworkflow at commit SHA") -def install(ctx, subworkflow, dir, prompt, force, sha): +def subworkflows_install(ctx, subworkflow, dir, prompt, force, sha): """ Install DSL2 subworkflow within a pipeline. @@ -1310,7 +1310,7 @@ def install(ctx, subworkflow, dir, prompt, force, sha): # nf-core subworkflows remove -@subworkflows.command() +@subworkflows.command("remove") @click.pass_context @click.argument("subworkflow", type=str, required=False, metavar="subworkflow name") @click.option( @@ -1320,7 +1320,7 @@ def install(ctx, subworkflow, dir, prompt, force, sha): default=".", help=r"Pipeline directory. [dim]\[default: current working directory][/]", ) -def remove(ctx, dir, subworkflow): +def subworkflows_remove(ctx, dir, subworkflow): """ Remove a subworkflow from a pipeline. """ @@ -1340,7 +1340,7 @@ def remove(ctx, dir, subworkflow): # nf-core subworkflows update -@subworkflows.command() +@subworkflows.command("update") @click.pass_context @click.argument("subworkflow", type=str, required=False, metavar="subworkflow name") @click.option( @@ -1378,7 +1378,7 @@ def remove(ctx, dir, subworkflow): default=False, help="Automatically update all linked modules and subworkflows without asking for confirmation", ) -def update(ctx, subworkflow, dir, force, prompt, sha, install_all, preview, save_diff, update_deps): +def subworkflows_update(ctx, subworkflow, dir, force, prompt, sha, install_all, preview, save_diff, update_deps): """ Update DSL2 subworkflow within a pipeline. @@ -1392,7 +1392,7 @@ def update(ctx, subworkflow, dir, force, prompt, sha, install_all, preview, save force, prompt, sha, - all, + install_all, preview, save_diff, update_deps, From ed8efbcea8e0b13d508c9229c82fc8412a3acc63 Mon Sep 17 00:00:00 2001 From: mashehu Date: Tue, 28 Nov 2023 15:53:34 +0100 Subject: [PATCH 16/29] update github checkout and setup-python --- .github/workflows/create-lint-wf.yml | 4 ++-- .../workflows/create-test-lint-wf-template.yml | 4 ++-- .github/workflows/create-test-wf.yml | 2 +- .github/workflows/deploy-pypi.yml | 2 +- .github/workflows/fix-linting.yml | 4 ++-- .github/workflows/lint-code.yml | 16 ++++++++-------- .github/workflows/push_dockerhub_dev.yml | 2 +- .github/workflows/push_dockerhub_release.yml | 2 +- .github/workflows/pytest.yml | 2 +- .github/workflows/rich-codex.yml | 2 +- .github/workflows/sync.yml | 4 ++-- .github/workflows/tools-api-docs-dev.yml | 2 +- .github/workflows/tools-api-docs-release.yml | 2 +- CHANGELOG.md | 1 + .../pipeline-template/.github/workflows/ci.yml | 2 +- .../.github/workflows/fix-linting.yml | 4 ++-- .../.github/workflows/linting.yml | 12 ++++++------ 17 files changed, 34 insertions(+), 33 deletions(-) diff --git a/.github/workflows/create-lint-wf.yml b/.github/workflows/create-lint-wf.yml index d5f377a48..51daec21b 100644 --- a/.github/workflows/create-lint-wf.yml +++ b/.github/workflows/create-lint-wf.yml @@ -27,7 +27,7 @@ jobs: - "latest-everything" steps: # Get the repo code - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 name: Check out source-code repository # Set up nf-core/tools @@ -48,7 +48,7 @@ jobs: version: ${{ matrix.NXF_VER }} # Install the Prettier linting tools - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 - name: Install Prettier run: npm install -g prettier diff --git a/.github/workflows/create-test-lint-wf-template.yml b/.github/workflows/create-test-lint-wf-template.yml index 5ce9b4111..f1c6c4d14 100644 --- a/.github/workflows/create-test-lint-wf-template.yml +++ b/.github/workflows/create-test-lint-wf-template.yml @@ -33,7 +33,7 @@ jobs: - "template_skip_nf_core_configs.yml" steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 name: Check out source-code repository - name: Set up Python 3.12 @@ -52,7 +52,7 @@ jobs: version: latest-everything # Install the Prettier linting tools - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 - name: Install Prettier run: npm install -g prettier diff --git a/.github/workflows/create-test-wf.yml b/.github/workflows/create-test-wf.yml index d96518d7c..4f66adae6 100644 --- a/.github/workflows/create-test-wf.yml +++ b/.github/workflows/create-test-wf.yml @@ -26,7 +26,7 @@ jobs: - "23.04.0" - "latest-everything" steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 name: Check out source-code repository - name: Set up Python 3.12 diff --git a/.github/workflows/deploy-pypi.yml b/.github/workflows/deploy-pypi.yml index 9b46f0731..b847df921 100644 --- a/.github/workflows/deploy-pypi.yml +++ b/.github/workflows/deploy-pypi.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 name: Check out source-code repository - name: Set up Python 3.12 diff --git a/.github/workflows/fix-linting.yml b/.github/workflows/fix-linting.yml index f56cb927f..a6cf14956 100644 --- a/.github/workflows/fix-linting.yml +++ b/.github/workflows/fix-linting.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest steps: # Use the @nf-core-bot token to check out so we can push later - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: token: ${{ secrets.nf_core_bot_auth_token }} @@ -24,7 +24,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.nf_core_bot_auth_token }} - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 - name: Install Prettier run: npm install -g prettier @prettier/plugin-php diff --git a/.github/workflows/lint-code.yml b/.github/workflows/lint-code.yml index a951230a6..baaaedcb4 100644 --- a/.github/workflows/lint-code.yml +++ b/.github/workflows/lint-code.yml @@ -16,9 +16,9 @@ jobs: EditorConfig: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 - name: Install editorconfig-checker run: npm install -g editorconfig-checker @@ -30,9 +30,9 @@ jobs: Prettier: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 - name: Install Prettier run: npm install -g prettier @@ -43,7 +43,7 @@ jobs: PythonBlack: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Check code lints with Black uses: psf/black@stable @@ -74,7 +74,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out source-code repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Python 3.12 uses: actions/setup-python@v4 @@ -89,8 +89,8 @@ jobs: static-type-check: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-python@v3 + - uses: actions/checkout@v4 + - uses: actions/setup-python@v4 with: python-version: 3.12 cache: "pip" diff --git a/.github/workflows/push_dockerhub_dev.yml b/.github/workflows/push_dockerhub_dev.yml index dea28cdd3..169a917d8 100644 --- a/.github/workflows/push_dockerhub_dev.yml +++ b/.github/workflows/push_dockerhub_dev.yml @@ -23,7 +23,7 @@ jobs: fail-fast: false steps: - name: Check out code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Build nfcore/tools:dev docker image run: docker build --no-cache . -t nfcore/tools:dev diff --git a/.github/workflows/push_dockerhub_release.yml b/.github/workflows/push_dockerhub_release.yml index 857b24102..49ce17dd8 100644 --- a/.github/workflows/push_dockerhub_release.yml +++ b/.github/workflows/push_dockerhub_release.yml @@ -23,7 +23,7 @@ jobs: fail-fast: false steps: - name: Check out code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Build nfcore/tools:latest docker image run: docker build --no-cache . -t nfcore/tools:latest diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 0fc7f3d09..be9942dd1 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -34,7 +34,7 @@ jobs: - runner: "ubuntu-20.04" python-version: "3.8" steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 name: Check out source-code repository - name: Set up Python ${{ matrix.python-version }} diff --git a/.github/workflows/rich-codex.yml b/.github/workflows/rich-codex.yml index 54aaf240d..836825539 100644 --- a/.github/workflows/rich-codex.yml +++ b/.github/workflows/rich-codex.yml @@ -6,7 +6,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out the repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v4 with: diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml index 5e7719973..b8fb28794 100644 --- a/.github/workflows/sync.yml +++ b/.github/workflows/sync.yml @@ -36,10 +36,10 @@ jobs: matrix: ${{fromJson(needs.get-pipelines.outputs.matrix)}} fail-fast: false steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 name: Check out nf-core/tools - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 name: Check out nf-core/${{ matrix.pipeline }} with: repository: nf-core/${{ matrix.pipeline }} diff --git a/.github/workflows/tools-api-docs-dev.yml b/.github/workflows/tools-api-docs-dev.yml index 3a4725a94..7de8913e0 100644 --- a/.github/workflows/tools-api-docs-dev.yml +++ b/.github/workflows/tools-api-docs-dev.yml @@ -24,7 +24,7 @@ jobs: steps: - name: Check out source-code repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Python 3.12 uses: actions/setup-python@v4 diff --git a/.github/workflows/tools-api-docs-release.yml b/.github/workflows/tools-api-docs-release.yml index 8a6eda131..412784c23 100644 --- a/.github/workflows/tools-api-docs-release.yml +++ b/.github/workflows/tools-api-docs-release.yml @@ -19,7 +19,7 @@ jobs: - ${{ github.event.release.tag_name }} steps: - name: Check out source-code repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Python 3.12 uses: actions/setup-python@v4 diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ae69fc7a..0ab328866 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -31,6 +31,7 @@ - Change testing framework for modules and subworkflows from pytest to nf-test ([#2490](https://github.com/nf-core/tools/pull/2490)) - `bump_version` keeps now the indentation level of the updated version entries ([#2514](https://github.com/nf-core/tools/pull/2514)) - Run tests with Python 3.12 ([#2522](https://github.com/nf-core/tools/pull/2522)). +- Add mypy to pre-commit config for the tools repo ([#2545](https://github.com/nf-core/tools/pull/2545)) # [v2.10 - Nickel Ostrich](https://github.com/nf-core/tools/releases/tag/2.10) + [2023-09-25] diff --git a/nf_core/pipeline-template/.github/workflows/ci.yml b/nf_core/pipeline-template/.github/workflows/ci.yml index 521f3e664..3edd49f09 100644 --- a/nf_core/pipeline-template/.github/workflows/ci.yml +++ b/nf_core/pipeline-template/.github/workflows/ci.yml @@ -28,7 +28,7 @@ jobs: - "latest-everything" steps: - name: Check out pipeline code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install Nextflow uses: nf-core/setup-nextflow@v1 diff --git a/nf_core/pipeline-template/.github/workflows/fix-linting.yml b/nf_core/pipeline-template/.github/workflows/fix-linting.yml index f3dc3e50f..31e8cd2b3 100644 --- a/nf_core/pipeline-template/.github/workflows/fix-linting.yml +++ b/nf_core/pipeline-template/.github/workflows/fix-linting.yml @@ -13,7 +13,7 @@ jobs: runs-on: ubuntu-latest steps: # Use the @nf-core-bot token to check out so we can push later - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: token: ${{ secrets.nf_core_bot_auth_token }} @@ -24,7 +24,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.nf_core_bot_auth_token }} - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 - name: Install Prettier run: npm install -g prettier @prettier/plugin-php diff --git a/nf_core/pipeline-template/.github/workflows/linting.yml b/nf_core/pipeline-template/.github/workflows/linting.yml index edce89065..64d1851f2 100644 --- a/nf_core/pipeline-template/.github/workflows/linting.yml +++ b/nf_core/pipeline-template/.github/workflows/linting.yml @@ -14,9 +14,9 @@ jobs: EditorConfig: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 - name: Install editorconfig-checker run: npm install -g editorconfig-checker @@ -27,9 +27,9 @@ jobs: Prettier: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - - uses: actions/setup-node@v3 + - uses: actions/setup-node@v4 - name: Install Prettier run: npm install -g prettier @@ -40,7 +40,7 @@ jobs: PythonBlack: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Check code lints with Black uses: psf/black@stable @@ -71,7 +71,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Check out pipeline code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install Nextflow uses: nf-core/setup-nextflow@v1 From ae505c46cd271582c50aa956bfbc9449222bcab4 Mon Sep 17 00:00:00 2001 From: mashehu Date: Tue, 28 Nov 2023 16:01:22 +0100 Subject: [PATCH 17/29] =?UTF-8?q?switch=20to=20self-hosted=20=F0=9F=A4=9E?= =?UTF-8?q?=F0=9F=8F=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/pytest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 03d5bc65e..b6edac518 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -57,7 +57,7 @@ jobs: test: needs: setup if: ${{ needs.setup.outputs.run-tests == 'true' }} - runs-on: ${{ needs.setup.outputs.runner }} + runs-on: ["self-hosted"] steps: - uses: actions/checkout@v2 name: Check out source-code repository From 1ad27a7eb955a13dcc5dc53ab576be94c7429126 Mon Sep 17 00:00:00 2001 From: mashehu Date: Tue, 28 Nov 2023 16:05:26 +0100 Subject: [PATCH 18/29] =?UTF-8?q?Revert=20"switch=20to=20self-hosted=20?= =?UTF-8?q?=F0=9F=A4=9E=F0=9F=8F=BB"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit ae505c46cd271582c50aa956bfbc9449222bcab4. --- .github/workflows/pytest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index b6edac518..03d5bc65e 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -57,7 +57,7 @@ jobs: test: needs: setup if: ${{ needs.setup.outputs.run-tests == 'true' }} - runs-on: ["self-hosted"] + runs-on: ${{ needs.setup.outputs.runner }} steps: - uses: actions/checkout@v2 name: Check out source-code repository From 13bbac6570af595697aaec638a82d7e7fd4fa3ac Mon Sep 17 00:00:00 2001 From: mashehu Date: Tue, 28 Nov 2023 16:32:57 +0100 Subject: [PATCH 19/29] fix subworkflow command --- nf_core/__main__.py | 1 - 1 file changed, 1 deletion(-) diff --git a/nf_core/__main__.py b/nf_core/__main__.py index 232f1bf11..81e7de0f1 100644 --- a/nf_core/__main__.py +++ b/nf_core/__main__.py @@ -1064,7 +1064,6 @@ def create_subworkflow(ctx, subworkflow, dir, author, force): @click.pass_context @click.argument("subworkflow", type=str, required=False, metavar="subworkflow name") @click.option("-d", "--dir", type=click.Path(exists=True), default=".", metavar="") -@click.option("-t", "--run-tests", is_flag=True, default=False, help="Run the test workflows") @click.option("-p", "--no-prompts", is_flag=True, default=False, help="Use defaults without prompting") @click.option("-u", "--update", is_flag=True, default=False, help="Update existing snapshots") @click.option("-o", "--once", is_flag=True, default=False, help="Run tests only once. Don't check snapshot stability") From ad03acdd8007e482f7f6d1df2dd9b3b9394ab103 Mon Sep 17 00:00:00 2001 From: mashehu Date: Tue, 28 Nov 2023 22:00:46 +0100 Subject: [PATCH 20/29] fix parsing for include statement of nested subworkflows, print long messages --- nf_core/components/lint/__init__.py | 17 ++++++++++++----- nf_core/components/nfcore_component.py | 13 ++++++++++--- nf_core/subworkflows/lint/subworkflow_tests.py | 1 + 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/nf_core/components/lint/__init__.py b/nf_core/components/lint/__init__.py index c46d68ff2..efffc28e8 100644 --- a/nf_core/components/lint/__init__.py +++ b/nf_core/components/lint/__init__.py @@ -10,7 +10,9 @@ import os from pathlib import Path -import rich +import rich.box +import rich.console +import rich.panel from rich.markdown import Markdown from rich.table import Table @@ -209,7 +211,7 @@ def _print_results(self, show_passed=False, sort_by="test"): self.failed.sort(key=operator.attrgetter(*sort_order)) # Find maximum module name length - max_name_len = 40 + max_name_len = len(self.component_type[:-1] + " name") for tests in [self.passed, self.warned, self.failed]: try: for lint_result in tests: @@ -264,7 +266,7 @@ def format_result(test_results, table): table = Table(style="yellow", box=rich.box.MINIMAL, pad_edge=False, border_style="dim") table.add_column(f"{self.component_type[:-1].title()} name", width=max_name_len) table.add_column("File path") - table.add_column("Test message") + table.add_column("Test message", overflow="fold") table = format_result(self.warned, table) console.print( rich.panel.Panel( @@ -278,10 +280,15 @@ def format_result(test_results, table): # Table of failing tests if len(self.failed) > 0: - table = Table(style="red", box=rich.box.MINIMAL, pad_edge=False, border_style="dim") + table = Table( + style="red", + box=rich.box.MINIMAL, + pad_edge=False, + border_style="dim", + ) table.add_column(f"{self.component_type[:-1].title()} name", width=max_name_len) table.add_column("File path") - table.add_column("Test message") + table.add_column("Test message", overflow="fold") table = format_result(self.failed, table) console.print( rich.panel.Panel( diff --git a/nf_core/components/nfcore_component.py b/nf_core/components/nfcore_component.py index 190310faa..8d9b6840b 100644 --- a/nf_core/components/nfcore_component.py +++ b/nf_core/components/nfcore_component.py @@ -4,6 +4,7 @@ import logging import re from pathlib import Path +from typing import Union log = logging.getLogger(__name__) @@ -77,7 +78,7 @@ def __init__( self.test_yml = None self.test_main_nf = None - def _get_main_nf_tags(self, test_main_nf: str): + def _get_main_nf_tags(self, test_main_nf: Union[Path, str]): """Collect all tags from the main.nf.test file.""" tags = [] with open(test_main_nf, "r") as fh: @@ -86,13 +87,19 @@ def _get_main_nf_tags(self, test_main_nf: str): tags.append(line.strip().split()[1].strip('"')) return tags - def _get_included_components(self, main_nf: str): + def _get_included_components(self, main_nf: Union[Path, str]): """Collect all included components from the main.nf file.""" included_components = [] with open(main_nf, "r") as fh: for line in fh: if line.strip().startswith("include"): - included_components.append(line.strip().split()[-1].split(self.org)[-1].split("main")[0].strip("/")) + # get tool/subtool or subworkflow name from include statement, can be in the form + #'../../../modules/nf-core/hisat2/align/main' + #'../bam_sort_stats_samtools/main' + #'../subworkflows/nf-core/bam_sort_stats_samtools/main' + component = line.strip().split()[-1].split(self.org)[-1].split("main")[0].strip("/") + component = component.replace("'../", "subworkflows/") + included_components.append(component) return included_components def get_inputs_from_main_nf(self): diff --git a/nf_core/subworkflows/lint/subworkflow_tests.py b/nf_core/subworkflows/lint/subworkflow_tests.py index e82d00f63..30439a8d0 100644 --- a/nf_core/subworkflows/lint/subworkflow_tests.py +++ b/nf_core/subworkflows/lint/subworkflow_tests.py @@ -107,6 +107,7 @@ def subworkflow_tests(_, subworkflow: NFCoreComponent): included_components = [] if subworkflow.main_nf.is_file(): included_components = subworkflow._get_included_components(subworkflow.main_nf) + log.debug(f"Required tags: {required_tags}") missing_tags = [] for tag in required_tags + included_components: if tag not in main_nf_tags: From da7636a3e44ead54ffacce02f20dd175cc06121a Mon Sep 17 00:00:00 2001 From: mashehu Date: Wed, 29 Nov 2023 13:25:03 +0100 Subject: [PATCH 21/29] fix subworkflow tag in template --- nf_core/subworkflow-template/subworkflows/tests/main.nf.test | 1 - 1 file changed, 1 deletion(-) diff --git a/nf_core/subworkflow-template/subworkflows/tests/main.nf.test b/nf_core/subworkflow-template/subworkflows/tests/main.nf.test index b0a212f2a..59c4fdb67 100644 --- a/nf_core/subworkflow-template/subworkflows/tests/main.nf.test +++ b/nf_core/subworkflow-template/subworkflows/tests/main.nf.test @@ -8,7 +8,6 @@ nextflow_workflow { tag "subworkflows" tag "subworkflows_nfcore" - tag "{{ component_name }}" tag "subworkflows/{{ component_name }}" // TODO nf-core: Add tags for all modules used within this subworkflow. Example: tag "samtools" From cc3b6e1b9b15fb2b2bbbcb1bcd8eb521669e0182 Mon Sep 17 00:00:00 2001 From: mashehu Date: Wed, 29 Nov 2023 15:59:14 +0100 Subject: [PATCH 22/29] fix linting tests --- .github/workflows/pytest.yml | 1 + .../subworkflows/lint/subworkflow_tests.py | 1 - tests/subworkflows/lint.py | 11 +++++++---- tests/test_subworkflows.py | 19 ++++++++----------- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 03d5bc65e..2557c4fa4 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -55,6 +55,7 @@ jobs: run-tests: ${{ env.run-tests }} test: + name: Test with Python ${{ needs.setup.outputs.python-version }} on ${{ needs.setup.outputs.runner }} needs: setup if: ${{ needs.setup.outputs.run-tests == 'true' }} runs-on: ${{ needs.setup.outputs.runner }} diff --git a/nf_core/subworkflows/lint/subworkflow_tests.py b/nf_core/subworkflows/lint/subworkflow_tests.py index 30439a8d0..a125be152 100644 --- a/nf_core/subworkflows/lint/subworkflow_tests.py +++ b/nf_core/subworkflows/lint/subworkflow_tests.py @@ -102,7 +102,6 @@ def subworkflow_tests(_, subworkflow: NFCoreComponent): "subworkflows", f"subworkflows/{subworkflow.component_name}", "subworkflows_nfcore", - subworkflow.component_name, ] included_components = [] if subworkflow.main_nf.is_file(): diff --git a/tests/subworkflows/lint.py b/tests/subworkflows/lint.py index 5bbe746f2..1380db226 100644 --- a/tests/subworkflows/lint.py +++ b/tests/subworkflows/lint.py @@ -28,9 +28,8 @@ def test_subworkflows_lint_new_subworkflow(self): """lint a new subworkflow""" subworkflow_lint = nf_core.subworkflows.SubworkflowLint(dir=self.nfcore_modules) subworkflow_lint.lint(print_results=True, all_subworkflows=True) - assert ( - len(subworkflow_lint.failed) == 1 # test snap missing after creating a subworkflow - ), f"Linting failed with {[x.__dict__ for x in subworkflow_lint.failed]}" + assert len(subworkflow_lint.failed) == 0 + assert len(subworkflow_lint.passed) > 0 assert len(subworkflow_lint.warned) >= 0 @@ -68,7 +67,6 @@ def test_subworkflows_lint_multiple_remotes(self): def test_subworkflows_lint_snapshot_file(self): """Test linting a subworkflow with a snapshot file""" - Path(self.nfcore_modules, "subworkflows", "nf-core", "test_subworkflow", "tests", "main.nf.test.snap").touch() subworkflow_lint = nf_core.subworkflows.SubworkflowLint(dir=self.nfcore_modules) subworkflow_lint.lint(print_results=False, subworkflow="test_subworkflow") assert len(subworkflow_lint.failed) == 0, f"Linting failed with {[x.__dict__ for x in subworkflow_lint.failed]}" @@ -78,8 +76,10 @@ def test_subworkflows_lint_snapshot_file(self): def test_subworkflows_lint_snapshot_file_missing_fail(self): """Test linting a subworkflow with a snapshot file missing, which should fail""" + Path(self.nfcore_modules, "subworkflows", "nf-core", "test_subworkflow", "tests", "main.nf.test.snap").unlink() subworkflow_lint = nf_core.subworkflows.SubworkflowLint(dir=self.nfcore_modules) subworkflow_lint.lint(print_results=False, subworkflow="test_subworkflow") + Path(self.nfcore_modules, "subworkflows", "nf-core", "test_subworkflow", "tests", "main.nf.test.snap").touch() assert len(subworkflow_lint.failed) == 1, f"Linting failed with {[x.__dict__ for x in subworkflow_lint.failed]}" assert len(subworkflow_lint.passed) > 0 assert len(subworkflow_lint.warned) >= 0 @@ -96,8 +96,11 @@ def test_subworkflows_lint_snapshot_file_not_needed(self): Path(self.nfcore_modules, "subworkflows", "nf-core", "test_subworkflow", "tests", "main.nf.test"), "w" ) as fh: fh.write(new_content) + + Path(self.nfcore_modules, "subworkflows", "nf-core", "test_subworkflow", "tests", "main.nf.test.snap").unlink() subworkflow_lint = nf_core.subworkflows.SubworkflowLint(dir=self.nfcore_modules) subworkflow_lint.lint(print_results=False, subworkflow="test_subworkflow") + Path(self.nfcore_modules, "subworkflows", "nf-core", "test_subworkflow", "tests", "main.nf.test.snap").touch() assert len(subworkflow_lint.failed) == 0, f"Linting failed with {[x.__dict__ for x in subworkflow_lint.failed]}" assert len(subworkflow_lint.passed) > 0 assert len(subworkflow_lint.warned) >= 0 diff --git a/tests/test_subworkflows.py b/tests/test_subworkflows.py index 33cad81e3..a4ab959fb 100644 --- a/tests/test_subworkflows.py +++ b/tests/test_subworkflows.py @@ -4,6 +4,7 @@ import os import shutil import unittest +from pathlib import Path import nf_core.create import nf_core.modules @@ -21,22 +22,18 @@ def create_modules_repo_dummy(tmp_dir): """Create a dummy copy of the nf-core/modules repo""" - root_dir = os.path.join(tmp_dir, "modules") - os.makedirs(os.path.join(root_dir, "modules")) - os.makedirs(os.path.join(root_dir, "subworkflows")) - os.makedirs(os.path.join(root_dir, "subworkflows", "nf-core")) - os.makedirs(os.path.join(root_dir, "tests", "modules")) - os.makedirs(os.path.join(root_dir, "tests", "subworkflows")) - os.makedirs(os.path.join(root_dir, "tests", "config")) - with open(os.path.join(root_dir, "tests", "config", "pytest_modules.yml"), "w") as fh: - fh.writelines(["test:", "\n - modules/test/**", "\n - tests/modules/test/**"]) - with open(os.path.join(root_dir, ".nf-core.yml"), "w") as fh: + root_dir = Path(tmp_dir, "modules") + Path(root_dir, "modules").mkdir(parents=True, exist_ok=True) + Path(root_dir, "subworkflows").mkdir(parents=True, exist_ok=True) + Path(root_dir, "subworkflows", "nf-core").mkdir(parents=True, exist_ok=True) + Path(root_dir, "tests", "config").mkdir(parents=True, exist_ok=True) + with open(Path(root_dir, ".nf-core.yml"), "w") as fh: fh.writelines(["repository_type: modules", "\n", "org_path: nf-core", "\n"]) - # TODO Add a mock here subworkflow_create = nf_core.subworkflows.SubworkflowCreate(root_dir, "test_subworkflow", "@author", True) subworkflow_create.create() + Path(root_dir, "subworkflows", "nf-core", "test_subworkflow", "tests", "main.nf.test.snap").touch() return root_dir From c6ff441dca15da1162d2018ea063dc76d4073dc5 Mon Sep 17 00:00:00 2001 From: mashehu Date: Wed, 29 Nov 2023 16:13:04 +0100 Subject: [PATCH 23/29] try once more on self hosted --- .github/workflows/pytest.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 2557c4fa4..573c1364b 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -58,7 +58,7 @@ jobs: name: Test with Python ${{ needs.setup.outputs.python-version }} on ${{ needs.setup.outputs.runner }} needs: setup if: ${{ needs.setup.outputs.run-tests == 'true' }} - runs-on: ${{ needs.setup.outputs.runner }} + runs-on: ["self-hosted"] steps: - uses: actions/checkout@v2 name: Check out source-code repository @@ -80,7 +80,7 @@ jobs: sudo apt update sudo apt remove git git-man sudo add-apt-repository --remove ppa:git-core/ppa - sudo apt install git + sudo apt install -y git - name: Get current date id: date run: echo "date=$(date +'%Y-%m')" >> $GITHUB_ENV From ffba25fa46cda05931e72f0a6cfcabe9a131f099 Mon Sep 17 00:00:00 2001 From: mashehu Date: Wed, 29 Nov 2023 16:22:32 +0100 Subject: [PATCH 24/29] run even more things on aws --- .github/workflows/lint-code.yml | 10 +++++----- .github/workflows/pytest.yml | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/lint-code.yml b/.github/workflows/lint-code.yml index baaaedcb4..b348496c3 100644 --- a/.github/workflows/lint-code.yml +++ b/.github/workflows/lint-code.yml @@ -14,7 +14,7 @@ concurrency: jobs: EditorConfig: - runs-on: ubuntu-latest + runs-on: ["self-hosted"] steps: - uses: actions/checkout@v4 @@ -28,7 +28,7 @@ jobs: run: editorconfig-checker -exclude README.md $(git ls-files | grep -v 'test\|.py\|md\|json\|yml\|yaml\|html\|css\|Makefile') Prettier: - runs-on: ubuntu-latest + runs-on: ["self-hosted"] steps: - uses: actions/checkout@v4 @@ -41,7 +41,7 @@ jobs: run: prettier --check ${GITHUB_WORKSPACE} PythonBlack: - runs-on: ubuntu-latest + runs-on: ["self-hosted"] steps: - uses: actions/checkout@v4 @@ -71,7 +71,7 @@ jobs: allow-repeats: false isort: - runs-on: ubuntu-latest + runs-on: ["self-hosted"] steps: - name: Check out source-code repository uses: actions/checkout@v4 @@ -87,7 +87,7 @@ jobs: requirementsFiles: "requirements.txt requirements-dev.txt" static-type-check: - runs-on: ubuntu-latest + runs-on: ["self-hosted"] steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v4 diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 573c1364b..4f370bc28 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -25,7 +25,7 @@ env: jobs: setup: - runs-on: ${{ matrix.runner }} + runs-on: ["self-hosted"] strategy: matrix: python-version: ["3.8", "3.12"] From d64c3b9aa5e1a6523f5e2c5ea137723a6355d36d Mon Sep 17 00:00:00 2001 From: mashehu Date: Wed, 29 Nov 2023 16:26:11 +0100 Subject: [PATCH 25/29] fix node setup --- .github/workflows/lint-code.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/lint-code.yml b/.github/workflows/lint-code.yml index b348496c3..168fac653 100644 --- a/.github/workflows/lint-code.yml +++ b/.github/workflows/lint-code.yml @@ -19,6 +19,8 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 + with: + node-version: "20" - name: Install editorconfig-checker run: npm install -g editorconfig-checker @@ -33,6 +35,8 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 + with: + node-version: "20" - name: Install Prettier run: npm install -g prettier From 7f6bc73b7577547c28bc6041a8a0d11b4bcb651d Mon Sep 17 00:00:00 2001 From: mashehu Date: Wed, 29 Nov 2023 16:37:17 +0100 Subject: [PATCH 26/29] fix apt command --- .github/workflows/pytest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 4f370bc28..c6de90d93 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -78,7 +78,7 @@ jobs: if: ${{ needs.setup.outputs.runner == 'ubuntu-20.04' && needs.setup.outputs.python-version == '3.8' }} run: | sudo apt update - sudo apt remove git git-man + sudo apt remove -y git git-man sudo add-apt-repository --remove ppa:git-core/ppa sudo apt install -y git - name: Get current date From a84d064d2ade1412d8704d72879692d02d3a7dde Mon Sep 17 00:00:00 2001 From: mashehu Date: Wed, 29 Nov 2023 17:16:49 +0100 Subject: [PATCH 27/29] reset aws runner for nf-test related things, try it with other workflows --- .github/workflows/create-lint-wf.yml | 4 +++- .github/workflows/create-test-lint-wf-template.yml | 4 +++- .github/workflows/create-test-wf.yml | 2 +- .github/workflows/fix-linting.yml | 2 ++ .github/workflows/push_dockerhub_dev.yml | 2 +- .github/workflows/pytest.yml | 2 +- .github/workflows/tools-api-docs-dev.yml | 2 +- 7 files changed, 12 insertions(+), 6 deletions(-) diff --git a/.github/workflows/create-lint-wf.yml b/.github/workflows/create-lint-wf.yml index 51daec21b..a3941f3ce 100644 --- a/.github/workflows/create-lint-wf.yml +++ b/.github/workflows/create-lint-wf.yml @@ -17,7 +17,7 @@ env: jobs: MakeTestWorkflow: - runs-on: ubuntu-latest + runs-on: self-hosted env: NXF_ANSI_LOG: false strategy: @@ -49,6 +49,8 @@ jobs: # Install the Prettier linting tools - uses: actions/setup-node@v4 + with: + node-version: "20" - name: Install Prettier run: npm install -g prettier diff --git a/.github/workflows/create-test-lint-wf-template.yml b/.github/workflows/create-test-lint-wf-template.yml index f1c6c4d14..b14a0fac5 100644 --- a/.github/workflows/create-test-lint-wf-template.yml +++ b/.github/workflows/create-test-lint-wf-template.yml @@ -20,7 +20,7 @@ env: jobs: RunTestWorkflow: - runs-on: ubuntu-latest + runs-on: self-hosted env: NXF_ANSI_LOG: false strategy: @@ -53,6 +53,8 @@ jobs: # Install the Prettier linting tools - uses: actions/setup-node@v4 + with: + node-version: "20" - name: Install Prettier run: npm install -g prettier diff --git a/.github/workflows/create-test-wf.yml b/.github/workflows/create-test-wf.yml index 4f66adae6..7b6a868f9 100644 --- a/.github/workflows/create-test-wf.yml +++ b/.github/workflows/create-test-wf.yml @@ -17,7 +17,7 @@ env: jobs: RunTestWorkflow: - runs-on: ubuntu-latest + runs-on: self-hosted env: NXF_ANSI_LOG: false strategy: diff --git a/.github/workflows/fix-linting.yml b/.github/workflows/fix-linting.yml index a6cf14956..d84615120 100644 --- a/.github/workflows/fix-linting.yml +++ b/.github/workflows/fix-linting.yml @@ -25,6 +25,8 @@ jobs: GITHUB_TOKEN: ${{ secrets.nf_core_bot_auth_token }} - uses: actions/setup-node@v4 + with: + node-version: "20" - name: Install Prettier run: npm install -g prettier @prettier/plugin-php diff --git a/.github/workflows/push_dockerhub_dev.yml b/.github/workflows/push_dockerhub_dev.yml index 169a917d8..1230bfc9d 100644 --- a/.github/workflows/push_dockerhub_dev.yml +++ b/.github/workflows/push_dockerhub_dev.yml @@ -13,7 +13,7 @@ concurrency: jobs: push_dockerhub: name: Push new Docker image to Docker Hub (dev) - runs-on: ubuntu-latest + runs-on: self-hosted # Only run for the nf-core repo, for releases and merged PRs if: ${{ github.repository == 'nf-core/tools' }} env: diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index c6de90d93..0561be25e 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -58,7 +58,7 @@ jobs: name: Test with Python ${{ needs.setup.outputs.python-version }} on ${{ needs.setup.outputs.runner }} needs: setup if: ${{ needs.setup.outputs.run-tests == 'true' }} - runs-on: ["self-hosted"] + runs-on: ${{ needs.setup.outputs.runner }} steps: - uses: actions/checkout@v2 name: Check out source-code repository diff --git a/.github/workflows/tools-api-docs-dev.yml b/.github/workflows/tools-api-docs-dev.yml index 7de8913e0..f6106bd8b 100644 --- a/.github/workflows/tools-api-docs-dev.yml +++ b/.github/workflows/tools-api-docs-dev.yml @@ -20,7 +20,7 @@ concurrency: jobs: api-docs: name: Build & push Sphinx API docs - runs-on: ubuntu-latest + runs-on: self-hosted steps: - name: Check out source-code repository From 9599287f7fe67fab93e57dee4a4dc67c8a91eec0 Mon Sep 17 00:00:00 2001 From: mashehu Date: Wed, 29 Nov 2023 17:24:01 +0100 Subject: [PATCH 28/29] try fixing aws runs --- nf_core/pipeline-template/nextflow.config | 1 + 1 file changed, 1 insertion(+) diff --git a/nf_core/pipeline-template/nextflow.config b/nf_core/pipeline-template/nextflow.config index 6a6bee6a8..31917a3e3 100644 --- a/nf_core/pipeline-template/nextflow.config +++ b/nf_core/pipeline-template/nextflow.config @@ -121,6 +121,7 @@ profiles { shifter.enabled = false charliecloud.enabled = false apptainer.enabled = false + runOptions = '-u $(id -u):$(id -g)' } arm { docker.runOptions = '-u $(id -u):$(id -g) --platform=linux/amd64' From 88e8bce12ac8c967e0fc36e153388f6f772e0c47 Mon Sep 17 00:00:00 2001 From: mashehu Date: Wed, 29 Nov 2023 23:18:08 +0100 Subject: [PATCH 29/29] run on github runners --- .github/workflows/create-test-lint-wf-template.yml | 2 +- .github/workflows/create-test-wf.yml | 2 +- .github/workflows/pytest.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/create-test-lint-wf-template.yml b/.github/workflows/create-test-lint-wf-template.yml index b14a0fac5..4be309862 100644 --- a/.github/workflows/create-test-lint-wf-template.yml +++ b/.github/workflows/create-test-lint-wf-template.yml @@ -20,7 +20,7 @@ env: jobs: RunTestWorkflow: - runs-on: self-hosted + runs-on: ubuntu-latest env: NXF_ANSI_LOG: false strategy: diff --git a/.github/workflows/create-test-wf.yml b/.github/workflows/create-test-wf.yml index 7b6a868f9..4f66adae6 100644 --- a/.github/workflows/create-test-wf.yml +++ b/.github/workflows/create-test-wf.yml @@ -17,7 +17,7 @@ env: jobs: RunTestWorkflow: - runs-on: self-hosted + runs-on: ubuntu-latest env: NXF_ANSI_LOG: false strategy: diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 0561be25e..9f8172a3b 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -25,7 +25,7 @@ env: jobs: setup: - runs-on: ["self-hosted"] + runs-on: ["ubuntu-latest"] strategy: matrix: python-version: ["3.8", "3.12"]