From da7636a3e44ead54ffacce02f20dd175cc06121a Mon Sep 17 00:00:00 2001 From: mashehu Date: Wed, 29 Nov 2023 13:25:03 +0100 Subject: [PATCH 1/9] 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 2/9] 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 3/9] 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 4/9] 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 5/9] 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 6/9] 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 7/9] 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 8/9] 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 9/9] 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"]