Skip to content

Commit 91cd4e5

Browse files
committed
moved download of task template into separate job to avoid issues within tests
1 parent af0a278 commit 91cd4e5

File tree

4 files changed

+40
-5
lines changed

4 files changed

+40
-5
lines changed

.github/workflows/ci-cd.yml

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,23 @@ defaults:
1313
shell: bash
1414

1515
jobs:
16+
17+
download-task-template:
18+
runs-on: ubuntu-latest
19+
steps:
20+
21+
- name: Download task template
22+
run: |
23+
LATEST=$(curl -s https://api.github.com/repos/nipype/pydra-tasks-template/releases/latest | grep tag_name | awk -F\" '{print $4}')
24+
curl -Lo pydra-task-template.tar.gz https://github.com/nipype/pydra-tasks-template/archive/refs/tags/$LATEST.tar.gz
25+
tar xzf pydra-task-template.tar.gz
26+
mv pydra-tasks-template-* pydra-tasks-template
27+
28+
- uses: actions/upload-artifact@v4
29+
with:
30+
name: tasks-template
31+
path: pydra-tasks-template
32+
1633
test:
1734
strategy:
1835
matrix:
@@ -28,6 +45,12 @@ jobs:
2845
- name: Checkout
2946
uses: actions/checkout@v2
3047

48+
- name: Download the pydra-tasks-template artefact
49+
uses: actions/download-artifact@v4
50+
with:
51+
name: pydra-tasks-template
52+
path: $HOME/pydra-tasks-template
53+
3154
- name: Unset header
3255
# checkout@v2 adds a header that makes branch protection report errors
3356
# because the Github action bot is not a collaborator on the repo
@@ -64,7 +87,9 @@ jobs:
6487
run: python3 -m pip install --break-system-packages .[test]
6588

6689
- name: Pytest
67-
run: pytest -vvs --cov nipype2pydra --cov-config .coveragerc --cov-report xml
90+
run: >-
91+
NIPYPE2PYDRA_PYDRA_TASK_TEMPLATE=$HOME/pydra-tasks-template
92+
pytest -vvs --cov nipype2pydra --cov-config .coveragerc --cov-report xml
6893
6994
- name: Upload coverage to Codecov
7095
uses: codecov/codecov-action@v2

conftest.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,14 @@ def invoke(*args, catch_exceptions=catch_cli_exceptions, **kwargs):
4040
return invoke
4141

4242

43+
@pytest.fixture
44+
def tasks_template_args():
45+
template = os.environ.get("NIPYPE2PYDRA_PYDRA_TASK_TEMPLATE", None)
46+
if template:
47+
return ["--task-template", template]
48+
return []
49+
50+
4351
# For debugging in IDE's don't catch raised exceptions and let the IDE
4452
# break at it
4553
if os.getenv("_PYTEST_RAISE", "0") != "0":

nipype2pydra/pkg_gen/tests/test_pkg_gen.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def pkg_gen_spec_file(request):
1515
return EXAMPLE_PKG_GEN_DIR.joinpath(*request.param.split("-")).with_suffix(".yaml")
1616

1717

18-
def test_pkg_gen(pkg_gen_spec_file, cli_runner, tmp_path):
18+
def test_pkg_gen(pkg_gen_spec_file, cli_runner, tmp_path, tasks_template_args):
1919
outputs_dir = tmp_path / "output-dir"
2020
outputs_dir.mkdir()
2121

@@ -24,6 +24,7 @@ def test_pkg_gen(pkg_gen_spec_file, cli_runner, tmp_path):
2424
[
2525
str(pkg_gen_spec_file),
2626
str(outputs_dir),
27-
],
27+
]
28+
+ tasks_template_args,
2829
)
2930
assert result.exit_code == 0, show_cli_trace(result)

nipype2pydra/tests/test_package.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def package_spec(request):
3333

3434

3535
@pytest.mark.xfail(reason="Fails due to missing dependencies on PyPI")
36-
def test_package_complete(package_spec, cli_runner, tmp_path):
36+
def test_package_complete(package_spec, cli_runner, tmp_path, tasks_template_args):
3737
pkg_name = package_spec.stem
3838
repo_output = tmp_path / "repo"
3939
repo_output.mkdir()
@@ -43,7 +43,8 @@ def test_package_complete(package_spec, cli_runner, tmp_path):
4343
[
4444
str(package_spec),
4545
str(repo_output),
46-
],
46+
]
47+
+ tasks_template_args,
4748
)
4849
assert result.exit_code == 0, show_cli_trace(result)
4950
pkg_root = repo_output / f"pydra-{pkg_name}"

0 commit comments

Comments
 (0)