diff --git a/.github/workflows/benchmarks_weekly.yml b/.github/workflows/benchmarks_weekly.yml index 532621f53..4cd328ae5 100644 --- a/.github/workflows/benchmarks_weekly.yml +++ b/.github/workflows/benchmarks_weekly.yml @@ -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. diff --git a/.github/workflows/lint_and_test.yml b/.github/workflows/lint_and_test.yml index fc391bad2..cdf242774 100644 --- a/.github/workflows/lint_and_test.yml +++ b/.github/workflows/lint_and_test.yml @@ -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 @@ -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. diff --git a/.github/workflows/lint_and_test_macos.yml b/.github/workflows/lint_and_test_macos.yml index 16b5e8c95..9d40524b9 100644 --- a/.github/workflows/lint_and_test_macos.yml +++ b/.github/workflows/lint_and_test_macos.yml @@ -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 diff --git a/.github/workflows/nextflow.yml b/.github/workflows/nextflow.yml deleted file mode 100644 index 1b64836f6..000000000 --- a/.github/workflows/nextflow.yml +++ /dev/null @@ -1,50 +0,0 @@ -name: Nextflow Backend - -on: - push: - pull_request: - -permissions: - contents: read - -jobs: - nextflow-runtime: - runs-on: ubuntu-latest - timeout-minutes: 20 - env: - NXF_ANSI_LOG: "false" - NXF_OFFLINE: "true" - NXF_VER: "26.04.2" - - steps: - - uses: actions/checkout@v5 - - - uses: actions/setup-python@v6 - with: - python-version: "3.12" - - - uses: actions/setup-java@v5 - with: - distribution: temurin - java-version: "17" - - - name: Install Sophios test dependencies - run: python -m pip install --upgrade pip && python -m pip install '.[test]' - - - name: Install pinned Nextflow - run: | - curl --fail --silent --show-error https://get.nextflow.io | bash - install -m 0755 nextflow "${RUNNER_TEMP}/nextflow" - echo "${RUNNER_TEMP}" >> "${GITHUB_PATH}" - - - name: Verify pinned runtime - run: nextflow -version | grep 'version 26.04.2' - - - name: Run Nextflow conformance tests - run: python -m pytest tests/core/nextflow -m 'nextflow and not docker' -q - - - name: Run Docker conformance - run: python -m pytest tests/core/nextflow -m 'docker and not nextflow_corpus' -q - - - name: Run the Python 3.12 compatibility suite - run: python -m pytest tests/core/nextflow -m 'not nextflow and not docker' -q diff --git a/.github/workflows/property_weekly.yml b/.github/workflows/property_weekly.yml index 808c3686d..00991e8bc 100644 --- a/.github/workflows/property_weekly.yml +++ b/.github/workflows/property_weekly.yml @@ -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. # @@ -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 @@ -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 }} diff --git a/.github/workflows/run_workflows.yml b/.github/workflows/run_workflows.yml index fe7bb8652..6e3a37642 100644 --- a/.github/workflows/run_workflows.yml +++ b/.github/workflows/run_workflows.yml @@ -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 @@ -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 @@ -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 diff --git a/.github/workflows/run_workflows_weekly.yml b/.github/workflows/run_workflows_weekly.yml index b790607cb..1428207fe 100644 --- a/.github/workflows/run_workflows_weekly.yml +++ b/.github/workflows/run_workflows_weekly.yml @@ -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 diff --git a/install/system_deps_ci.yml b/install/system_deps_ci.yml index eb8b40634..a04dd431a 100644 --- a/install/system_deps_ci.yml +++ b/install/system_deps_ci.yml @@ -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 diff --git a/tests/core/test_examples.py b/tests/core/test_examples.py index c10c8d636..87ce9dc46 100644 --- a/tests/core/test_examples.py +++ b/tests/core/test_examples.py @@ -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) @@ -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: diff --git a/tests/core/test_python_api_workflow.py b/tests/core/test_python_api_workflow.py index d8120f534..de746d412 100644 --- a/tests/core/test_python_api_workflow.py +++ b/tests/core/test_python_api_workflow.py @@ -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 @@ -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 @@ -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) @@ -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. @@ -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): @@ -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 = {} @@ -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: