Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions .github/workflows/benchmarks_weekly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,6 @@ jobs:
id: setup
run: 'true'

- name: Generate Sophios Validation Jsonschema
if: ${{ !cancelled() && steps.setup.outcome == 'success' }}
run: cd sophios/ && sophios --generate_schemas

- name: Generate Sophios Python API Workflows (*.py -> *.wic)
if: ${{ !cancelled() && steps.setup.outcome == 'success' }}
# Corpus preparation: the corpus cases compile the *.wic files it writes.
Expand Down
39 changes: 28 additions & 11 deletions .github/workflows/lint_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -223,17 +223,6 @@ jobs:
if: ${{ runner.os == 'Linux' && !cancelled() && steps.setup.outcome == 'success' }}
run: cd sophios/ && autopep8 --exit-code --recursive --diff --max-line-length 120 examples/ src/ tests/

- name: Generate Sophios Validation Jsonschema
if: ${{ !cancelled() && steps.setup.outcome == 'success' }}
run: cd sophios/ && sophios --generate_schemas

# Please read docs/validation.md#Property-Based-Testing
# This is essentially an integration test for all of the
# Sophios Python API workflows as well as the Sophios Python API itself.
- name: Validate sophios Python API Workflows (*.py -> *.wic)
if: ${{ !cancelled() && steps.setup.outcome == 'success' && steps.corpus.outcome == 'success' }}
run: cd sophios/ && pytest tests/core/test_python_api_workflow.py -k test_validate_generated_python_workflows

- name: Build Documentation
if: ${{ runner.os == 'Linux' && !cancelled() && steps.setup.outcome == 'success' }}
run: cd sophios/docs && make html
Expand Down Expand Up @@ -352,6 +341,34 @@ jobs:
# Also, cannot run on Windows (natively) yet
run: cd sophios/ && pytest -k test_scattering_scaling

# Pipelines run under the pinned Nextflow: tests/core/nextflow, marked `nextflow`. The corpus
# under Nextflow is Run Workflows'. Nextflow does not run on Windows.
- name: Setup Java for Nextflow
if: ${{ runner.os == 'Linux' && !cancelled() && steps.setup.outcome == 'success' }}
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: "17"

- name: Install pinned Nextflow
if: ${{ runner.os == 'Linux' && !cancelled() && steps.setup.outcome == 'success' }}
env:
NXF_VER: "26.04.2"
run: |
curl --fail --silent --show-error https://get.nextflow.io | bash
install -m 0755 nextflow "${RUNNER_TEMP}/nextflow"
echo "${RUNNER_TEMP}" >> "${GITHUB_PATH}"
NXF_ANSI_LOG=false "${RUNNER_TEMP}/nextflow" -version | grep 'version 26.04.2'

- name: PyTest Nextflow Runtime
if: ${{ runner.os == 'Linux' && !cancelled() && steps.setup.outcome == 'success' }}
timeout-minutes: 20
env:
NXF_ANSI_LOG: "false"
NXF_OFFLINE: "true"
NXF_VER: "26.04.2"
run: cd sophios/ && pytest tests/core/nextflow -m "nextflow and not nextflow_corpus"

# NOTE: The steps below are for repository_dispatch only. For all other steps, please insert above
# this comment.

Expand Down
11 changes: 0 additions & 11 deletions .github/workflows/lint_and_test_macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,17 +117,6 @@ jobs:
# "SC1017 (error): Literal carriage return. Run script through tr -d '\r' ."
run: shellcheck -e SC1017 $(find sophios/ -name "*.sh" -and -not -path "./3/*")

- name: Generate Sophios Validation Jsonschema
if: ${{ !cancelled() && steps.setup.outcome == 'success' }}
run: cd sophios/ && sophios --generate_schemas

# Please read docs/validation.md#Property-Based-Testing
# This is essentially an integration test for all of the
# Sophios Python API workflows as well as the Sophios Python API itself.
- name: Validate Sophios Python API Workflows (*.py -> *.wic)
if: ${{ !cancelled() && steps.setup.outcome == 'success' && steps.corpus.outcome == 'success' }}
run: cd sophios/ && pytest tests/core/test_python_api_workflow.py -k test_validate_generated_python_workflows

- name: Build Documentation
if: ${{ !cancelled() && steps.setup.outcome == 'success' }}
run: cd sophios/docs && make html
Expand Down
50 changes: 0 additions & 50 deletions .github/workflows/nextflow.yml

This file was deleted.

10 changes: 5 additions & 5 deletions .github/workflows/property_weekly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ name: Property Weekly
# Hermetic: every input is generated (workflows over tests/core/synthetic_tools.py),
# so nothing here needs a plugin checkout, a config, a container or the
# self-hosted runner. The nextflow-properties job alone installs Java and the
# pinned Nextflow, as nextflow.yml does, and runs only the runtime properties.
# pinned Nextflow, as Lint And Test does, and runs only the runtime properties.
# It replaces the weekly fuzz job, which sampled an
# environment-dependent schema that no longer exists.
#
Expand Down Expand Up @@ -133,8 +133,8 @@ jobs:
--hypothesis-seed="$HYPOTHESIS_SEED" --junitxml=property-reports/api-runtime.xml

# The Nextflow target's compile-side properties: lowering, the executable
# model, rendering and reading a pipeline back. Runs under Nextflow stay
# in nextflow.yml, which installs it.
# model, rendering and reading a pipeline back. Runs under Nextflow are
# Lint And Test's, which installs it.
- name: PyTest Nextflow Target Properties
if: ${{ !cancelled() && steps.setup.outcome == 'success' }}
timeout-minutes: 30
Expand All @@ -148,8 +148,8 @@ jobs:
path: property-reports/
retention-days: 30

# The runtime properties need Java and the pinned Nextflow. nextflow.yml keeps
# running them at scale 1 on push and pull request.
# The runtime properties need Java and the pinned Nextflow. Lint And Test keeps
# running them at scale 1 on every pull request.
nextflow-properties:
concurrency:
group: ${{ github.workflow }}-nextflow-${{ github.ref }}
Expand Down
39 changes: 3 additions & 36 deletions .github/workflows/run_workflows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -210,17 +210,6 @@ jobs:
if: ${{ !cancelled() && steps.setup.outcome == 'success' }}
run: cd sophios/ && pytest tests/core/test_python_api_workflow.py -k test_compile_python_workflows

- name: Generate Sophios Validation Jsonschema
if: ${{ !cancelled() && steps.setup.outcome == 'success' }}
run: cd sophios/ && sophios --generate_schemas

# Please read docs/validation.md#Property-Based-Testing
# This is essentially an integration test for all of the
# WIC Python API workflows as well as the WIC Python API itself.
- name: Validate Sophios Python API Workflows (*.py -> *.wic)
if: ${{ !cancelled() && steps.setup.outcome == 'success' && steps.corpus.outcome == 'success' }}
run: cd sophios/ && pytest tests/core/test_python_api_workflow.py -k test_validate_generated_python_workflows

- name: cwl-docker-extract (i.e. recursively docker pull)
if: ${{ !cancelled() && steps.setup.outcome == 'success' && steps.corpus.outcome == 'success' }}
# One compile and a round of docker pulls per corpus workflow, mostly
Expand All @@ -235,7 +224,7 @@ jobs:

- name: PyTest Python API
if: ${{ !cancelled() && steps.setup.outcome == 'success' }}
run: cd sophios/ && pytest tests/core/test_python_api_workflow.py -k "not test_compile_python_workflows and not test_validate_generated_python_workflows"
run: cd sophios/ && pytest tests/core/test_python_api_workflow.py -k "not test_compile_python_workflows"

# Workflow.from_wic and write_wic over every .wic root the config reaches.
# Only here does the config reach the mm-workflows and image-workflows
Expand All @@ -245,37 +234,15 @@ jobs:
if: ${{ !cancelled() && steps.setup.outcome == 'success' && steps.corpus.outcome == 'success' }}
run: cd sophios/ && pytest tests/core/test_python_api_from_wic.py

- name: PyTest Run REST Core Tests
if: ${{ !cancelled() && steps.setup.outcome == 'success' }}
# NOTE: Do NOT add coverage to PYPY CI runs https://github.com/tox-dev/tox/issues/2252
run: cd sophios/ && pytest tests/contrib/test_rest_api.py -k test_rest_core --cwl_runner cwltool

- name: PyTest Run REST WFB Tests
- name: PyTest Contrib (REST core and WFB, ICT to CLT, WFB payload)
if: ${{ !cancelled() && steps.setup.outcome == 'success' }}
# NOTE: Do NOT add coverage to PYPY CI runs https://github.com/tox-dev/tox/issues/2252
run: cd sophios/ && pytest tests/contrib/test_rest_api.py -k test_rest_wfb --cwl_runner cwltool

- name: PyTest Run ICT to CLT conversion Tests
if: ${{ !cancelled() && steps.setup.outcome == 'success' }}
# NOTE: Do NOT add coverage to PYPY CI runs https://github.com/tox-dev/tox/issues/2252
run: cd sophios/ && pytest tests/contrib/test_ict_to_clt_conversion.py -k test_ict_to_clt

- name: PyTest Run update wfb payload Tests
if: ${{ !cancelled() && steps.setup.outcome == 'success' }}
run: cd sophios/ && pytest tests/contrib/test_fix_payload.py -k test_fix
run: cd sophios/ && pytest tests/contrib --cwl_runner cwltool

- name: PyTest Run Workflows
if: ${{ !cancelled() && steps.setup.outcome == 'success' && steps.corpus.outcome == 'success' }}
run: cd sophios/ && pytest tests/core/test_examples.py -k test_run_workflows_on_push --workers "${PYTEST_WORKERS}" --cwl_runner cwltool --durations=0 # --cov

# test_run_partial_failures_pass is skip_pypi_ci, so the packaging lane
# excludes it, and every other invocation of this file selects a different
# -k — it ran nowhere. Its sibling test_run_partial_failures_fail_without_flag
# carries no marker and is already covered by default collection.
- name: PyTest Run Partial Failures
if: ${{ !cancelled() && steps.setup.outcome == 'success' }}
run: cd sophios/ && pytest tests/core/test_examples.py -k test_run_partial_failures_pass --cwl_runner cwltool

# The corpus workflows the Nextflow target supports, compiled with it and
# run under Nextflow with Docker: tests/core/nextflow/test_corpus.py. The
# steps above run them under cwltool, which never reaches the Nextflow
Expand Down
11 changes: 0 additions & 11 deletions .github/workflows/run_workflows_weekly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -176,17 +176,6 @@ jobs:
if: ${{ !cancelled() && steps.setup.outcome == 'success' }}
run: cd sophios/ && pytest tests/core/test_python_api_workflow.py -k test_compile_python_workflows

- name: Generate Sophios Validation Jsonschema
if: ${{ !cancelled() && steps.setup.outcome == 'success' }}
run: cd sophios/ && sophios --generate_schemas

# Please read docs/validation.md#Property-Based-Testing
# This is essentially an integration test for all of the
# Sophios Python API workflows as well as the WIC Python API itself.
- name: Validate Sophios Python API Workflows (*.py -> *.wic)
if: ${{ !cancelled() && steps.setup.outcome == 'success' && steps.corpus.outcome == 'success' }}
run: cd sophios/ && pytest tests/core/test_python_api_workflow.py -k test_validate_generated_python_workflows

- name: PyTest Tool Builder
if: ${{ !cancelled() && steps.setup.outcome == 'success' }}
run: cd sophios/ && pytest tests/core/test_python_api_tool_builder.py
Expand Down
2 changes: 1 addition & 1 deletion install/system_deps_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ dependencies:
- cryptography
- zstandard
# Run Workflows runs the corpus under Nextflow on a push, with the Nextflow and
# the Java the Nextflow lane pins (NXF_VER and java-version in nextflow.yml).
# the Java Lint And Test pins for its Nextflow runtime tests (NXF_VER and java-version).
# The package runs its own jar, so nothing it needs lives outside this
# environment.
- nextflow=26.04.2
Expand Down
17 changes: 4 additions & 13 deletions tests/core/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,13 @@ def _artifacts(root: CompilationArtifact) -> list[CompilationArtifact]:

@pytest.mark.skip_pypi_ci
@pytest.mark.slow
@pytest.mark.parametrize("yml_path_str, yml_path", yml_paths_tuples_on_push)
@pytest.mark.parametrize("yml_path_str, yml_path", yml_paths_tuples_on_push + yml_paths_partial_failure)
def test_run_workflows_on_push(yml_path_str: str, yml_path: Path, cwl_runner: str,
corpus_registry: CorpusRegistry) -> None:
"""Runs every workflow auto-discovered from the directories in 'search_paths_wic',
except the fragments, intensive workflows and partial failures that the
config_ci.json files list."""
args = get_args(str(yml_path))
except the fragments and intensive workflows that the config_ci.json files list;
those listed as partial failures run with --partial_failure_enable."""
args = get_args(str(yml_path), ['--partial_failure_enable'] if yml_path_str in run_partial_failures else [])
run_workflows(yml_path_str, yml_path, cwl_runner, args, corpus_registry)


Expand Down Expand Up @@ -177,15 +177,6 @@ def compiled(flags: list[str]) -> list[tuple[Any, ...]]:


# partial failure tests
@pytest.mark.skip_pypi_ci
@pytest.mark.parametrize("yml_path_str, yml_path", yml_paths_partial_failure)
def test_run_partial_failures_pass(yml_path_str: str, yml_path: Path, cwl_runner: str,
corpus_registry: CorpusRegistry) -> None:
"""Run workflows allowing partial failures. yml files of workflows which are known to have failure steps"""
args = get_args(str(yml_path), ['--partial_failure_enable'])
run_workflows(yml_path_str, yml_path, cwl_runner, args, corpus_registry)


@pytest.mark.parametrize("yml_path_str, yml_path", yml_paths_partial_failure)
def test_run_partial_failures_fail_without_flag(yml_path_str: str, yml_path: Path, cwl_runner: str,
corpus_registry: CorpusRegistry) -> None:
Expand Down
45 changes: 0 additions & 45 deletions tests/core/test_python_api_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
from unittest.mock import Mock, patch

from hypothesis import example, given, strategies as st
from jsonschema import Draft202012Validator
import pytest
import yaml

Expand All @@ -33,7 +32,6 @@
from sophios.api.python.workflow import (_python_api_types_match, InvalidInputValueError, InvalidLinkError,
InvalidStepError, RunResult, RunState, RunStatus, SophiosError,
SophiosErrorCode, Step, StepInput, Workflow, WorkflowRunError)
from sophios.lang import parse, to_json, wic_schema
from sophios.python_cwl_adapter import import_python_file
from sophios.wic_types import Json, Tools

Expand All @@ -46,10 +44,6 @@
from .wic_reading import read_wic


AUTOGENERATED_DIR = REPO_ROOT / "autogenerated"
PYTHON_WORKFLOW_MANIFEST = AUTOGENERATED_DIR / "python_workflow_manifest.json"


def _written(workflow: Workflow, directory: Path, name: str | None = None) -> dict[str, Any]:
"""The document `write_wic` writes for `workflow` (or its nested workflow `name`), as `parse` reads it."""
root = workflow.write_wic(directory)
Expand Down Expand Up @@ -132,14 +126,6 @@ def step_factory(*args: Any, **kwargs: Any) -> Any:
yield


def _write_manifest(workflow_paths: list[Path]) -> None:
"""Record the generated `.wic` paths for the validation step that follows."""
AUTOGENERATED_DIR.mkdir(parents=True, exist_ok=True)
manifest = sorted({str(path) for path in workflow_paths})
PYTHON_WORKFLOW_MANIFEST.write_text(
json.dumps(manifest, indent=2), encoding="utf-8")


PAIRS = Path(__file__).resolve().parent / "data" / "python_api_pairs"
_PAIRED = import_python_file("python_api_pairs", PAIRS / "pairs.py")
#: Each pair's notes, written by hand from the inference rule: the nearest step's output, the others that fit counted.
Expand Down Expand Up @@ -730,7 +716,6 @@ def test_compile_python_workflows() -> None:
tools_cwl = sophios.plugins.get_tools_cwl(global_config)
paths_tuples = _iter_python_workflow_paths(global_config)
import_errors: list[str] = []
generated_workflows: list[Path] = []
for path_stem, path in paths_tuples:
try:
with _step_registry_injected(tools_cwl):
Expand All @@ -739,8 +724,6 @@ def test_compile_python_workflows() -> None:

retval.compile()
retval.write_wic(path.parent)
generated_workflows.extend(
path.parent / f"{wf.process_name}.wic" for wf in retval._flatten_subworkflows())

config_ci = path.parent / "config_ci.json"
json_contents = {}
Expand All @@ -761,34 +744,6 @@ def test_compile_python_workflows() -> None:
if import_errors:
pytest.fail("Python workflow imports failed:\n" +
"\n".join(import_errors))
_write_manifest(generated_workflows)


@pytest.mark.fast
def test_validate_generated_python_workflows() -> None:
"""Every `.wic` the discovery step generated parses clean and validates
against the exported schema."""
if not PYTHON_WORKFLOW_MANIFEST.exists():
pytest.fail(
f"Missing generated workflow manifest: {PYTHON_WORKFLOW_MANIFEST}")

validator = Draft202012Validator(wic_schema())
workflow_paths = json.loads(
PYTHON_WORKFLOW_MANIFEST.read_text(encoding="utf-8"))
validation_errors: list[str] = []
for workflow_path_str in workflow_paths:
workflow_path = Path(workflow_path_str)
parsed = parse(workflow_path.read_text(encoding="utf-8"), workflow_path.name)
if not parsed.ok or parsed.document is None:
validation_errors.extend(str(d) for d in parsed.diagnostics)
continue
validation_errors.extend(
f"{workflow_path}: {error.message}"
for error in validator.iter_errors(to_json(parsed.document)))

if validation_errors:
pytest.fail("Generated workflow validation failed:\n" +
"\n".join(validation_errors))


def _detach_run_from_the_container_engine(monkeypatch: pytest.MonkeyPatch) -> None:
Expand Down
Loading