Skip to content

Commit 4415e90

Browse files
authored
Merge pull request nf-core#492 from nf-core/dev
Dev -> Master 3.0.0
2 parents d16f8f8 + b212815 commit 4415e90

File tree

182 files changed

+9154
-5241
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

182 files changed

+9154
-5241
lines changed

.github/CONTRIBUTING.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# nf-core/methylseq: Contributing Guidelines
1+
# `nf-core/methylseq`: Contributing Guidelines
22

33
Hi there!
44
Many thanks for taking an interest in improving nf-core/methylseq.
@@ -55,23 +55,23 @@ These tests are run both with the latest available version of `Nextflow` and als
5555

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

58-
- On your own fork, make a new branch `patch` based on `upstream/master`.
58+
- On your own fork, make a new branch `patch` based on `upstream/main` or `upstream/master`.
5959
- Fix the bug, and bump version (X.Y.Z+1).
60-
- A PR should be made on `master` from patch to directly this particular bug.
60+
- Open a pull-request from `patch` to `main`/`master` with the changes.
6161

6262
## Getting help
6363

6464
For further information/help, please consult the [nf-core/methylseq documentation](https://nf-co.re/methylseq/usage) and don't hesitate to get in touch on the nf-core Slack [#methylseq](https://nfcore.slack.com/channels/methylseq) channel ([join our Slack here](https://nf-co.re/join/slack)).
6565

6666
## Pipeline contribution conventions
6767

68-
To make the nf-core/methylseq code and processing logic more understandable for new contributors and to ensure quality, we semi-standardise the way the code and other contributions are written.
68+
To make the `nf-core/methylseq` code and processing logic more understandable for new contributors and to ensure quality, we semi-standardise the way the code and other contributions are written.
6969

7070
### Adding a new step
7171

7272
If you wish to contribute a new step, please use the following coding standards:
7373

74-
1. Define the corresponding input channel into your new process from the expected previous process channel
74+
1. Define the corresponding input channel into your new process from the expected previous process channel.
7575
2. Write the process block (see below).
7676
3. Define the output channel if needed (see below).
7777
4. Add any new parameters to `nextflow.config` with a default (see below).
@@ -84,7 +84,7 @@ If you wish to contribute a new step, please use the following coding standards:
8484

8585
### Default values
8686

87-
Parameters should be initialised / defined with default values in `nextflow.config` under the `params` scope.
87+
Parameters should be initialised / defined with default values within the `params` scope in `nextflow.config`.
8888

8989
Once there, use `nf-core pipelines schema build` to add to `nextflow_schema.json`.
9090

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: "Get number of shards"
2+
description: "Get the number of nf-test shards for the current CI job"
3+
inputs:
4+
tags:
5+
description: "Tags to pass as argument for nf-test --tag parameter"
6+
required: true
7+
max_shards:
8+
description: "Maximum number of shards allowed"
9+
required: true
10+
outputs:
11+
shard:
12+
description: "Array of shard numbers"
13+
value: ${{ steps.shards.outputs.shard }}
14+
total_shards:
15+
description: "Total number of shards"
16+
value: ${{ steps.shards.outputs.total_shards }}
17+
18+
runs:
19+
using: "composite"
20+
steps:
21+
- name: Install nf-test
22+
uses: nf-core/setup-nf-test@v1
23+
with:
24+
version: ${{ env.NFT_VER }}
25+
install-pdiff: true
26+
27+
- name: Get number of shards
28+
id: shards
29+
shell: bash
30+
run: |
31+
# Run nf-test to get the number of related tests
32+
nftest_output=$(nf-test test --dry-run --changed-since HEAD^ --filter pipeline --tag ${{ inputs.tags }})
33+
echo "nf-test dry-run output: $nftest_output"
34+
35+
# Default values for shard and total_shards
36+
shard="[]"
37+
total_shards=0
38+
39+
# Check if there are related tests
40+
if echo "$nftest_output" | grep -q 'Nothing to do'; then
41+
echo "No related tests found."
42+
else
43+
# Extract the number of related tests
44+
number_of_shards=$(echo "$nftest_output" | sed -n 's|.*Executed \([0-9]*\) tests.*|\1|p')
45+
if [[ -n "$number_of_shards" && "$number_of_shards" -gt 0 ]]; then
46+
shards_to_run=$(( $number_of_shards < ${{ inputs.max_shards }} ? $number_of_shards : ${{ inputs.max_shards }} ))
47+
shard=$(seq 1 "$shards_to_run" | jq -R . | jq -c -s .)
48+
total_shards="$shards_to_run"
49+
else
50+
echo "Unexpected output format. Falling back to default values."
51+
fi
52+
fi
53+
54+
# Write to GitHub Actions outputs
55+
echo "shard=$shard" >> $GITHUB_OUTPUT
56+
echo "total_shards=$total_shards" >> $GITHUB_OUTPUT
57+
58+
# Debugging output
59+
echo "Final shard array: $shard"
60+
echo "Total number of shards: $total_shards"

.github/actions/nf-test/action.yml

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: "nf-test Action"
2+
description: "Runs nf-test with common setup steps"
3+
inputs:
4+
profile:
5+
description: "Profile to use"
6+
required: true
7+
shard:
8+
description: "Shard number for this CI job"
9+
required: true
10+
total_shards:
11+
description: "Total number of test shards(NOT the total number of matrix jobs)"
12+
required: true
13+
filters:
14+
description: "Filter test cases by specified types (e.g., module, pipeline, workflow or function)"
15+
required: true
16+
tags:
17+
description: "Tags to pass as argument for nf-test --tag parameter"
18+
required: true
19+
20+
runs:
21+
using: "composite"
22+
steps:
23+
- uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4
24+
with:
25+
distribution: "temurin"
26+
java-version: "17"
27+
28+
- name: Setup Nextflow
29+
uses: nf-core/setup-nextflow@v2
30+
with:
31+
version: "${{ env.NXF_VER }}"
32+
33+
- name: Set up Python
34+
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5
35+
with:
36+
python-version: "3.11"
37+
38+
- name: Install nf-test
39+
uses: nf-core/setup-nf-test@v1
40+
with:
41+
version: "${{ env.NFT_VER }}"
42+
install-pdiff: true
43+
44+
- name: Setup apptainer
45+
if: contains(inputs.profile, 'singularity')
46+
uses: eWaterCycle/setup-apptainer@main
47+
48+
- name: Set up Singularity
49+
if: contains(inputs.profile, 'singularity')
50+
shell: bash
51+
run: |
52+
mkdir -p $NXF_SINGULARITY_CACHEDIR
53+
mkdir -p $NXF_SINGULARITY_LIBRARYDIR
54+
55+
- name: Conda setup
56+
if: ${{inputs.profile == 'conda'}}
57+
uses: conda-incubator/setup-miniconda@d2e6a045a86077fb6cad6f5adf368e9076ddaa8d # v3
58+
with:
59+
auto-update-conda: true
60+
conda-solver: libmamba
61+
conda-remove-defaults: true
62+
63+
- name: Run nf-test
64+
shell: bash
65+
run: |
66+
NFT_WORKDIR=~ \
67+
nf-test test \
68+
--ci \
69+
--shard ${{ inputs.shard }}/${{ inputs.total_shards }} \
70+
--changed-since HEAD^ \
71+
--profile=${{ inputs.profile }} \
72+
--filter ${{ inputs.filters }} \
73+
--tap=test.tap \
74+
--verbose \
75+
--tag ${{ inputs.tags }}
76+
77+
# TODO If no test.tap, then make one to spoof?
78+
- uses: pcolby/tap-summary@0959cbe1d4422e62afc65778cdaea6716c41d936 # v1
79+
if: ${{ inputs.path != '' }}
80+
with:
81+
path: >-
82+
test.tap
83+
84+
- name: Clean up
85+
if: always()
86+
shell: bash
87+
run: |
88+
sudo rm -rf /home/ubuntu/tests/*

.github/workflows/awsfulltest.yml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
name: nf-core AWS full size tests
2-
# This workflow is triggered on PRs opened against the master branch.
2+
# This workflow is triggered on PRs opened against the main/master branch.
33
# It can be additionally triggered manually with GitHub actions workflow dispatch button.
44
# It runs the -profile 'test_full' on AWS batch
55

66
on:
77
pull_request:
88
branches:
9+
- main
910
- master
1011
workflow_dispatch:
1112
pull_request_review:
@@ -21,19 +22,30 @@ jobs:
2122
matrix:
2223
aligner: ["bismark", "bismark_hisat", "bwameth"]
2324
steps:
24-
- uses: octokit/[email protected]
25+
- name: Get PR reviews
26+
uses: octokit/[email protected]
2527
if: github.event_name != 'workflow_dispatch'
2628
id: check_approvals
29+
continue-on-error: true
2730
with:
2831
route: GET /repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/reviews?per_page=100
2932
env:
3033
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31-
- id: test_variables
34+
35+
- name: Check for approvals
36+
if: ${{ failure() && github.event_name != 'workflow_dispatch' }}
37+
run: |
38+
echo "No review approvals found. At least 2 approvals are required to run this action automatically."
39+
exit 1
40+
41+
- name: Check for enough approvals (>=2)
42+
id: test_variables
3243
if: github.event_name != 'workflow_dispatch'
3344
run: |
3445
JSON_RESPONSE='${{ steps.check_approvals.outputs.data }}'
3546
CURRENT_APPROVALS_COUNT=$(echo $JSON_RESPONSE | jq -c '[.[] | select(.state | contains("APPROVED")) ] | length')
3647
test $CURRENT_APPROVALS_COUNT -ge 2 || exit 1 # At least 2 approvals are required
48+
3749
- name: Launch workflow via Seqera Platform
3850
uses: seqeralabs/action-tower-launch@v2
3951
with:

.github/workflows/branch.yml

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
name: nf-core branch protection
2-
# This workflow is triggered on PRs to master branch on the repository
3-
# It fails when someone tries to make a PR against the nf-core `master` branch instead of `dev`
2+
# This workflow is triggered on PRs to `main`/`master` branch on the repository
3+
# It fails when someone tries to make a PR against the nf-core `main`/`master` branch instead of `dev`
44
on:
55
pull_request_target:
6-
branches: [master]
6+
branches:
7+
- main
8+
- master
79

810
jobs:
911
test:
1012
runs-on: ubuntu-latest
1113
steps:
12-
# PRs to the nf-core repo master branch are only ok if coming from the nf-core repo `dev` or any `patch` branches
14+
# PRs to the nf-core repo main/master branch are only ok if coming from the nf-core repo `dev` or any `patch` branches
1315
- name: Check PRs
1416
if: github.repository == 'nf-core/methylseq'
1517
run: |
@@ -22,7 +24,7 @@ jobs:
2224
uses: mshick/add-pr-comment@b8f338c590a895d50bcbfa6c5859251edc8952fc # v2
2325
with:
2426
message: |
25-
## This PR is against the `master` branch :x:
27+
## This PR is against the `${{github.event.pull_request.base.ref}}` branch :x:
2628
2729
* Do not close this PR
2830
* Click _Edit_ and change the `base` to `dev`
@@ -32,9 +34,9 @@ jobs:
3234
3335
Hi @${{ github.event.pull_request.user.login }},
3436
35-
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.
36-
The `master` branch on nf-core repositories should always contain code from the latest release.
37-
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.
37+
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.
38+
The ${{github.event.pull_request.base.ref}} branch on nf-core repositories should always contain code from the latest release.
39+
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.
3840
3941
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.
4042
Note that even after this, the test will continue to show as failing until you push a new commit.

0 commit comments

Comments
 (0)