-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
116 changed files
with
5,173 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
name: fix-linting | ||
run-name: fix linting (automated) | ||
on: | ||
issue_comment: | ||
types: [created] | ||
|
||
jobs: | ||
fix-linting: | ||
# Only run if comment is on a PR with the main repo, and if it contains the magic keywords | ||
if: > | ||
contains(github.event.comment.html_url, '/pull/') && | ||
contains(github.event.comment.body, '@nf-core-bot fix linting') && | ||
github.repository == 'nf-core/modules' | ||
runs-on: ubuntu-latest | ||
steps: | ||
# Use the @nf-core-bot token to check out so we can push later | ||
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 | ||
with: | ||
token: ${{ secrets.nf_core_bot_auth_token }} | ||
|
||
# indication that the linting is being fixed | ||
- name: React on comment | ||
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4 | ||
with: | ||
comment-id: ${{ github.event.comment.id }} | ||
reactions: eyes | ||
|
||
# Action runs on the issue comment, so we don't get the PR by default | ||
# Use the gh cli to check out the PR | ||
- name: Checkout Pull Request | ||
run: gh pr checkout ${{ github.event.issue.number }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.nf_core_bot_auth_token }} | ||
|
||
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4 | ||
|
||
- name: Install Prettier | ||
run: npm install -g prettier @prettier/plugin-php | ||
|
||
# Check that we actually need to fix something | ||
- name: Run 'prettier --check' | ||
id: prettier_status | ||
run: | | ||
if prettier --check ${GITHUB_WORKSPACE}; then | ||
echo "::set-output name=result::pass" | ||
else | ||
echo "::set-output name=result::fail" | ||
fi | ||
- name: Run 'prettier --write' | ||
if: steps.prettier_status.outputs.result == 'fail' | ||
run: prettier --write ${GITHUB_WORKSPACE} | ||
|
||
- name: Post nothing-to-do comment | ||
if: steps.prettier_status.outputs.result == 'pass' | ||
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4 | ||
with: | ||
issue-number: ${{ github.event.issue.number }} | ||
body: | | ||
Nothing for me to do here! :shrug: | ||
This is probably because the linting errors come from `nf-core lint` and have to be fixed manually (or with `nf-core lint --fix`). | ||
- name: Commit & push changes | ||
if: steps.prettier_status.outputs.result == 'fail' | ||
run: | | ||
git config user.email "[email protected]" | ||
git config user.name "nf-core-bot" | ||
git config push.default upstream | ||
git add . | ||
git status | ||
git commit -m "[automated] Fix linting with Prettier" | ||
git push |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,286 @@ | ||
name: Run tests | ||
on: | ||
pull_request: | ||
branches: [main] | ||
workflow_dispatch: | ||
|
||
# Cancel if a newer run is started | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
pre-commit: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 | ||
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5 | ||
- uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1 | ||
# FIXME Flip this off once we get to less than a couple hundred. Adding | ||
# this so it will only run against changed files. It'll make it much | ||
# easier to fix these as they come up rather than everything at once. | ||
with: | ||
extra_args: "" | ||
|
||
prettier: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out repository | ||
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 | ||
|
||
- name: Install NodeJS | ||
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4 | ||
with: | ||
node-version: "20" | ||
|
||
- name: Install Prettier | ||
run: npm install -g [email protected] | ||
|
||
- name: Run Prettier --check | ||
run: prettier --check . | ||
|
||
editorconfig: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 | ||
|
||
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4 | ||
with: | ||
node-version: "20" | ||
|
||
- name: Install editorconfig-checker | ||
run: npm install -g editorconfig-checker | ||
|
||
- name: Run ECLint check | ||
run: editorconfig-checker -exclude README.md $(git ls-files | grep -v test) | ||
|
||
nf-test-changes: | ||
name: nf-test-changes | ||
runs-on: ubuntu-latest | ||
outputs: | ||
# Expose detected tags as 'modules' and 'workflows' output variables | ||
paths: ${{ steps.list.outputs.components }} | ||
modules: ${{ steps.outputs.outputs.modules }} | ||
subworkflows: ${{ steps.outputs.outputs.subworkflows}} | ||
# Prod for version bumping | ||
|
||
steps: | ||
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: List nf-test files | ||
id: list | ||
uses: adamrtalbot/detect-nf-test-changes@6e67b7a6bd3caf8571b99cab3ab764c0e758f55c # v0.0.3 | ||
with: | ||
head: ${{ github.sha }} | ||
base: ${{ github.event.pull_request.base.sha || github.event.merge_group.base_sha }} | ||
n_parents: 2 | ||
|
||
- name: Separate modules and subworkflows | ||
id: outputs | ||
run: | | ||
echo modules=$(echo '${{ steps.list.outputs.components }}' | jq -c '. | map(select(contains("modules"))) | map(gsub("modules/class-modules/"; ""))') >> $GITHUB_OUTPUT | ||
echo subworkflows=$(echo '${{ steps.list.outputs.components }}' | jq '. | map(select(contains("subworkflows"))) | map(gsub("subworkflows/class-modules/"; ""))') >> $GITHUB_OUTPUT | ||
- name: debug | ||
run: | | ||
echo ${{ steps.outputs.outputs.modules }} | ||
echo ${{ steps.outputs.outputs.subworkflows }} | ||
nf-core-lint-modules: | ||
runs-on: ubuntu-latest | ||
name: nf-core-lint-modules | ||
needs: nf-test-changes | ||
if: ( needs.nf-test-changes.outputs.modules != '[]') | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
tags: ["${{ fromJson(needs.nf-test-changes.outputs.modules) }}"] | ||
steps: | ||
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5 | ||
with: | ||
python-version: "3.11" | ||
|
||
- uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4 | ||
id: cache-pip | ||
with: | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-pip | ||
restore-keys: | | ||
${{ runner.os }}-pip | ||
- name: Install pip | ||
run: python -m pip install --upgrade pip | ||
|
||
- uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4 | ||
with: | ||
distribution: "temurin" | ||
java-version: "17" | ||
|
||
- name: Setup Nextflow | ||
uses: nf-core/setup-nextflow@v2 | ||
|
||
- name: Install nf-core tools development version | ||
run: python -m pip install --upgrade --force-reinstall git+https://github.com/nf-core/tools.git@dev | ||
|
||
- name: Lint module ${{ matrix.tags }} | ||
run: nf-core modules --git-remote https://github.com/mirpedrol/class-modules lint ${{ matrix.tags }} | ||
|
||
nf-core-lint-subworkflows: | ||
runs-on: ubuntu-latest | ||
name: nf-core-lint-modules | ||
needs: nf-test-changes | ||
if: ( needs.nf-test-changes.outputs.subworkflows != '[]') | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
tags: | ||
[ | ||
"${{ fromJson(needs.nf-test-changes.outputs.subworkflows) }}", | ||
] | ||
steps: | ||
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5 | ||
with: | ||
python-version: "3.11" | ||
|
||
- name: Install pip | ||
run: python -m pip install --upgrade pip | ||
|
||
- uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4 | ||
with: | ||
distribution: "temurin" | ||
java-version: "17" | ||
|
||
- name: Setup Nextflow | ||
uses: nf-core/setup-nextflow@561fcfc7146dcb12e3871909b635ab092a781f34 # v2 | ||
|
||
- name: Install nf-core tools development version | ||
run: python -m pip install --upgrade --force-reinstall git+https://github.com/nf-core/tools.git@dev | ||
|
||
- name: Lint module ${{ matrix.tags }} | ||
run: nf-core subworkflows --git-remote https://github.com/mirpedrol/class-modules lint ${{ matrix.tags }} | ||
|
||
nf-test: | ||
runs-on: ubuntu-latest | ||
name: nf-test | ||
needs: nf-test-changes | ||
if: ( needs.nf-test-changes.outputs.paths != '[]' ) | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
path: ["${{ fromJson(needs.nf-test-changes.outputs.paths) }}"] | ||
profile: [conda, docker, singularity] | ||
env: | ||
NXF_ANSI_LOG: false | ||
NFTEST_VER: "0.8.4" | ||
|
||
steps: | ||
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4 | ||
|
||
- uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4 | ||
with: | ||
distribution: "temurin" | ||
java-version: "17" | ||
- name: Setup Nextflow | ||
uses: nf-core/setup-nextflow@v2 | ||
|
||
- name: Install nf-test | ||
uses: nf-core/setup-nf-test@v1 | ||
|
||
- name: Setup apptainer | ||
if: matrix.profile == 'singularity' | ||
uses: eWaterCycle/setup-apptainer@main | ||
|
||
- name: Set up Singularity | ||
if: matrix.profile == 'singularity' | ||
uses: eWaterCycle/setup-singularity@v7 | ||
with: | ||
singularity-version: 3.8.3 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5 | ||
with: | ||
python-version: "3.11" | ||
- uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4 | ||
id: cache-pip-pdiff | ||
with: | ||
path: ~/.cache/pip | ||
key: ${{ runner.os }}-pip-pdiff | ||
restore-keys: | | ||
${{ runner.os }}-pip-pdiff | ||
- name: Install Python dependencies | ||
run: python -m pip install --upgrade pip pdiff cryptography | ||
|
||
- name: Set up miniconda | ||
uses: conda-incubator/setup-miniconda@a4260408e20b96e80095f42ff7f1a15b27dd94ca # v3 | ||
with: | ||
miniconda-version: "latest" | ||
auto-update-conda: true | ||
channels: conda-forge,bioconda,defaults | ||
|
||
- name: Conda setup | ||
run: | | ||
conda clean -a | ||
conda install -n base conda-libmamba-solver | ||
conda config --set solver libmamba | ||
echo $(realpath $CONDA)/condabin >> $GITHUB_PATH | ||
echo $(realpath python) >> $GITHUB_PATH | ||
# Test the module | ||
- name: Run nf-test | ||
env: | ||
NFT_DIFF: "pdiff" | ||
NFT_DIFF_ARGS: "--line-numbers --width 120 --expand-tabs=2" | ||
run: | | ||
PROFILE=${{ matrix.profile }} | ||
NFT_WORKDIR=~ \ | ||
nf-test test \ | ||
--profile=${{ matrix.profile }} \ | ||
--tap=test.tap \ | ||
--verbose \ | ||
${{ matrix.path }} | ||
- uses: pcolby/tap-summary@0959cbe1d4422e62afc65778cdaea6716c41d936 # v1 | ||
with: | ||
path: >- | ||
test.tap | ||
- name: Clean up | ||
if: always() | ||
run: | | ||
sudo rm -rf /home/ubuntu/tests/ | ||
confirm-pass: | ||
runs-on: ubuntu-latest | ||
needs: | ||
[ | ||
prettier, | ||
editorconfig, | ||
nf-core-lint-modules, | ||
nf-core-lint-subworkflows, | ||
nf-test-changes, | ||
nf-test, | ||
] | ||
if: always() | ||
steps: | ||
- name: All tests ok | ||
if: ${{ success() || !contains(needs.*.result, 'failure') }} | ||
run: exit 0 | ||
- name: One or more tests failed | ||
if: ${{ contains(needs.*.result, 'failure') }} | ||
run: exit 1 | ||
|
||
- name: debug-print | ||
if: always() | ||
run: | | ||
echo "toJSON(needs) = ${{ toJSON(needs) }}" | ||
echo "toJSON(needs.*.result) = ${{ toJSON(needs.*.result) }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/mirrors-prettier | ||
rev: "v3.1.0" | ||
hooks: | ||
- id: prettier | ||
additional_dependencies: | ||
- [email protected] | ||
- repo: https://github.com/python-jsonschema/check-jsonschema | ||
rev: 0.28.5 | ||
hooks: | ||
- id: check-jsonschema | ||
# match meta.ymls in one of the subdirectories of modules/nf-core | ||
files: ^modules/nf-core/.*/meta\.yml$ | ||
args: ["--schemafile", "modules/yaml-schema.json"] | ||
- id: check-jsonschema | ||
# match meta.ymls in one of the subdirectories of subworkflows/nf-core | ||
files: ^subworkflows/nf-core/.*/meta\.yml$ | ||
args: ["--schemafile", "subworkflows/yaml-schema.json"] | ||
- id: check-github-workflows | ||
- repo: https://github.com/renovatebot/pre-commit-hooks | ||
rev: 37.408.2 | ||
hooks: | ||
- id: renovate-config-validator | ||
# use ruff for python files | ||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
rev: v0.4.10 | ||
hooks: | ||
- id: ruff | ||
files: \.py$ | ||
args: [--fix, --exit-non-zero-on-fix, "--select", "I,E1,E4,E7,E9,F,UP,N"] # sort imports and fix (rules taken from nf-core/tools) | ||
- id: ruff-format # formatter |
Oops, something went wrong.