Skip to content

Commit fdd6c71

Browse files
authored
Merge pull request #19 from nipype/task-template-download
moved download of task template into separate job to avoid issues wit…
2 parents af0a278 + c9c0fcf commit fdd6c71

File tree

4 files changed

+46
-5
lines changed

4 files changed

+46
-5
lines changed

.github/workflows/ci-cd.yml

+32-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,27 @@ 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-tasks-template.tar.gz https://github.com/nipype/pydra-tasks-template/archive/refs/tags/$LATEST.tar.gz
25+
tar xzf pydra-tasks-template.tar.gz
26+
rm pydra-tasks-template.tar.gz
27+
mv pydra-tasks-template-${LATEST#v} pydra-tasks-template
28+
tar czf pydra-tasks-template.tar.gz pydra-tasks-template
29+
30+
- uses: actions/upload-artifact@v4
31+
with:
32+
name: tasks-template
33+
path: pydra-tasks-template.tar.gz
34+
1635
test:
36+
needs: [download-task-template]
1737
strategy:
1838
matrix:
1939
os: [macos-latest, ubuntu-latest]
@@ -28,6 +48,15 @@ jobs:
2848
- name: Checkout
2949
uses: actions/checkout@v2
3050

51+
- name: Download the pydra-tasks-template artefact
52+
uses: actions/download-artifact@v4
53+
with:
54+
name: tasks-template
55+
path: .
56+
57+
- name: Extract the pydra-tasks-template
58+
run: tar xzf pydra-tasks-template.tar.gz
59+
3160
- name: Unset header
3261
# checkout@v2 adds a header that makes branch protection report errors
3362
# because the Github action bot is not a collaborator on the repo
@@ -64,7 +93,9 @@ jobs:
6493
run: python3 -m pip install --break-system-packages .[test]
6594

6695
- name: Pytest
67-
run: pytest -vvs --cov nipype2pydra --cov-config .coveragerc --cov-report xml
96+
run: >-
97+
NIPYPE2PYDRA_PYDRA_TASK_TEMPLATE=$PWD/pydra-tasks-template
98+
pytest -vvs --cov nipype2pydra --cov-config .coveragerc --cov-report xml
6899
69100
- name: Upload coverage to Codecov
70101
uses: codecov/codecov-action@v2

conftest.py

+8
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

+3-2
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

+3-2
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)