From d426153aaa4b51df8f32797098e5966a416452fe Mon Sep 17 00:00:00 2001 From: mashehu Date: Fri, 4 Nov 2022 10:31:03 +0100 Subject: [PATCH 1/7] fix deprecation warnings for python and github actions --- .github/workflows/create-lint-wf.yml | 2 +- .github/workflows/create-test-wf.yml | 2 +- .github/workflows/sync.yml | 4 ++-- nf_core/create.py | 4 ++-- nf_core/pipeline-template/.github/workflows/fix-linting.yml | 4 ++-- nf_core/pipeline-template/.github/workflows/linting.yml | 2 +- .../pipeline-template/.github/workflows/linting_comment.yml | 2 +- requirements.txt | 1 + 8 files changed, 11 insertions(+), 10 deletions(-) diff --git a/.github/workflows/create-lint-wf.yml b/.github/workflows/create-lint-wf.yml index 97adc7ac71..d6a835ad0b 100644 --- a/.github/workflows/create-lint-wf.yml +++ b/.github/workflows/create-lint-wf.yml @@ -121,7 +121,7 @@ jobs: - name: Upload log file artifact if: ${{ always() }} - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: nf-core-log-file path: log.txt diff --git a/.github/workflows/create-test-wf.yml b/.github/workflows/create-test-wf.yml index 603403b505..b4b12621ce 100644 --- a/.github/workflows/create-test-wf.yml +++ b/.github/workflows/create-test-wf.yml @@ -51,7 +51,7 @@ jobs: - name: Upload log file artifact if: ${{ always() }} - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: nf-core-log-file path: log.txt diff --git a/.github/workflows/sync.yml b/.github/workflows/sync.yml index c95ef5e910..94bc133f4c 100644 --- a/.github/workflows/sync.yml +++ b/.github/workflows/sync.yml @@ -27,7 +27,7 @@ jobs: else curl -O https://nf-co.re/pipeline_names.json fi - echo "::set-output name=matrix::$(cat pipeline_names.json)" + echo "name=matrix::$(cat pipeline_names.json)" >> $GITHUB_OUTPUT sync: needs: get-pipelines @@ -78,7 +78,7 @@ jobs: - name: Upload sync log file artifact if: ${{ always() }} - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: sync_log_${{ matrix.pipeline }} path: sync_log_${{ matrix.pipeline }}.txt diff --git a/nf_core/create.py b/nf_core/create.py index feb0e25cbb..ca06bd9c36 100644 --- a/nf_core/create.py +++ b/nf_core/create.py @@ -3,7 +3,6 @@ organization's specification based on a template. """ import configparser -import imghdr import logging import os import random @@ -13,6 +12,7 @@ import time from pathlib import Path +import filetype import git import jinja2 import questionary @@ -492,7 +492,7 @@ def download_pipeline_logo(self, url, img_fn): with open(img_fn, "wb") as fh: fh.write(r.content) # Check that the file looks valid - image_type = imghdr.what(img_fn) + image_type = filetype.guess(img_fn).extension if image_type != "png": log.error(f"Logo from the website didn't look like an image: '{image_type}'") continue diff --git a/nf_core/pipeline-template/.github/workflows/fix-linting.yml b/nf_core/pipeline-template/.github/workflows/fix-linting.yml index 5ad82fe8f8..f136e67e80 100644 --- a/nf_core/pipeline-template/.github/workflows/fix-linting.yml +++ b/nf_core/pipeline-template/.github/workflows/fix-linting.yml @@ -34,9 +34,9 @@ jobs: id: prettier_status run: | if prettier --check ${GITHUB_WORKSPACE}; then - echo "::set-output name=result::pass" + echo "name=result::pass" >> $GITHUB_OUTPUT else - echo "::set-output name=result::fail" + echo "name=result::fail" >> $GITHUB_OUTPUT fi - name: Run 'prettier --write' diff --git a/nf_core/pipeline-template/.github/workflows/linting.yml b/nf_core/pipeline-template/.github/workflows/linting.yml index 8f9a4173bd..766fd36b8a 100644 --- a/nf_core/pipeline-template/.github/workflows/linting.yml +++ b/nf_core/pipeline-template/.github/workflows/linting.yml @@ -99,7 +99,7 @@ jobs: - name: Upload linting log file artifact if: ${{ always() }} - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: linting-logs path: | diff --git a/nf_core/pipeline-template/.github/workflows/linting_comment.yml b/nf_core/pipeline-template/.github/workflows/linting_comment.yml index 5b91eedce0..585b933f1c 100644 --- a/nf_core/pipeline-template/.github/workflows/linting_comment.yml +++ b/nf_core/pipeline-template/.github/workflows/linting_comment.yml @@ -18,7 +18,7 @@ jobs: - name: Get PR number id: pr_number - run: echo "::set-output name=pr_number::$(cat linting-logs/PR_number.txt)" + run: echo "name=pr_number::$(cat linting-logs/PR_number.txt)" >> $GITHUB_OUTPUT - name: Post PR comment uses: marocchino/sticky-pull-request-comment@v2 diff --git a/requirements.txt b/requirements.txt index 0a4a5fb7e7..c60791b0e5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,5 @@ click +filetype galaxy-tool-util GitPython jinja2 From 363c1a895ae6de095a67980f9cf2015041e89722 Mon Sep 17 00:00:00 2001 From: mashehu Date: Fri, 4 Nov 2022 10:50:49 +0100 Subject: [PATCH 2/7] update isort and setup-node actions --- .github/workflows/create-lint-wf.yml | 2 +- .github/workflows/fix-linting.yml | 4 ++-- .github/workflows/lint-code.yml | 6 +++--- nf_core/pipeline-template/.github/workflows/fix-linting.yml | 2 +- nf_core/pipeline-template/.github/workflows/linting.yml | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/create-lint-wf.yml b/.github/workflows/create-lint-wf.yml index d6a835ad0b..4dc87c0a14 100644 --- a/.github/workflows/create-lint-wf.yml +++ b/.github/workflows/create-lint-wf.yml @@ -48,7 +48,7 @@ jobs: version: ${{ matrix.NXF_VER }} # Install the Prettier linting tools - - uses: actions/setup-node@v2 + - uses: actions/setup-node@v3 - name: Install Prettier run: npm install -g prettier diff --git a/.github/workflows/fix-linting.yml b/.github/workflows/fix-linting.yml index 674463f675..947555fc45 100644 --- a/.github/workflows/fix-linting.yml +++ b/.github/workflows/fix-linting.yml @@ -24,7 +24,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.nf_core_bot_auth_token }} - - uses: actions/setup-node@v2 + - uses: actions/setup-node@v3 - name: Install Prettier run: npm install -g prettier @prettier/plugin-php @@ -43,7 +43,7 @@ jobs: with: python-version: 3.8 - name: python-isort - uses: isort/isort-action@v0.1.0 + uses: isort/isort-action@v1.0.0 with: isortVersion: "latest" requirementsFiles: "requirements.txt requirements-dev.txt" diff --git a/.github/workflows/lint-code.yml b/.github/workflows/lint-code.yml index a7cda448c4..2ca5286fd4 100644 --- a/.github/workflows/lint-code.yml +++ b/.github/workflows/lint-code.yml @@ -18,7 +18,7 @@ jobs: steps: - uses: actions/checkout@v3 - - uses: actions/setup-node@v2 + - uses: actions/setup-node@v3 - name: Install editorconfig-checker run: npm install -g editorconfig-checker @@ -32,7 +32,7 @@ jobs: steps: - uses: actions/checkout@v3 - - uses: actions/setup-node@v2 + - uses: actions/setup-node@v3 - name: Install Prettier run: npm install -g prettier @@ -81,7 +81,7 @@ jobs: with: python-version: 3.8 - name: python-isort - uses: isort/isort-action@v0.1.0 + uses: isort/isort-action@v1.0.0 with: isortVersion: "latest" requirementsFiles: "requirements.txt requirements-dev.txt" diff --git a/nf_core/pipeline-template/.github/workflows/fix-linting.yml b/nf_core/pipeline-template/.github/workflows/fix-linting.yml index f136e67e80..4c586a0929 100644 --- a/nf_core/pipeline-template/.github/workflows/fix-linting.yml +++ b/nf_core/pipeline-template/.github/workflows/fix-linting.yml @@ -24,7 +24,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.nf_core_bot_auth_token }} - - uses: actions/setup-node@v2 + - uses: actions/setup-node@v3 - 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 766fd36b8a..7e0a495789 100644 --- a/nf_core/pipeline-template/.github/workflows/linting.yml +++ b/nf_core/pipeline-template/.github/workflows/linting.yml @@ -16,7 +16,7 @@ jobs: steps: - uses: actions/checkout@v3 - - uses: actions/setup-node@v2 + - uses: actions/setup-node@v3 - name: Install editorconfig-checker run: npm install -g editorconfig-checker @@ -29,7 +29,7 @@ jobs: steps: - uses: actions/checkout@v3 - - uses: actions/setup-node@v2 + - uses: actions/setup-node@v3 - name: Install Prettier run: npm install -g prettier From ca63f067ef3dfbbd97e474e4e224c5d49075ab2e Mon Sep 17 00:00:00 2001 From: mashehu Date: Fri, 4 Nov 2022 10:59:33 +0100 Subject: [PATCH 3/7] upgrade setup-python --- .github/workflows/fix-linting.yml | 2 +- .github/workflows/lint-code.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/fix-linting.yml b/.github/workflows/fix-linting.yml index 947555fc45..30cf965af0 100644 --- a/.github/workflows/fix-linting.yml +++ b/.github/workflows/fix-linting.yml @@ -39,7 +39,7 @@ jobs: options: "--color" - name: Set up Python 3.8 - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: 3.8 - name: python-isort diff --git a/.github/workflows/lint-code.yml b/.github/workflows/lint-code.yml index 2ca5286fd4..89aa48462b 100644 --- a/.github/workflows/lint-code.yml +++ b/.github/workflows/lint-code.yml @@ -77,7 +77,7 @@ jobs: uses: actions/checkout@v3 - name: Set up Python 3.8 - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: 3.8 - name: python-isort From af0bf3d9396d269ff4c139bcd786f58f8a60c7f5 Mon Sep 17 00:00:00 2001 From: fabianegli Date: Sat, 5 Nov 2022 19:17:12 +0100 Subject: [PATCH 4/7] bump isort action version --- .github/workflows/lint-code.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint-code.yml b/.github/workflows/lint-code.yml index 89aa48462b..869d8898d9 100644 --- a/.github/workflows/lint-code.yml +++ b/.github/workflows/lint-code.yml @@ -81,7 +81,7 @@ jobs: with: python-version: 3.8 - name: python-isort - uses: isort/isort-action@v1.0.0 + uses: isort/isort-action@v1.1.0 with: isortVersion: "latest" requirementsFiles: "requirements.txt requirements-dev.txt" From bc5e6f7d6578849bb7dac3db0e15184822fa384e Mon Sep 17 00:00:00 2001 From: fabianegli Date: Sat, 5 Nov 2022 19:21:01 +0100 Subject: [PATCH 5/7] updated GitHub actions --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 25e3448581..9fd4e4d330 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -25,6 +25,7 @@ - Run tests with Python 3.11 ([#1970](https://github.com/nf-core/tools/pull/1970)) - Bump promoted Python version from 3.7 to 3.8 ([#1971](https://github.com/nf-core/tools/pull/1971)) - Fix incorrect file deletion in `nf-core launch` when `--params_in` has the same name as `--params_out` +- Updated GitHub actions ([#1998](https://github.com/nf-core/tools/pull/1998), [#2001](https://github.com/nf-core/tools/pull/2001)) ### Modules From dadb11c2a42a5011fb91716e5d10dfe43b00d65a Mon Sep 17 00:00:00 2001 From: mirpedrol Date: Tue, 8 Nov 2022 09:38:01 +0100 Subject: [PATCH 6/7] change installed by installed_by --- nf_core/components/components_install.py | 2 +- nf_core/modules/modules_json.py | 26 ++++++++++++------------ nf_core/pipeline-template/modules.json | 6 +++--- tests/modules/modules_json.py | 2 +- 4 files changed, 18 insertions(+), 18 deletions(-) diff --git a/nf_core/components/components_install.py b/nf_core/components/components_install.py index 7680134d14..5ad00695bc 100644 --- a/nf_core/components/components_install.py +++ b/nf_core/components/components_install.py @@ -100,4 +100,4 @@ def clean_modules_json(component, component_type, modules_repo, modules_json): f"Removing {component_type[:-1]} '{modules_repo.repo_path}/{component}' from repo '{repo_to_remove}' from modules.json" ) modules_json.remove_entry(component_type, component, repo_to_remove, modules_repo.repo_path) - return component_values["installed"] + return component_values["installed_by"] diff --git a/nf_core/modules/modules_json.py b/nf_core/modules/modules_json.py index eabaa51c73..d643057781 100644 --- a/nf_core/modules/modules_json.py +++ b/nf_core/modules/modules_json.py @@ -277,7 +277,7 @@ def determine_module_branches_and_shas(self, install_dir, remote_url, modules): repo_entry[module] = { "branch": modules_repo.branch, "git_sha": correct_commit_sha, - "installed": "modules", + "installed_by": "modules", } # Clean up the modules we were unable to find the sha for @@ -481,7 +481,7 @@ def check_up_to_date(self): If a module/subworkflow is installed but the entry in 'modules.json' is missing we iterate through the commit log in the remote to try to determine the SHA. - Check that we have the "installed" value in 'modules.json', otherwise add it. + Check that we have the "installed_by" value in 'modules.json', otherwise add it. Assume that the modules/subworkflows were installed by and nf-core command (don't track installed by subworkflows). """ try: @@ -517,13 +517,13 @@ def check_up_to_date(self): if len(subworkflows_missing_from_modules_json) > 0: self.resolve_missing_from_modules_json(subworkflows_missing_from_modules_json, "subworkflows") - # If the "installed" value is not present for modules/subworkflows, add it. + # If the "installed_by" value is not present for modules/subworkflows, add it. for repo, repo_content in self.modules_json["repos"].items(): for component_type, dir_content in repo_content.items(): for install_dir, installed_components in dir_content.items(): for component, component_features in installed_components.items(): - if "installed" not in component_features: - self.modules_json["repos"][repo][component_type][install_dir][component]["installed"] = [ + if "installed_by" not in component_features: + self.modules_json["repos"][repo][component_type][install_dir][component]["installed_by"] = [ component_type ] @@ -572,12 +572,12 @@ def update(self, modules_repo, module_name, module_version, installed_by, instal repo_modules_entry[module_name]["git_sha"] = module_version repo_modules_entry[module_name]["branch"] = branch try: - if installed_by not in repo_modules_entry[module_name]["installed"]: - repo_modules_entry[module_name]["installed"].append(installed_by) + if installed_by not in repo_modules_entry[module_name]["installed_by"]: + repo_modules_entry[module_name]["installed_by"].append(installed_by) except KeyError: - repo_modules_entry[module_name]["installed"] = [installed_by] + repo_modules_entry[module_name]["installed_by"] = [installed_by] finally: - repo_modules_entry[module_name]["installed"].extend(installed_by_log) + repo_modules_entry[module_name]["installed_by"].extend(installed_by_log) # Sort the 'modules.json' repo entries self.modules_json["repos"] = nf_core.utils.sort_dictionary(self.modules_json["repos"]) @@ -616,12 +616,12 @@ def update_subworkflow( repo_subworkflows_entry[subworkflow_name]["git_sha"] = subworkflow_version repo_subworkflows_entry[subworkflow_name]["branch"] = branch try: - if installed_by not in repo_subworkflows_entry[subworkflow_name]["installed"]: - repo_subworkflows_entry[subworkflow_name]["installed"].append(installed_by) + if installed_by not in repo_subworkflows_entry[subworkflow_name]["installed_by"]: + repo_subworkflows_entry[subworkflow_name]["installed_by"].append(installed_by) except KeyError: - repo_subworkflows_entry[subworkflow_name]["installed"] = [installed_by] + repo_subworkflows_entry[subworkflow_name]["installed_by"] = [installed_by] finally: - repo_subworkflows_entry[subworkflow_name]["installed"].extend(installed_by_log) + repo_subworkflows_entry[subworkflow_name]["installed_by"].extend(installed_by_log) # Sort the 'modules.json' repo entries self.modules_json["repos"] = nf_core.utils.sort_dictionary(self.modules_json["repos"]) diff --git a/nf_core/pipeline-template/modules.json b/nf_core/pipeline-template/modules.json index 6a1bf1f96a..8618bacab6 100644 --- a/nf_core/pipeline-template/modules.json +++ b/nf_core/pipeline-template/modules.json @@ -8,17 +8,17 @@ "custom/dumpsoftwareversions": { "branch": "master", "git_sha": "5e34754d42cd2d5d248ca8673c0a53cdf5624905", - "installed": ["modules"] + "installed_by": ["modules"] }, "fastqc": { "branch": "master", "git_sha": "5e34754d42cd2d5d248ca8673c0a53cdf5624905", - "installed": ["modules"] + "installed_by": ["modules"] }, "multiqc": { "branch": "master", "git_sha": "5e34754d42cd2d5d248ca8673c0a53cdf5624905", - "installed": ["modules"] + "installed_by": ["modules"] } } } diff --git a/tests/modules/modules_json.py b/tests/modules/modules_json.py index 3b6be3101f..20eee54e30 100644 --- a/tests/modules/modules_json.py +++ b/tests/modules/modules_json.py @@ -41,7 +41,7 @@ def test_mod_json_update(self): NF_CORE_MODULES_DEFAULT_BRANCH == mod_json["repos"][NF_CORE_MODULES_REMOTE]["modules"]["nf-core"]["MODULE_NAME"]["branch"] ) - assert "modules" in mod_json["repos"][NF_CORE_MODULES_REMOTE]["modules"]["nf-core"]["MODULE_NAME"]["installed"] + assert "modules" in mod_json["repos"][NF_CORE_MODULES_REMOTE]["modules"]["nf-core"]["MODULE_NAME"]["installed_by"] def test_mod_json_create(self): From a5073fa6b9fb5dcb17466e46d2aa2dd002cf7f24 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BAlia=20Mir=20Pedrol?= Date: Tue, 8 Nov 2022 10:22:17 +0100 Subject: [PATCH 7/7] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Matthias Hörtenhuber --- nf_core/modules/modules_json.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nf_core/modules/modules_json.py b/nf_core/modules/modules_json.py index d643057781..e2c45b935b 100644 --- a/nf_core/modules/modules_json.py +++ b/nf_core/modules/modules_json.py @@ -482,7 +482,7 @@ def check_up_to_date(self): the commit log in the remote to try to determine the SHA. Check that we have the "installed_by" value in 'modules.json', otherwise add it. - Assume that the modules/subworkflows were installed by and nf-core command (don't track installed by subworkflows). + Assume that the modules/subworkflows were installed by an nf-core command (don't track installed by subworkflows). """ try: self.load()