Skip to content

Commit

Permalink
Merge branch 'main' into fixes/gzip-check
Browse files Browse the repository at this point in the history
  • Loading branch information
lukfor authored Jul 13, 2024
2 parents 5494dd2 + 26c9edd commit 7a265d6
Show file tree
Hide file tree
Showing 75 changed files with 3,311 additions and 529 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ jobs:
- name: Build
run: mvn install
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- uses: ncipollo/release-action@v1
with:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,5 @@ jobs:

- name: Test
run: mvn install
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ test_mock.nf
site
/tests
/.nf-test.log
/temp
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ The full documentation can be found [here](https://code.askimed.com/nf-test).
nf-test has the same requirements as Nextflow and can be used on POSIX compatible systems like Linux or OS X. You can install nf-test using the following command:

```bash
curl -fsSL https://code.askimed.com/install/nf-test | bash
curl -fsSL https://get.nf-test.com | bash
```

If you don't have curl installed, you could use wget:

```bash
wget -qO- https://code.askimed.com/install/nf-test | bash
wget -qO- https://get.nf-test.com | bash
```

It will create the `nf-test` executable file in the current directory. Optionally, move the `nf-test` file to a directory accessible by your `$PATH` variable.
Expand Down Expand Up @@ -64,6 +64,12 @@ Show the world your Nextflow pipeline is using nf-test:
[![nf-test](https://img.shields.io/badge/tested_with-nf--test-337ab7.svg)](https://github.com/askimed/nf-test)
```

## Citation

If you test your pipeline with nf-test, please cite:

Forer, L., & Schönherr, S. (2024). Improving the Reliability and Quality of Nextflow Pipelines with nf-test. *bioRxiv*. [https://doi.org/10.1101/2024.05.25.595877](https://doi.org/10.1101/2024.05.25.595877)

## Contact

- Lukas Forer [@lukfor](https://twitter.com/lukfor)
Expand Down
19 changes: 19 additions & 0 deletions docs/docs/cli/coverage.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# `coverage` command

:octicons-tag-24: 0.9.0

## Usage

```
nf-test coverage
```

The `coverage` command prints information about the number of Nextflow files that are covered by a test.

### Optional Arguments

#### `--csv <filename>`
Writes a coverage report in csv format.

#### `--html <filename>`
Writes a coverage report in html format.
97 changes: 95 additions & 2 deletions docs/docs/cli/test.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ nf-test test [<NEXTFLOW_FILES>|<SCRIPT_FOLDERS>]

To run your test using a specific Nextflow profile, you can use the `--profile` argument. [Learn more](/docs/docs/configuration#managing-profiles).

#### `--dry-run`

This flag allows users to simulate the execution of tests.

#### `--verbose`

Prints out the Nextflow output during test runs.
Expand All @@ -24,6 +28,12 @@ The Linux tool `procps` is required to run Nextflow tracing. In case your contai

Execute only tests with the provided tag. Multiple tags can be used and have to be separated by commas (e.g. `tag1,tag2`).

#### `--debug`

The debug parameter prints out debugging messages and all available output channels which can be accessed in the `then` clause.

### Output Reports

#### `--tap <filename>`

Writes test results in [TAP format](https://testanything.org) to file.
Expand All @@ -32,9 +42,66 @@ Writes test results in [TAP format](https://testanything.org) to file.

Writes test results in [JUnit XML format](https://junit.org/) to file, which conforms to [the standard schema](https://github.com/junit-team/junit5/blob/242f3b3ef84cfd96c9de26992588812a68cdef8b/platform-tests/src/test/resources/jenkins-junit.xsd).

#### `--debug`
#### `--csv <filename>`

The debug parameter prints out debugging messages and all available output channels which can be accessed in the `then` clause.
Writes test results in csv file.

#### `--ci`

By default,nf-test automatically stores a new snapshot. When CI mode is activated, nf-test will fail the test instead of storing the snapshot automatically.


### `--filter <types>`

Filter test cases by specified types (e.g., module, pipeline, workflow or function). Multiple types can be separated by commas.


### Optimizing Test Execution

#### `--related-tests <files>`

Finds and executes all related tests for the provided .nf or nf.test files. Multiple files can be provided space separated.

#### `--follow-dependencies`

When this flag is set, nf-test will traverse all dependencies when the related-tests flag is set.
This option is particularly useful when you need to ensure that
all dependent tests are executed, bypassing the firewall calculation process.

#### `--only-changed`

When enabled, this parameter instructs nf-test to execute tests only for files that have been modified within the
current git working tree.

#### `--changed-since <commit_hash|branch_name>`

This parameter triggers the execution of tests related to changes made since the specifie commit.
e.g. `--changed-since HEAD^` for all changes between the HEAD and HEAD - 1.

#### `--changed-until <commit_hash|branch_name>`

This parameter initiates the execution of tests related to changes made until the specified commit hash.

#### `--graph <filename>`

Enables the export of the dependency graph as a dot file.
The dot file format is commonly used for representing graphs in graphviz and other related software.

### Sharding

This parameter allows users to divide the execution workload into manageable chunks, which can be useful for
parallel or distributed processing.

#### `--shard <shard>`
Splits the execution into arbitrary chunks defined by the format `i/n`, where `i` denotes the index of the current
chunk and `n` represents the total number of chunks. For instance, `2/5` executes the second chunk out of five.

#### `--shard-strategy <strategy>`
Description: Specifies the strategy used to build shards when the `--shard` parameter is utilized.
Accepted values are `round-robin` or `none.`. This parameter determines the method employed to distribute workload
chunks among available resources. With the round-robin strategy, shards are distributed evenly among resources in
a cyclic manner. The none strategy implies that shards won't be distributed automatically, and it's up to the
user to manage the assignment of shards. Default value is `round-robin`.

## Examples

Expand Down Expand Up @@ -63,3 +130,29 @@ The debug parameter prints out debugging messages and all available output chann
```
nf-test test --tap report.tap
```

- Run all tests (and possible integration tests) for module `modules/module_a.nf` and `modules/module_b.nf`;

```
nf-test test --related-tests modules/module_a.nf modules/module_b.nf
```

- If your project is a Git directory and you have modified files, you can run tests only for these changed files by
using the following command:

```
nf-test test --only-changed
```

- If you want to test all changes made between the current state of the repository and the last commit,
you can use the following command:

```
nf-test test --changed-since HEAD^
```

- Run only the second of four shards:

```
nf-test test --shard 2/4
```
20 changes: 19 additions & 1 deletion docs/docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
The `nf-test.config` file is a configuration file used to customize settings and behavior for `nf-test`. This file must be located in the root of your project, and it is automatically loaded when you run `nf-test test`. Below are the parameters that can be adapted:

| Parameter | Description | Default Value |
| ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------- |
|--------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------| ------------------------- |
| `testsDir` | Location for storing all nf-test cases (test scripts). If you want all test files to be in the same directory as the script itself, you can set the testDir to `.` | `"tests"` |
| `workDir` | Directory for storing temporary files and working directories for each test. This directory should be added to `.gitignore`. | `".nf-test"` |
| `configFile` | Location of an optional `nextflow.config` file specifically used for executing tests. [Learn more](#testsnextflowconfig). | `"tests/nextflow.config"` |
Expand All @@ -14,6 +14,9 @@ The `nf-test.config` file is a configuration file used to customize settings and
| `withTrace` | Enable or disable tracing options during testing. Disable tracing if your containers don't include the `procps` tool. | `true` |
| `autoSort` | Enable or disable sorted channels by default when running tests. | `true` |
| `options` | Custom Nextflow command-line options to be applied when running tests. For example `"-dump-channels -stub-run"` | |
| `ignore` | List of filenames or patterns that should be ignored when building the dependency graph. For example: `ignore 'folder/**/*.nf', 'modules/module.nf'` | `` |
| `triggers` | List of filenames or patterns that should be trigger a full test run. For example: `triggers 'nextflow.config', 'test-data/**/*'` | `` |
| `requires` | Can be used to specify the minimum required version of nf-test. Requires nf-test > 0.9.0 | `` |

Here's an example of what an `nf-test.config` file could look like:

Expand All @@ -30,6 +33,17 @@ config {
}
```

The `requires` keyword can be used to specify the minimum required version of nf-test.
For instance, to ensure the use of at least nf-test version 0.9.0, define it as follows:

```groovy
config {
requires (
"nf-test": "0.9.0"
)
}
```

## `tests/nextflow.config`

This optional `nextflow.config` file is used to execute tests. This is a good place to set default `params` for all your tests. Example number of threads:
Expand Down Expand Up @@ -102,6 +116,10 @@ By understanding this profile evaluation order, you can effectively configure Ne

## File Staging

!!! warning

File Staging is obsolete since version >= 0.9.0.

The `stage` section of the `nf-test.config` file is used to define files that are needed by Nextflow in the test environment (`meta` directory). Additionally, the directories `lib`, `bin`, and `assets` are automatically staged.

### Supported Directives
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/plugins/using-plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ For this purpose, we integrated the following plugin system that provides (a) th

## Using Plugins

Available plugins are listed [here](https://code.askimed.com/nf-test-plugins).
Available plugins are listed [here](https://plugins.nf-test.com).

A plugin can be activated via the `nf-test.config` by adding the `plugin` section and by using `load` method to specify the plugin and its version:

Expand Down
9 changes: 9 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,15 @@ Show the world your Nextflow pipeline is using nf-test and add the following bad
[![nf-test](https://img.shields.io/badge/tested_with-nf--test-337ab7.svg)](https://code.askimed.com/nf-test)
```

---

## :material-file: Citation

If you test your pipeline with nf-test, please cite:

Forer, L., & Schönherr, S. (2024). Improving the Reliability and Quality of Nextflow Pipelines with nf-test. *bioRxiv*. [https://doi.org/10.1101/2024.05.25.595877](https://doi.org/10.1101/2024.05.25.595877)


----

## :material-account-supervisor: About
Expand Down
6 changes: 3 additions & 3 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
nf-test has the same requirements as Nextflow and can be used on POSIX compatible systems like Linux or OS X. You can install nf-test using the following command:

```bash
curl -fsSL https://code.askimed.com/install/nf-test | bash
curl -fsSL https://get.nf-test.com | bash
```

If you don't have curl installed, you could use wget:

```bash
wget -qO- https://code.askimed.com/install/nf-test | bash
wget -qO- https://get.nf-test.com | bash
```

It will create the `nf-test` executable file in the current directory. Optionally, move the `nf-test` file to a directory accessible by your `$PATH` variable.
Expand Down Expand Up @@ -48,7 +48,7 @@ Now you are ready to write your [first testcase](docs/getting-started.md).
If you want to install a specific version pass it to the install script as so

```sh
curl -fsSL https://code.askimed.com/install/nf-test | bash -s 0.7.0
curl -fsSL https://get.nf-test.com | bash -s 0.7.0
```

### Manual installation
Expand Down
16 changes: 16 additions & 0 deletions docs/resources.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,22 @@ This page collects videos and blog posts about nf-test created by the community.

---

### :material-tooltip-text:{ style="color: #337ab7" } Training Module: Hello nf-test

This training modules introduces nf-test in a simple and easy to follow-along hello-nextflow style aimed for beginners.

[hello nf-test training module](https://training.nextflow.io/hello_nextflow/05_hello_nf-test/)

---

### :material-tooltip-text:{ style="color: #337ab7" } Blog post: Leveraging nf-test for enhanced quality control in nf-core

Reproducibility is an important attribute of all good science. This is specially true in the realm of bioinformatics, where software is hopefully being constantly updated, and pipelines are ideally being maintained. This blog post covers nf-test in the nf-core context.

[Read blog post](https://nextflow.io/blog/2024/nf-test-in-nf-core.html)

---

### :fontawesome-brands-youtube:{ style="color: #EE0F0F" } nf-core/bytesize: Converting pytest modules to nf-test

**Adam Talbot** & **Sateesh Peri** do a live demo of converting nf-core DSL2 modules pytests to nf-test
Expand Down
16 changes: 16 additions & 0 deletions docs/tutorials.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
hide:
- navigation
---

# Tutorials

---

### [:material-file:{ style="color: #337ab7" } Setup nf-test on GitHub Actions](tutorials/github-actions.md)

In this tutorial, we will guide you through setting up and running `nf-test` on GitHub Actions.

[Read tutorial](tutorials/github-actions.md)

---
Loading

0 comments on commit 7a265d6

Please sign in to comment.