Skip to content

Commit

Permalink
Merge branch 'dev' into remove-channel-operations-from-oncomplete
Browse files Browse the repository at this point in the history
  • Loading branch information
mirpedrol authored Dec 9, 2024
2 parents f22d7d9 + b14b504 commit 9f4036c
Show file tree
Hide file tree
Showing 31 changed files with 99 additions and 85 deletions.
1 change: 0 additions & 1 deletion .github/actions/create-lint-wf/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ runs:
cd create-lint-wf
export NXF_WORK=$(pwd)
# Set up Nextflow
- name: Install Nextflow
uses: nf-core/setup-nextflow@v2
with:
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/create-lint-wf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,12 @@ concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

env:
NXF_ANSI_LOG: false

jobs:
MakeTestWorkflow:
runs-on: ${{ github.event.inputs.runners || github.run_number > 1 && 'ubuntu-latest' || 'self-hosted' }}
env:
NXF_ANSI_LOG: false

strategy:
matrix:
NXF_VER:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/create-test-lint-wf-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ jobs:
needs: prepare-matrix
env:
NXF_ANSI_LOG: false

strategy:
matrix:
TEMPLATE: ${{ fromJson(needs.prepare-matrix.outputs.all_features) }}
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/create-test-wf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,13 @@ concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

env:
NXF_ANSI_LOG: false

jobs:
RunTestWorkflow:
# use the runner given by the input if it is dispatched manually, run on github if it is a rerun or on self-hosted by default
runs-on: ${{ github.event.inputs.runners || github.run_number > 1 && 'ubuntu-latest' || 'self-hosted' }}
env:
NXF_ANSI_LOG: false

strategy:
matrix:
NXF_VER:
Expand Down
9 changes: 1 addition & 8 deletions .gitpod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,4 @@ tasks:
vscode:
extensions:
- esbenp.prettier-vscode # Markdown/CommonMark linting and style checking for Visual Studio Code
- EditorConfig.EditorConfig # override user/workspace settings with settings found in .editorconfig files
- Gruntfuggly.todo-tree # Display TODO and FIXME in a tree view in the activity bar
- mechatroner.rainbow-csv # Highlight columns in csv files in different colors
- nextflow.nextflow # Nextflow syntax highlighting
- oderwat.indent-rainbow # Highlight indentation level
- streetsidesoftware.code-spell-checker # Spelling checker for source code
- charliermarsh.ruff # Code linter Ruff
- nf-core.nf-core-extensionpack # https://github.com/nf-core/vscode-extensionpack
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.1
rev: v0.8.2
hooks:
- id: ruff # linter
args: [--fix, --exit-non-zero-on-fix] # sort imports and fix
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
### Linting

- allow mixed `str` and `dict` entries in lint config ([#3228](https://github.com/nf-core/tools/pull/3228))
- fix meta_yml linting test failing due to module.process_name always being "" ([#3317](https://github.com/nf-core/tools/pull/3317))
- fix module section regex matching wrong things ([#3321](https://github.com/nf-core/tools/pull/3321))

### Modules

Expand All @@ -33,6 +35,7 @@
### Subworkflows

- Add `nf-core subworkflows patch` command ([#2861](https://github.com/nf-core/tools/pull/2861))
- Improve subworkflow nf-test migration warning ([#3298](https://github.com/nf-core/tools/pull/3298))

### General

Expand All @@ -56,6 +59,9 @@
- Update pre-commit hook astral-sh/ruff-pre-commit to v0.8.0 ([#3299](https://github.com/nf-core/tools/pull/3299))
- Update gitpod/workspace-base Docker digest to 12853f7 ([#3309](https://github.com/nf-core/tools/pull/3309))
- Run pre-commit when testing linting the template pipeline ([#3280](https://github.com/nf-core/tools/pull/3280))
- Update pre-commit hook astral-sh/ruff-pre-commit to v0.8.2 ([#3325](https://github.com/nf-core/tools/pull/3325))
- Make CLI prompt less nf-core specific ([#3326](https://github.com/nf-core/tools/pull/3326))
- Update gitpod vscode extensions to use nf-core extension pack ([#3327](https://github.com/nf-core/tools/pull/3327))
- Remove toList() channel operation from inside onComplete block ([#3304](https://github.com/nf-core/tools/pull/3304))

## [v3.0.2 - Titanium Tapir Patch](https://github.com/nf-core/tools/releases/tag/3.0.2) - [2024-10-11]
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.12-slim@sha256:2a6386ad2db20e7f55073f69a98d6da2cf9f168e05e7487d2670baeb9b7601c5
FROM python:3.12-slim@sha256:2b0079146a74e23bf4ae8f6a28e1b484c6292f6fb904cbb51825b4a19812fcd8
LABEL authors="phil.ewels@seqera.io,erik.danielsson@scilifelab.se" \
description="Docker image containing requirements for nf-core/tools"

Expand Down
4 changes: 2 additions & 2 deletions nf_core/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ def command_pipelines_create(ctx, name, description, author, version, force, out
@click.option(
"--release",
is_flag=True,
default=os.path.basename(os.path.dirname(os.environ.get("GITHUB_REF", "").strip(" '\""))) == "master"
default=Path(os.environ.get("GITHUB_REF", "").strip(" '\"")).parent.name in ["master", "main"]
and os.environ.get("GITHUB_REPOSITORY", "").startswith("nf-core/")
and not os.environ.get("GITHUB_REPOSITORY", "") == "nf-core/tools",
help="Execute additional checks for release-ready workflows.",
Expand Down Expand Up @@ -2240,7 +2240,7 @@ def command_download(
@click.option(
"--release",
is_flag=True,
default=os.path.basename(os.path.dirname(os.environ.get("GITHUB_REF", "").strip(" '\""))) == "master"
default=Path(os.environ.get("GITHUB_REF", "").strip(" '\"")).parent.name in ["master", "main"]
and os.environ.get("GITHUB_REPOSITORY", "").startswith("nf-core/")
and not os.environ.get("GITHUB_REPOSITORY", "") == "nf-core/tools",
help="Execute additional checks for release-ready workflows.",
Expand Down
4 changes: 2 additions & 2 deletions nf_core/components/components_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ def get_repo_info(directory: Path, use_prompt: Optional[bool] = True) -> Tuple[P
if not repo_type and use_prompt:
log.warning("'repository_type' not defined in %s", config_fn.name)
repo_type = questionary.select(
"Is this repository an nf-core pipeline or a fork of nf-core/modules?",
"Is this repository a pipeline or a modules repository?",
choices=[
{"name": "Pipeline", "value": "pipeline"},
{"name": "nf-core/modules", "value": "modules"},
{"name": "Modules repository", "value": "modules"},
],
style=nf_core.utils.nfcore_question_style,
).unsafe_ask()
Expand Down
10 changes: 9 additions & 1 deletion nf_core/components/nfcore_component.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ def __init__(
# Initialize the important files
self.main_nf: Path = Path(self.component_dir, "main.nf")
self.meta_yml: Optional[Path] = Path(self.component_dir, "meta.yml")
self.process_name = ""
self.environment_yml: Optional[Path] = Path(self.component_dir, "environment.yml")

component_list = self.component_name.split("/")
Expand Down Expand Up @@ -96,6 +95,8 @@ def __init__(
self.test_yml = None
self.test_main_nf = None

self.process_name: str = self._get_process_name()

def __repr__(self) -> str:
return f"<NFCoreComponent {self.component_name} {self.component_dir} {self.repo_url}>"

Expand Down Expand Up @@ -169,6 +170,13 @@ def _get_included_components_in_chained_tests(self, main_nf_test: Union[Path, st
included_components.append(component)
return included_components

def _get_process_name(self):
with open(self.main_nf) as fh:
for line in fh:
if re.search(r"^\s*process\s*\w*\s*{", line):
return re.search(r"^\s*process\s*(\w*)\s*{.*", line).group(1) or ""
return ""

def get_inputs_from_main_nf(self) -> None:
"""Collect all inputs from the main.nf file."""
inputs: Any = [] # Can be 'list[list[dict[str, dict[str, str]]]]' or 'list[str]'
Expand Down
11 changes: 5 additions & 6 deletions nf_core/modules/lint/main_nf.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,19 +96,19 @@ def main_nf(
for line in iter_lines:
if re.search(r"^\s*process\s*\w*\s*{", line) and state == "module":
state = "process"
if re.search(r"input\s*:", line) and state in ["process"]:
if re.search(r"^\s*input\s*:", line) and state in ["process"]:
state = "input"
continue
if re.search(r"output\s*:", line) and state in ["input", "process"]:
if re.search(r"^\s*output\s*:", line) and state in ["input", "process"]:
state = "output"
continue
if re.search(r"when\s*:", line) and state in ["input", "output", "process"]:
if re.search(r"^\s*when\s*:", line) and state in ["input", "output", "process"]:
state = "when"
continue
if re.search(r"script\s*:", line) and state in ["input", "output", "when", "process"]:
if re.search(r"^\s*script\s*:", line) and state in ["input", "output", "when", "process"]:
state = "script"
continue
if re.search(r"shell\s*:", line) and state in ["input", "output", "when", "process"]:
if re.search(r"^\s*shell\s*:", line) and state in ["input", "output", "when", "process"]:
state = "shell"
continue

Expand Down Expand Up @@ -256,7 +256,6 @@ def check_process_section(self, lines, registry, fix_version, progress_bar):
bioconda_packages = []

# Process name should be all capital letters
self.process_name = lines[0].split()[1]
if all(x.upper() for x in self.process_name):
self.passed.append(("process_capitals", "Process name is in capital letters", self.main_nf))
else:
Expand Down
4 changes: 2 additions & 2 deletions nf_core/pipeline-template/.github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ These tests are run both with the latest available version of `Nextflow` and als

:warning: Only in the unlikely and regretful event of a release happening with a bug.

- On your own fork, make a new branch `patch` based on `upstream/master`.
- On your own fork, make a new branch `patch` based on `upstream/main` or `upstream/master`.
- Fix the bug, and bump version (X.Y.Z+1).
- Open a pull-request from `patch` to `master` with the changes.
- Open a pull-request from `patch` to `main`/`master` with the changes.

{% if is_nfcore -%}

Expand Down
4 changes: 2 additions & 2 deletions nf_core/pipeline-template/.github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ These are the most common things requested on pull requests (PRs).
Remember that PRs should be made against the dev branch, unless you're preparing a pipeline release.
Learn more about contributing: [CONTRIBUTING.md](https://github.com/{{ name }}/tree/master/.github/CONTRIBUTING.md)
Learn more about contributing: [CONTRIBUTING.md](https://github.com/{{ name }}/tree/{{ default_branch }}/.github/CONTRIBUTING.md)
-->

## PR checklist

- [ ] This comment contains a description of changes (with reason).
- [ ] If you've fixed a bug or added code that should be tested, add tests!
- [ ] If you've added a new tool - have you followed the pipeline conventions in the [contribution docs](https://github.com/{{ name }}/tree/master/.github/CONTRIBUTING.md)
- [ ] If you've added a new tool - have you followed the pipeline conventions in the [contribution docs](https://github.com/{{ name }}/tree/{{ default_branch }}/.github/CONTRIBUTING.md)
{%- if is_nfcore %}
- [ ] If necessary, also make a PR on the {{ name }} _branch_ on the [nf-core/test-datasets](https://github.com/nf-core/test-datasets) repository.
{%- endif %}
Expand Down
3 changes: 2 additions & 1 deletion nf_core/pipeline-template/.github/workflows/awsfulltest.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
name: nf-core AWS full size tests
# This workflow is triggered on PRs opened against the master branch.
# This workflow is triggered on PRs opened against the main/master branch.
# It can be additionally triggered manually with GitHub actions workflow dispatch button.
# It runs the -profile 'test_full' on AWS batch

on:
pull_request:
branches:
- main
- master
workflow_dispatch:
pull_request_review:
Expand Down
18 changes: 10 additions & 8 deletions nf_core/pipeline-template/.github/workflows/branch.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
name: nf-core branch protection
# This workflow is triggered on PRs to master branch on the repository
# It fails when someone tries to make a PR against the nf-core `master` branch instead of `dev`
# This workflow is triggered on PRs to `main`/`master` branch on the repository
# It fails when someone tries to make a PR against the nf-core `main`/`master` branch instead of `dev`
on:
pull_request_target:
branches: [master]
branches:
- main
- master

jobs:
test:
runs-on: ubuntu-latest
steps:
# PRs to the nf-core repo master branch are only ok if coming from the nf-core repo `dev` or any `patch` branches
# PRs to the nf-core repo main/master branch are only ok if coming from the nf-core repo `dev` or any `patch` branches
- name: Check PRs
if: github.repository == '{{ name }}'
run: |
Expand All @@ -22,7 +24,7 @@ jobs:
uses: mshick/add-pr-comment@b8f338c590a895d50bcbfa6c5859251edc8952fc # v2
with:
message: |
## This PR is against the `master` branch :x:
## This PR is against the `${{github.event.pull_request.base.ref}}` branch :x:
* Do not close this PR
* Click _Edit_ and change the `base` to `dev`
Expand All @@ -32,9 +34,9 @@ jobs:
Hi @${{ github.event.pull_request.user.login }},
It looks like this pull-request is has been made against the [${{github.event.pull_request.head.repo.full_name }}](https://github.com/${{github.event.pull_request.head.repo.full_name }}) `master` branch.
The `master` branch on nf-core repositories should always contain code from the latest release.
Because of this, PRs to `master` are only allowed if they come from the [${{github.event.pull_request.head.repo.full_name }}](https://github.com/${{github.event.pull_request.head.repo.full_name }}) `dev` branch.
It looks like this pull-request is has been made against the [${{github.event.pull_request.head.repo.full_name }}](https://github.com/${{github.event.pull_request.head.repo.full_name }}) ${{github.event.pull_request.base.ref}} branch.
The ${{github.event.pull_request.base.ref}} branch on nf-core repositories should always contain code from the latest release.
Because of this, PRs to ${{github.event.pull_request.base.ref}} are only allowed if they come from the [${{github.event.pull_request.head.repo.full_name }}](https://github.com/${{github.event.pull_request.head.repo.full_name }}) `dev` branch.
You do not need to close this PR, you can change the target branch to `dev` by clicking the _"Edit"_ button at the top of this page.
Note that even after this, the test will continue to show as failing until you push a new commit.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Test successful pipeline download with 'nf-core pipelines download'

# Run the workflow when:
# - dispatched manually
# - when a PR is opened or reopened to master branch
# - when a PR is opened or reopened to main/master branch
# - the head branch of the pull request is updated, i.e. if fixes for a release are pushed last minute to dev.
on:
workflow_dispatch:
Expand All @@ -17,9 +17,11 @@ on:
- edited
- synchronize
branches:
- main
- master
pull_request_target:
branches:
- main
- master

env:
Expand Down
11 changes: 2 additions & 9 deletions nf_core/pipeline-template/.gitpod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,6 @@ tasks:
nextflow self-update
vscode:
extensions: # based on nf-core.nf-core-extensionpack
extensions:
#{%- if code_linters -%}
- esbenp.prettier-vscode # Markdown/CommonMark linting and style checking for Visual Studio Code
- EditorConfig.EditorConfig # override user/workspace settings with settings found in .editorconfig files{% endif %}
- Gruntfuggly.todo-tree # Display TODO and FIXME in a tree view in the activity bar
- mechatroner.rainbow-csv # Highlight columns in csv files in different colors
- nextflow.nextflow # Nextflow syntax highlighting
- oderwat.indent-rainbow # Highlight indentation level
- streetsidesoftware.code-spell-checker # Spelling checker for source code
- charliermarsh.ruff # Code linter Ruff
- nf-core.nf-core-extensionpack # https://github.com/nf-core/vscode-extensionpack
2 changes: 1 addition & 1 deletion nf_core/pipeline-template/assets/schema_input.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://raw.githubusercontent.com/{{ name }}/master/assets/schema_input.json",
"$id": "https://raw.githubusercontent.com/{{ name }}/{{ default_branch }}/assets/schema_input.json",
"title": "{{ name }} pipeline - params.input schema",
"description": "Schema for the file provided with params.input",
"type": "array",
Expand Down
1 change: 1 addition & 0 deletions nf_core/pipeline-template/nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ manifest {
homePage = 'https://github.com/{{ name }}'
description = """{{ description }}"""
mainScript = 'main.nf'
defaultBranch = '{{ default_branch }}'
nextflowVersion = '!>=24.04.2'
version = '{{ version }}'
doi = ''
Expand Down
2 changes: 1 addition & 1 deletion nf_core/pipeline-template/nextflow_schema.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://raw.githubusercontent.com/{{ name }}/master/nextflow_schema.json",
"$id": "https://raw.githubusercontent.com/{{ name }}/{{ default_branch }}/nextflow_schema.json",
"title": "{{ name }} pipeline parameters",
"description": "{{ description }}",
"type": "object",
Expand Down
Loading

0 comments on commit 9f4036c

Please sign in to comment.