Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

moved download of task template into separate job to avoid issues wit… #19

Merged
merged 13 commits into from
May 17, 2024
33 changes: 32 additions & 1 deletion .github/workflows/ci-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,27 @@ defaults:
shell: bash

jobs:

download-task-template:
runs-on: ubuntu-latest
steps:

- name: Download task template
run: |
LATEST=$(curl -s https://api.github.com/repos/nipype/pydra-tasks-template/releases/latest | grep tag_name | awk -F\" '{print $4}')
curl -Lo pydra-tasks-template.tar.gz https://github.com/nipype/pydra-tasks-template/archive/refs/tags/$LATEST.tar.gz
tar xzf pydra-tasks-template.tar.gz
rm pydra-tasks-template.tar.gz
mv pydra-tasks-template-${LATEST#v} pydra-tasks-template
tar czf pydra-tasks-template.tar.gz pydra-tasks-template

- uses: actions/upload-artifact@v4
with:
name: tasks-template
path: pydra-tasks-template.tar.gz

test:
needs: [download-task-template]
strategy:
matrix:
os: [macos-latest, ubuntu-latest]
Expand All @@ -28,6 +48,15 @@ jobs:
- name: Checkout
uses: actions/checkout@v2

- name: Download the pydra-tasks-template artefact
uses: actions/download-artifact@v4
with:
name: tasks-template
path: .

- name: Extract the pydra-tasks-template
run: tar xzf pydra-tasks-template.tar.gz

- name: Unset header
# checkout@v2 adds a header that makes branch protection report errors
# because the Github action bot is not a collaborator on the repo
Expand Down Expand Up @@ -64,7 +93,9 @@ jobs:
run: python3 -m pip install --break-system-packages .[test]

- name: Pytest
run: pytest -vvs --cov nipype2pydra --cov-config .coveragerc --cov-report xml
run: >-
NIPYPE2PYDRA_PYDRA_TASK_TEMPLATE=$PWD/pydra-tasks-template
pytest -vvs --cov nipype2pydra --cov-config .coveragerc --cov-report xml

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
Expand Down
8 changes: 8 additions & 0 deletions conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ def invoke(*args, catch_exceptions=catch_cli_exceptions, **kwargs):
return invoke


@pytest.fixture
def tasks_template_args():
template = os.environ.get("NIPYPE2PYDRA_PYDRA_TASK_TEMPLATE", None)
if template:
return ["--task-template", template]
return []


# For debugging in IDE's don't catch raised exceptions and let the IDE
# break at it
if os.getenv("_PYTEST_RAISE", "0") != "0":
Expand Down
5 changes: 3 additions & 2 deletions nipype2pydra/pkg_gen/tests/test_pkg_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def pkg_gen_spec_file(request):
return EXAMPLE_PKG_GEN_DIR.joinpath(*request.param.split("-")).with_suffix(".yaml")


def test_pkg_gen(pkg_gen_spec_file, cli_runner, tmp_path):
def test_pkg_gen(pkg_gen_spec_file, cli_runner, tmp_path, tasks_template_args):
outputs_dir = tmp_path / "output-dir"
outputs_dir.mkdir()

Expand All @@ -24,6 +24,7 @@ def test_pkg_gen(pkg_gen_spec_file, cli_runner, tmp_path):
[
str(pkg_gen_spec_file),
str(outputs_dir),
],
]
+ tasks_template_args,
)
assert result.exit_code == 0, show_cli_trace(result)
5 changes: 3 additions & 2 deletions nipype2pydra/tests/test_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def package_spec(request):


@pytest.mark.xfail(reason="Fails due to missing dependencies on PyPI")
def test_package_complete(package_spec, cli_runner, tmp_path):
def test_package_complete(package_spec, cli_runner, tmp_path, tasks_template_args):
pkg_name = package_spec.stem
repo_output = tmp_path / "repo"
repo_output.mkdir()
Expand All @@ -43,7 +43,8 @@ def test_package_complete(package_spec, cli_runner, tmp_path):
[
str(package_spec),
str(repo_output),
],
]
+ tasks_template_args,
)
assert result.exit_code == 0, show_cli_trace(result)
pkg_root = repo_output / f"pydra-{pkg_name}"
Expand Down
Loading