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

Replace tags strategy with implicit 'tags in test' strategy #253

Merged
merged 22 commits into from
Jan 29, 2024

Conversation

adamrtalbot
Copy link
Contributor

@adamrtalbot adamrtalbot commented Jan 18, 2024

Using implicit tags

Replacement strategy to replace tags with tags present in nf-test files.

Subject to change, expect the unexpected.

Changes:

  • Replaces tags strategy to use implict tags based on process/workflow names
  • Removes all tags.yml files
  • Replaces CI test with one that runs nf-test list --tags on any directory with a changed file to find all tags associated with changes
    • additional tags are supplied in the files_yaml block of the action
  • Uses tag as matrix input for tests
  • Pipeline level tests occur by using tests/ directory with nf-test list --tags.

To do:

PR checklist

  • This comment contains a description of changes (with reason).
  • If you've fixed a bug or added code that should be tested, add tests!
  • If you've added a new tool - have you followed the pipeline conventions in the contribution docs
  • If necessary, also make a PR on the nf-core/fetchngs branch on the nf-core/test-datasets repository.
  • Make sure your code lints (nf-core lint).
  • Ensure the test suite passes (nextflow run . -profile test,docker --outdir <OUTDIR>).
  • Check for unexpected warnings in debug mode (nextflow run . -profile debug,test,docker --outdir <OUTDIR>).
  • Usage Documentation in docs/usage.md is updated.
  • Output Documentation in docs/output.md is updated.
  • CHANGELOG.md is updated.
  • README.md is updated (including new tool citations and authors/contributors).

Changes:
 - All modules, subworkflows and workflows include their own name as a tag
 - All subworkflows and workflows include their dependencies as a tag
 - By detecting tags with `nf-test list --tags` we can extract all tags
 - Should be able to flag changed modules and dependent workflows without using a tags.yml file
Copy link

github-actions bot commented Jan 18, 2024

nf-core lint overall result: Passed ✅ ⚠️

Posted for pipeline commit cb4f0e6

+| ✅ 134 tests passed       |+
#| ❔  14 tests were ignored |#
!| ❗   6 tests had warnings |!

❗ Test warnings:

  • files_exist - File not found: assets/multiqc_config.yml
  • files_exist - File not found: conf/igenomes.config
  • files_exist - File not found: .github/workflows/awstest.yml
  • files_exist - File not found: .github/workflows/awsfulltest.yml
  • files_exist - File not found: lib/WorkflowFetchngs.groovy
  • pipeline_todos - TODO string in methods_description_template.yml: #Update the HTML below to your preferred methods description, e.g. add publication citation for this pipeline

❔ Tests ignored:

  • files_exist - File is ignored: conf/modules.config
  • files_exist - File is ignored: lib/NfcoreTemplate.groovy
  • files_exist - File is ignored: lib/Utils.groovy
  • files_exist - File is ignored: lib/WorkflowMain.groovy
  • files_exist - File is ignored: lib/nfcore_external_java_deps.jar
  • files_unchanged - File ignored due to lint config: assets/email_template.html
  • files_unchanged - File ignored due to lint config: assets/email_template.txt
  • files_unchanged - File ignored due to lint config: assets/sendmail_template.txt
  • files_unchanged - File does not exist: lib/nfcore_external_java_deps.jar
  • files_unchanged - File does not exist: lib/NfcoreTemplate.groovy
  • files_unchanged - File ignored due to lint config: .gitignore or .prettierignore or pyproject.toml
  • actions_ci - actions_ci
  • actions_awstest - 'awstest.yml' workflow not found: /home/runner/work/fetchngs/fetchngs/.github/workflows/awstest.yml
  • multiqc_config - 'assets/multiqc_config.yml' not found

✅ Tests passed:

Run details

  • nf-core/tools version 2.11.1
  • Run at 2024-01-26 18:21:58

tests/main.nf.test Outdated Show resolved Hide resolved
Comment on lines 7 to 8
tag "UNTAR"
tag "SRATOOLS_FASTERQDUMP"
Copy link
Member

Choose a reason for hiding this comment

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

I'll put the thing we're actually testing first, and then a break line, and then the dependency

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done now. The format is:

thing "NAME"
tag "NAME"

tag "DEPENDENCY"

tests/main.nf.test Outdated Show resolved Hide resolved
Comment on lines +12 to +16
tag "MULTIQC_MAPPINGS_CONFIG"
tag "SRA_FASTQ_FTP"
tag "SRA_IDS_TO_RUNINFO"
tag "SRA_RUNINFO_TO_FTP"
tag "SRA_TO_SAMPLESHEET"
Copy link
Member

Choose a reason for hiding this comment

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

Hmmm...we have to be explicit with all of the workflow dependencies here now?

Copy link
Member

Choose a reason for hiding this comment

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

Could be quite easy to lose track of these as you update the pipeline / workflow....

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes we do. Not ideal, but hard to do automatically. See askimed/nf-test#179 for relevant ticket.

Copy link
Member

Choose a reason for hiding this comment

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

I had exactly the same thought as Harshil, don't think people will be very good at keeping these lists up to date. But I see the difficulties.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No magic bullet so far. I've proposed automatically testing dependencies, but I also think nf-test can only go so far and it might just have to be the resposibility of the pipeline developer.

@drpatelh
Copy link
Member

Awesome work @adamrtalbot ! 🤩 Few minor niggles I think we should discuss tomorrow.

Comment on lines +64 to +74
files_yaml: |
".":
- .github/workflows/**
- nf-test.config
- nextflow.config
tests:
- assets/*
- bin/*
- conf/*
- main.nf
- nextflow_schema.json
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@maxulysse shall we put this in a separate file?

Copy link
Member

Choose a reason for hiding this comment

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

I'm sorry I don't understand what you meant by that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

These are supplementary existing tags. We can move this to a separate YAML, e.g. .github/test_paths.yml like we have tags now.

Copy link
Member

Choose a reason for hiding this comment

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

Oh I see

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Further discussion - general consensus was it's all in one place if we leave it here. We can move it out later if we need to.

@adamrtalbot
Copy link
Contributor Author

See https://github.com/adamrtalbot/fetchngs/pulls?q=is%3Aopen+is%3Apr+label%3Atags for example PRs including these changes. Feel free to suggest or create more!

@adamrtalbot adamrtalbot marked this pull request as ready for review January 22, 2024 13:11
@adamrtalbot
Copy link
Contributor Author

@pinin4fjords could you take a look with fresh eyes? I can talk you through it but I'd like someone coming in blind.

@adamrtalbot adamrtalbot changed the title WIP: Replace tags strategy Replace tags strategy Jan 22, 2024
@adamrtalbot adamrtalbot changed the title Replace tags strategy Replace tags strategy with implicit 'tags in test' strategy Jan 22, 2024
Replace Nextflow versioning with simple list matrix
tag "pipeline_fetchngs"
tag "PIPELINE"

tag "SRA"
Copy link
Member

Choose a reason for hiding this comment

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

why the SRA tag here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's the immediate dependency of the pipeline. Perhaps we just run pipeline level tests at this point?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK I've removed it now. It will not test the workflow tests when we launch pipeline level tests anymore.

We can put it back if that behaviour feels weird.

tag "sra_default_parameters"


// Subworkflows
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// Subworkflows
// Workflow

This one is a "workflow"

// Subworkflows
tag "SRA"

// Modules
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// Modules
// Dependencies

I'd rather we be explicit there and say dependencies, as any at this level "workflow" can contain modules and/or subworkflows

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea.

Copy link
Member

@pinin4fjords pinin4fjords left a comment

Choose a reason for hiding this comment

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

Makes sense- just using tags for changed files to drive the tests in the CI, right?

It's just a shame we can't automatically infer workflows/ subworkflows for changed modules, keeping those lists up to date worries me as well.

tag "modules_local"
tag "multiqc_mappings_config"

tag "MULTIQC_MAPPINGS_CONFIG"
Copy link
Member

Choose a reason for hiding this comment

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

Not for this PR- but if tag is becoming redundant with the process maybe we should talk to the nf-test folks about allowing nf-test to list processes/ workflows rather than tags?

Copy link
Member

Choose a reason for hiding this comment

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

I think it's similar to what @adamrtalbot meant when creating this issue: askimed/nf-test#178

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Correct, I've suggested it as a feature. This was the behaviour in pytest-workflow as well.

Copy link
Member

Choose a reason for hiding this comment

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

Gotcha, sorry for the slow uptake

Comment on lines +12 to +16
tag "MULTIQC_MAPPINGS_CONFIG"
tag "SRA_FASTQ_FTP"
tag "SRA_IDS_TO_RUNINFO"
tag "SRA_RUNINFO_TO_FTP"
tag "SRA_TO_SAMPLESHEET"
Copy link
Member

Choose a reason for hiding this comment

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

I had exactly the same thought as Harshil, don't think people will be very good at keeping these lists up to date. But I see the difficulties.

tag "modules_nfcore"
tag "custom"
tag "custom/sratoolsncbisettings"

Copy link
Member

Choose a reason for hiding this comment

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

Changes in nf-core things will be patches, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep. Will need a patch.

tag 'subworkflows'
tag 'utils_nfcore_fetchngs_pipeline'
tag 'subworkflows/utils_nfcore_fetchngs_pipeline'
tag "UTILS_NFCORE_FETCHNGS_PIPELINE"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@maxulysse is this the right tag? Too late on a Friday to confirm. Please check on Monday 😆

Copy link
Member

Choose a reason for hiding this comment

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

yes

Copy link
Member

@drpatelh drpatelh left a comment

Choose a reason for hiding this comment

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

Best nf-test CI contribution since slided bread! 🤩

@drpatelh drpatelh merged commit 8d3a0c5 into nf-core:dev Jan 29, 2024
40 checks passed
adamrtalbot added a commit that referenced this pull request Jan 29, 2024
@adamrtalbot adamrtalbot mentioned this pull request Jan 29, 2024
10 tasks
@edmundmiller edmundmiller mentioned this pull request Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants