Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Template: add option to exclude codespaces from pipeline template #3105

Merged
merged 5 commits into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions .github/workflows/create-test-lint-wf-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ jobs:
- "template_skip_code_linters.yml"
- "template_skip_citations.yml"
- "template_skip_gitpod.yml"
- "template_skip_codespaces.yml"
runner:
# 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
- ${{ github.event.inputs.runners || github.run_number > 1 && 'ubuntu-latest' || 'self-hosted' }}
Expand Down Expand Up @@ -117,11 +118,9 @@ jobs:
run: |
printf "org: my-prefix\nskip: gitpod" > create-test-lint-wf/template_skip_gitpod.yml

# Create a pipeline from the template
- name: create a pipeline from the template ${{ matrix.TEMPLATE }}
- name: Create template skip codespaces
run: |
cd create-test-lint-wf
nf-core --log-file log.txt pipelines create -n testpipeline -d "This pipeline is for testing" -a "Testing McTestface" --template-yaml ${{ matrix.TEMPLATE }}
printf "org: my-prefix\nskip: codespaces" > create-test-lint-wf/template_skip_codespaces.yml

- name: run the pipeline
run: |
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- add option to exclude code linters for custom pipeline template ([#3084](https://github.com/nf-core/tools/pull/3084))
- add option to exclude citations for custom pipeline template ([#3101](https://github.com/nf-core/tools/pull/3101))
- add option to exclude gitpod for custom pipeline template ([#3100](https://github.com/nf-core/tools/pull/3100))
- add option to exclude codespaces from pipeline template ([#3105](https://github.com/nf-core/tools/pull/3105))

### Linting

Expand Down
2 changes: 2 additions & 0 deletions nf_core/pipeline-template/.github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ If you are using a new feature from core Nextflow, you may bump the minimum requ
### Images and figures

For overview images and other documents we follow the nf-core [style guidelines and examples](https://nf-co.re/developers/design_guidelines).
{%- if codespaces %}

## GitHub Codespaces

Expand All @@ -131,3 +132,4 @@ To get started:
Devcontainer specs:

- [DevContainer config](.devcontainer/devcontainer.json)
{% endif %}
6 changes: 6 additions & 0 deletions nf_core/pipelines/create/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ def __init__(
],
"citations": ["assets/methods_description_template.yml"],
"gitpod": [".gitpod.yml"],
"codespaces": [".devcontainer/devcontainer.json"],
}
# Get list of files we're skipping with the supplied skip keys
self.skip_paths = set(sp for k in skip_paths for sp in skippable_paths[k])
Expand Down Expand Up @@ -214,6 +215,7 @@ def obtain_jinja_params_dict(self, features_to_skip, pipeline_dir):
"code_linters": {"file": True, "content": True},
"citations": {"file": True, "content": True},
"gitpod": {"file": True, "content": True},
"codespaces": {"file": True, "content": True},
}

# Set the parameters for the jinja template
Expand Down Expand Up @@ -509,6 +511,10 @@ def fix_linting(self):
if not self.jinja_params["github_badges"] or not self.jinja_params["github"]:
lint_config["readme"] = ["nextflow_badge"]

# Add codespaces specific configurations
if not self.jinja_params["codespaces"]:
lint_config["files_unchanged"].extend([".github/CONTRIBUTING.md"])

# If the pipeline is not nf-core
if not self.config.is_nfcore:
lint_config["files_unchanged"].extend([".github/ISSUE_TEMPLATE/bug_report.yml"])
Expand Down
13 changes: 13 additions & 0 deletions nf_core/pipelines/create/custompipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,13 @@
This is useful to have all the tools ready for pipeline development.
"""

markdown_codespaces = """
The pipeline will include a devcontainer configuration.
The devcontainer will create a GitHub Codespaces for Nextflow development with nf-core/tools and Nextflow installed.

Github Codespaces (https://github.com/features/codespaces) is an online developer environment that runs in your browser, complete with VSCode and a terminal.
"""


class CustomPipeline(Screen):
"""Select if the pipeline will use genomic data."""
Expand Down Expand Up @@ -122,6 +129,12 @@ def compose(self) -> ComposeResult:
"Include the configuration required to use Gitpod.",
"gitpod",
),
PipelineFeature(
markdown_codespaces,
"Include GitHub Codespaces",
"The pipeline will include a devcontainer configuration for GitHub Codespaces, providing a development environment with nf-core/tools and Nextflow installed.",
"codespaces",
),
classes="features-container",
)
yield Center(
Expand Down
1 change: 1 addition & 0 deletions tests/data/pipeline_create_template_skip.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ skip_features:
- code_linters
- citations
- gitpod
- codespaces
Loading