Skip to content

Commit

Permalink
Merge pull request #492 from nf-core/dev
Browse files Browse the repository at this point in the history
Dev -> Master 3.0.0
  • Loading branch information
sateeshperi authored Dec 16, 2024
2 parents d16f8f8 + b212815 commit 4415e90
Show file tree
Hide file tree
Showing 182 changed files with 9,154 additions and 5,241 deletions.
12 changes: 6 additions & 6 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# nf-core/methylseq: Contributing Guidelines
# `nf-core/methylseq`: Contributing Guidelines

Hi there!
Many thanks for taking an interest in improving nf-core/methylseq.
Expand Down Expand Up @@ -55,23 +55,23 @@ 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).
- A PR should be made on `master` from patch to directly this particular bug.
- Open a pull-request from `patch` to `main`/`master` with the changes.

## Getting help

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)).

## Pipeline contribution conventions

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.
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.

### Adding a new step

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

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

### Default values

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

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

Expand Down
60 changes: 60 additions & 0 deletions .github/actions/nf-test-shard/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: "Get number of shards"
description: "Get the number of nf-test shards for the current CI job"
inputs:
tags:
description: "Tags to pass as argument for nf-test --tag parameter"
required: true
max_shards:
description: "Maximum number of shards allowed"
required: true
outputs:
shard:
description: "Array of shard numbers"
value: ${{ steps.shards.outputs.shard }}
total_shards:
description: "Total number of shards"
value: ${{ steps.shards.outputs.total_shards }}

runs:
using: "composite"
steps:
- name: Install nf-test
uses: nf-core/setup-nf-test@v1
with:
version: ${{ env.NFT_VER }}
install-pdiff: true

- name: Get number of shards
id: shards
shell: bash
run: |
# Run nf-test to get the number of related tests
nftest_output=$(nf-test test --dry-run --changed-since HEAD^ --filter pipeline --tag ${{ inputs.tags }})
echo "nf-test dry-run output: $nftest_output"
# Default values for shard and total_shards
shard="[]"
total_shards=0
# Check if there are related tests
if echo "$nftest_output" | grep -q 'Nothing to do'; then
echo "No related tests found."
else
# Extract the number of related tests
number_of_shards=$(echo "$nftest_output" | sed -n 's|.*Executed \([0-9]*\) tests.*|\1|p')
if [[ -n "$number_of_shards" && "$number_of_shards" -gt 0 ]]; then
shards_to_run=$(( $number_of_shards < ${{ inputs.max_shards }} ? $number_of_shards : ${{ inputs.max_shards }} ))
shard=$(seq 1 "$shards_to_run" | jq -R . | jq -c -s .)
total_shards="$shards_to_run"
else
echo "Unexpected output format. Falling back to default values."
fi
fi
# Write to GitHub Actions outputs
echo "shard=$shard" >> $GITHUB_OUTPUT
echo "total_shards=$total_shards" >> $GITHUB_OUTPUT
# Debugging output
echo "Final shard array: $shard"
echo "Total number of shards: $total_shards"
88 changes: 88 additions & 0 deletions .github/actions/nf-test/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
name: "nf-test Action"
description: "Runs nf-test with common setup steps"
inputs:
profile:
description: "Profile to use"
required: true
shard:
description: "Shard number for this CI job"
required: true
total_shards:
description: "Total number of test shards(NOT the total number of matrix jobs)"
required: true
filters:
description: "Filter test cases by specified types (e.g., module, pipeline, workflow or function)"
required: true
tags:
description: "Tags to pass as argument for nf-test --tag parameter"
required: true

runs:
using: "composite"
steps:
- uses: actions/setup-java@8df1039502a15bceb9433410b1a100fbe190c53b # v4
with:
distribution: "temurin"
java-version: "17"

- name: Setup Nextflow
uses: nf-core/setup-nextflow@v2
with:
version: "${{ env.NXF_VER }}"

- name: Set up Python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5
with:
python-version: "3.11"

- name: Install nf-test
uses: nf-core/setup-nf-test@v1
with:
version: "${{ env.NFT_VER }}"
install-pdiff: true

- name: Setup apptainer
if: contains(inputs.profile, 'singularity')
uses: eWaterCycle/setup-apptainer@main

- name: Set up Singularity
if: contains(inputs.profile, 'singularity')
shell: bash
run: |
mkdir -p $NXF_SINGULARITY_CACHEDIR
mkdir -p $NXF_SINGULARITY_LIBRARYDIR
- name: Conda setup
if: ${{inputs.profile == 'conda'}}
uses: conda-incubator/setup-miniconda@d2e6a045a86077fb6cad6f5adf368e9076ddaa8d # v3
with:
auto-update-conda: true
conda-solver: libmamba
conda-remove-defaults: true

- name: Run nf-test
shell: bash
run: |
NFT_WORKDIR=~ \
nf-test test \
--ci \
--shard ${{ inputs.shard }}/${{ inputs.total_shards }} \
--changed-since HEAD^ \
--profile=${{ inputs.profile }} \
--filter ${{ inputs.filters }} \
--tap=test.tap \
--verbose \
--tag ${{ inputs.tags }}
# TODO If no test.tap, then make one to spoof?
- uses: pcolby/tap-summary@0959cbe1d4422e62afc65778cdaea6716c41d936 # v1
if: ${{ inputs.path != '' }}
with:
path: >-
test.tap
- name: Clean up
if: always()
shell: bash
run: |
sudo rm -rf /home/ubuntu/tests/*
18 changes: 15 additions & 3 deletions .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 All @@ -21,19 +22,30 @@ jobs:
matrix:
aligner: ["bismark", "bismark_hisat", "bwameth"]
steps:
- uses: octokit/request-action@v2.x
- name: Get PR reviews
uses: octokit/request-action@v2.x
if: github.event_name != 'workflow_dispatch'
id: check_approvals
continue-on-error: true
with:
route: GET /repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/reviews?per_page=100
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- id: test_variables

- name: Check for approvals
if: ${{ failure() && github.event_name != 'workflow_dispatch' }}
run: |
echo "No review approvals found. At least 2 approvals are required to run this action automatically."
exit 1
- name: Check for enough approvals (>=2)
id: test_variables
if: github.event_name != 'workflow_dispatch'
run: |
JSON_RESPONSE='${{ steps.check_approvals.outputs.data }}'
CURRENT_APPROVALS_COUNT=$(echo $JSON_RESPONSE | jq -c '[.[] | select(.state | contains("APPROVED")) ] | length')
test $CURRENT_APPROVALS_COUNT -ge 2 || exit 1 # At least 2 approvals are required
- name: Launch workflow via Seqera Platform
uses: seqeralabs/action-tower-launch@v2
with:
Expand Down
18 changes: 10 additions & 8 deletions .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 == 'nf-core/methylseq'
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
Loading

0 comments on commit 4415e90

Please sign in to comment.