Skip to content

Commit

Permalink
Add CI workflow and configs for ingest and phylogeny workflows [#2]
Browse files Browse the repository at this point in the history
Also add custom rule import bits to phylogenetic/Snakefile
  • Loading branch information
genehack committed Nov 26, 2024
1 parent bc41b40 commit bbd653e
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 13 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: CI

on:
push:
branches:
- main
pull_request:
workflow_dispatch:

jobs:
ci:
uses: nextstrain/.github/.github/workflows/pathogen-repo-ci.yaml@master
2 changes: 2 additions & 0 deletions ingest/build-configs/ci/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
custom_rules:
- build-configs/ci/copy_example_data.smk
12 changes: 12 additions & 0 deletions ingest/build-configs/ci/copy_example_data.smk
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
rule copy_example_data:
input:
ncbi_dataset="example-data/ncbi_dataset.zip"
output:
ncbi_dataset=temp("data/ncbi_dataset.zip")
shell:
"""
cp -f {input.ncbi_dataset} {output.ncbi_dataset}
"""

# force this rule over NCBI data fetch
ruleorder: copy_example_data > fetch_ncbi_dataset_package
5 changes: 5 additions & 0 deletions phylogenetic/Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,8 @@ rule clean:
"""
rm -rfv {params.targets}
"""

# Import custom rules provided via the config.
if "custom_rules" in config:
for rule_file in config["custom_rules"]:
include: rule_file
5 changes: 0 additions & 5 deletions phylogenetic/build-configs/ci/config.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,2 @@
# This configuration file contains the custom configurations
# parameters for the CI workflow to run with the example data.

# Custom rules to run as part of the CI automated workflow. The paths
# should be relative to the phylogenetic directory.
custom_rules:
- build-configs/ci/copy_example_data.smk
14 changes: 6 additions & 8 deletions phylogenetic/build-configs/ci/copy_example_data.smk
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
rule copy_example_data:
input:
sequences="example_data/sequences.fasta",
metadata="example_data/metadata.tsv",
sequences="example-data/sequences.fasta.zst",
metadata="example-data/metadata.tsv.zst",
output:
sequences="data/sequences.fasta",
metadata="data/metadata.tsv",
sequences=temp("data/sequences.fasta.zst"),
metadata=temp("data/metadata.tsv.zst"),
shell:
"""
cp -f {input.sequences} {output.sequences}
cp -f {input.metadata} {output.metadata}
"""


# Add a Snakemake ruleorder directive here if you need to resolve
# ambiguous rules that have the same output as the copy_example_data
# rule.
# ruleorder: copy_example_data > ...
# force this rule over downloading from nextstrain
ruleorder: copy_example_data > download

0 comments on commit bbd653e

Please sign in to comment.