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

Set up for nf-test #11

Merged
merged 29 commits into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
61e1aa6
Set up for nf-test
pinin4fjords Nov 27, 2023
97aa212
Add nf-test bits to CI
pinin4fjords Nov 27, 2023
baf9d57
Prettify
pinin4fjords Nov 27, 2023
d567502
Add tags file
pinin4fjords Nov 27, 2023
538134a
Update test file
pinin4fjords Nov 27, 2023
03847cd
Fix nf-test config
pinin4fjords Nov 28, 2023
7d897cc
Working nf-test in first submodule
pinin4fjords Nov 28, 2023
378a007
Fix spacing
pinin4fjords Nov 28, 2023
9396d0f
Don't need log in git
pinin4fjords Nov 28, 2023
c0203a8
Add config for docker
pinin4fjords Nov 28, 2023
46c61be
Rename nf-test tests
pinin4fjords Nov 28, 2023
6db9413
nf-test needs token
pinin4fjords Nov 28, 2023
178395f
sort list for reproducibility
pinin4fjords Nov 28, 2023
d062a71
turn off verbose for snapshot
pinin4fjords Nov 28, 2023
411b575
Try taking out mismatching content
pinin4fjords Nov 28, 2023
1bd8318
Match the nf-test and see if it helps
pinin4fjords Nov 28, 2023
464bdf2
Fix snapshotting
pinin4fjords Nov 29, 2023
daaa8a1
Appease eclint
pinin4fjords Nov 29, 2023
2e07754
Merge branch 'main' into nf-test
pinin4fjords Nov 29, 2023
1492304
Fix input channel for recent changes
pinin4fjords Nov 29, 2023
c471ed0
Fix snapshot
pinin4fjords Nov 29, 2023
e40a152
Fix container
pinin4fjords Nov 29, 2023
1862501
Try with conda too
pinin4fjords Nov 29, 2023
4d47e73
Install conda
pinin4fjords Nov 29, 2023
4b4a0c7
Fix sort order of file list for snapshotting
pinin4fjords Nov 29, 2023
97f8469
Merge branch 'nf-test' of https://github.com/seqeralabs/nf-aggregate …
pinin4fjords Nov 29, 2023
cceadd6
prettier
pinin4fjords Nov 29, 2023
ca20018
Address review feedback
pinin4fjords Nov 29, 2023
3c9f962
Back to /tmp
pinin4fjords Nov 29, 2023
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
89 changes: 89 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,92 @@ jobs:
- name: Run pipeline with test data
run: |
nextflow run ${GITHUB_WORKSPACE} -profile test,docker --outdir ./results

changes:
name: Check for changes
runs-on: ubuntu-latest
outputs:
# Expose matched filters as job 'tags' output variable
tags: ${{ steps.filter.outputs.changes }}
steps:
- uses: actions/checkout@v3
- name: Combine all tags.yml files
id: get_username
run: find . -name "tags.yml" -not -path "./.github/*" -exec cat {} + > .github/tags.yml
- name: debug
run: cat .github/tags.yml
- uses: dorny/paths-filter@v2
id: filter
with:
filters: ".github/tags.yml"
nf-test:
name: nf-test ${{ matrix.tags }} ${{ matrix.profile }}
needs: [changes]
if: needs.changes.outputs.tags != '[]'
runs-on: ubuntu-latest
env:
TOWER_ACCESS_TOKEN: ${{ secrets.TOWER_ACCESS_TOKEN }}
strategy:
fail-fast: false
matrix:
NXF_VER: ["23.10.0"]
pinin4fjords marked this conversation as resolved.
Show resolved Hide resolved
tags: ["${{ fromJson(needs.changes.outputs.tags) }}"]
profile:
- "docker"
- "conda"

steps:
- name: Check out pipeline code
uses: actions/checkout@v3

- name: Install Nextflow
uses: nf-core/setup-nextflow@v1
with:
version: "${{ matrix.NXF_VER }}"

- name: Set up miniconda
uses: conda-incubator/setup-miniconda@v2
with:
miniconda-version: "latest"
auto-update-conda: true
channels: conda-forge,bioconda,defaults
python-version: ${{ matrix.python-version }}

- 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

- name: Cache nf-test installation
id: cache-software
uses: actions/cache@v3
with:
path: |
/usr/local/bin/nf-test
/home/runner/.nf-test/nf-test.jar
key: ${{ runner.os }}-${{ env.NFTEST_VER }}-nftest

- name: Install nf-test
if: steps.cache-software.outputs.cache-hit != 'true'
run: |
wget -qO- https://code.askimed.com/install/nf-test | bash
sudo mv nf-test /usr/local/bin/

- name: Run nf-test
run: |
nf-test test --tag ${{ matrix.tags }} --profile "test,${{ matrix.profile }}" --junitxml=test.xml

- name: Output log on failure
if: failure()
run: |
sudo apt install bat > /dev/null
batcat --decorations=always --color=always ${{ github.workspace }}/.nf-test/tests/*/meta/nextflow.log

- name: Publish Test Report
uses: mikepenz/action-junit-report@v3
if: always() # always run even if the previous step fails
with:
report_paths: test.xml
38 changes: 38 additions & 0 deletions modules/local/seqera_runs_dump/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
nextflow_process {

name "Test Process SEQERA_RUNS_DUMP"
script "../main.nf"
process "SEQERA_RUNS_DUMP"
config "./nextflow.config"

tag "modules"
tag "modules_local"
tag "seqera_runs_dump"

test("Should run without failures") {

when {
process {
"""
input[0] = ['id': '4Bi5xBK6E2Nbhj', 'workspace': 'community/showcase']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to make sure this always exists 😬

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should have a separate workspace to store immortal test runs?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think so - makes sense.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will add to the to-do!

input[1] = "https://api.tower.nf"
"""
}
}

then {
def dumpFiles = file(process.out.run_dump.get(0).get(1)).listFiles().sort()

assertAll(
{ assert snapshot(
dumpFiles.grep { file -> ! file.name.matches("workflow-launch.json") },
process.out.workflow_json
).match()},
{ assert dumpFiles.find { it.name.matches('workflow-launch.json')}.exists()},
{ assert process.success }
)
}

}

}
15 changes: 15 additions & 0 deletions modules/local/seqera_runs_dump/tests/main.nf.test.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"Should run without failures": {
"content": [
[
"service-info.json:md5,0a2624c21efb65b85e37fa3d07903dcc",
"workflow-load.json:md5,4f02d5a24ab89aa648cd4346785c8f2c",
"workflow-metrics.json:md5,70dd1af37145c8c2d23836fe850622e7",
"workflow-tasks.json:md5,577a7472816b7729012a9291d97ff150",
"workflow.json:md5,34db0e39f0246670eac77c7a5e9093c9"
],
null
],
"timestamp": "2023-11-29T13:34:09.5038157"
}
}
1 change: 1 addition & 0 deletions modules/local/seqera_runs_dump/tests/nextflow.config
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
process { withName: 'SEQERA_RUNS_DUMP' { container = 'quay.io/seqeralabs/nf-aggregate:tower-cli-0.9.0--2cb0f2e9d85d026b' } }
2 changes: 2 additions & 0 deletions modules/local/seqera_runs_dump/tests/tags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
seqera_runs_dump:
- modules/local/seqera_runs_dump/**
16 changes: 16 additions & 0 deletions nf-test.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
config {
// location for all nf-tests
testsDir "."

// nf-test directory including temporary files for each test
workDir "/tmp"
pinin4fjords marked this conversation as resolved.
Show resolved Hide resolved

// location of library folder that is added automatically to the classpath
libDir "lib/"

// location of an optional nextflow.config file specific for executing tests
configFile "nextflow.config"

// run all test with the defined docker profile from the main nextflow.config
profile ""
}
5 changes: 5 additions & 0 deletions tests/nextflow.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/*
========================================================================================
Nextflow config file for running tests
========================================================================================
*/