diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..520a4ae --- /dev/null +++ b/.github/workflows/ci.yaml @@ -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 diff --git a/ingest/build-configs/ci/config.yaml b/ingest/build-configs/ci/config.yaml new file mode 100644 index 0000000..ab6a2cb --- /dev/null +++ b/ingest/build-configs/ci/config.yaml @@ -0,0 +1,2 @@ +custom_rules: + - build-configs/ci/copy_example_data.smk diff --git a/ingest/build-configs/ci/copy_example_data.smk b/ingest/build-configs/ci/copy_example_data.smk new file mode 100644 index 0000000..c013789 --- /dev/null +++ b/ingest/build-configs/ci/copy_example_data.smk @@ -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 diff --git a/phylogenetic/Snakefile b/phylogenetic/Snakefile index 4e2fcdc..16d5a29 100644 --- a/phylogenetic/Snakefile +++ b/phylogenetic/Snakefile @@ -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 diff --git a/phylogenetic/build-configs/ci/config.yaml b/phylogenetic/build-configs/ci/config.yaml index 578bd58..ab6a2cb 100644 --- a/phylogenetic/build-configs/ci/config.yaml +++ b/phylogenetic/build-configs/ci/config.yaml @@ -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 diff --git a/phylogenetic/build-configs/ci/copy_example_data.smk b/phylogenetic/build-configs/ci/copy_example_data.smk index c18a6c3..572223b 100644 --- a/phylogenetic/build-configs/ci/copy_example_data.smk +++ b/phylogenetic/build-configs/ci/copy_example_data.smk @@ -1,10 +1,10 @@ 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} @@ -12,7 +12,5 @@ rule copy_example_data: """ -# 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