Skip to content

Commit 57f5a16

Browse files
Save integration logs in standard location (#27)
* Save integration logs during CI tests --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 52e70c3 commit 57f5a16

File tree

5 files changed

+28
-11
lines changed

5 files changed

+28
-11
lines changed

.github/workflows/template-pr-ci.yml

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,24 @@ jobs:
1414
python-version: ["3.12"]
1515
steps:
1616
- uses: actions/checkout@v4
17-
- name: setup-pixi
17+
- name: Setup pixi
1818
uses: prefix-dev/[email protected]
19-
- name: Run tests
20-
run: pixi run pytest tests/clio_test.py
21-
- name: Run linting
19+
- name: Run integration tests
20+
id: tests
21+
run: pixi run test-integration
22+
continue-on-error: true
23+
- name: Run snakemake linting
24+
id: linting
2225
run: pixi run snakemake --lint
26+
continue-on-error: true
27+
- name: Save integration logs
28+
if: ${{ always() }}
29+
uses: actions/upload-artifact@v4
30+
with:
31+
name: integration-test-logs-${{ matrix.os }}
32+
path: tests/integration/results/integration_test/logs
33+
if-no-files-found: ignore
34+
retention-days: 30
35+
- name: Fail if integration or linting failed
36+
if: ${{ steps.tests.outcome == 'failure' || steps.linting.outcome == 'failure' }}
37+
run: exit 1

template/README.md.jinja

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pixi install --all
2323
For testing, simply run:
2424

2525
```shell
26-
pixi run test
26+
pixi run test-integration
2727
```
2828

2929
To view the documentation locally, use:
@@ -37,5 +37,5 @@ To test a minimal example of a workflow using this module:
3737
```shell
3838
pixi shell # activate this project's environment
3939
cd tests/integration/ # navigate to the integration example
40-
snakemake --use-conda # run the workflow!
40+
snakemake --use-conda --cores 2 # run the workflow!
4141
```

template/pixi.toml.jinja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ snakefmt = ">=0.10.2"
2121
snakemake-minimal = ">=8.29.0"
2222

2323
[tasks]
24-
test = {cmd = "pytest tests/"}
24+
test-integration = {cmd = "pytest tests/clio_test.py"}
2525

2626
[feature.docs.dependencies]
2727
mkdocs-material = ">=9.6.7"

template/tests/integration/{% if true %}Snakefile{% endif %}.jinja

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ configfile: workflow.source_path("./test_config.yaml")
55
rule create_external_input:
66
message: "Example of a rule external to your module."
77
output:
8-
text_file = "results/{{module_short_name}}/resources/user/user_message.md"
8+
text_file = "results/integration_test/resources/user/user_message.md"
99
run:
1010
from pathlib import Path
1111
from textwrap import dedent
@@ -23,7 +23,7 @@ rule create_external_input:
2323
module {{module_short_name}}:
2424
snakefile: "../../workflow/Snakefile"
2525
config: config["{{module_short_name}}"]
26-
prefix: "results/{{module_short_name}}/"
26+
prefix: "results/integration_test/"
2727

2828
# rename all module rules with a prefix, to avoid naming conflicts.
2929
use rule * from {{module_short_name}} as {{module_short_name}}_*
@@ -33,4 +33,4 @@ rule all:
3333
message: "A generic test case for your module."
3434
default_target: True
3535
input:
36-
"results/{{module_short_name}}/results/combined_text.md"
36+
"results/integration_test/results/combined_text.md"

tests/template_test.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ def test_mkdocs_build(pixi_built):
4242

4343
def test_pytest(pixi_built):
4444
"""The template's tests should pass by default."""
45-
assert subprocess.run("pixi run test", shell=True, check=True, cwd=pixi_built)
45+
assert subprocess.run(
46+
"pixi run test-integration", shell=True, check=True, cwd=pixi_built
47+
)
4648

4749

4850
def test_linting(pixi_built):

0 commit comments

Comments
 (0)