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

Review tests of external-package JSON-Schema generation #796

Closed
tcompa opened this issue Jul 16, 2024 · 1 comment · Fixed by #793
Closed

Review tests of external-package JSON-Schema generation #796

tcompa opened this issue Jul 16, 2024 · 1 comment · Fixed by #793

Comments

@tcompa
Copy link
Collaborator

tcompa commented Jul 16, 2024

We should review #763 (ref #757).

The current GHA is somewhat useful, but it does not fulfill its stated goal.

Current behavior: re-run manifest creation with the fractal-tasks-core version specified within the package
Expected behavior: run manifest creation with the fractal-tasks-core version from the current git branch (e.g. from a PR)

@tcompa
Copy link
Collaborator Author

tcompa commented Jul 22, 2024

We are fixing this as part of #793, with a workaround (see full diff below)

  1. Install the external package
  2. Get the current version of fractal-tasks-core (from git), and run python -m pip install -e ./fractal-tasks-core

We cannot have a perfectly clean workflow here, because an external package should depend on some specific released versions of fractal-tasks-core, and never on a development git branch.

This strategy works, overall, but it can obviously introduce false positive where the errors are due to different-version features rather than to manifest issues.


diff --git a/.github/workflows/manifest_external_packages.yml b/.github/workflows/manifest_external_packages.yml
index e4a471d7..d3b26c56 100644
--- a/.github/workflows/manifest_external_packages.yml
+++ b/.github/workflows/manifest_external_packages.yml
@@ -23,36 +23,46 @@ jobs:
 
         package: [skip]
         github_repo: [skip]
+        github_branch: [skip]
         manifest_path: [skip]
         cmd_install: [skip]
         cmd_create_manifest: [skip]
+        custom_dependencies: [skip]
 
         include:
 
           - package: scMultipleX
             github_repo: fmi-basel/gliberal-scMultipleX
+            github_branch: main
             manifest_path: src/scmultiplex/__FRACTAL_MANIFEST__.json
             cmd_install: 'python -m pip install -e .[fractal-tasks]'
             cmd_create_manifest: 'python src/scmultiplex/dev/create_manifest.py'
+            custom_dependencies: 'image_registration'
 
           - package: fractal-helper-tasks
             github_repo: jluethi/fractal-helper-tasks
+            github_branch: main
             manifest_path: src/fractal_helper_tasks/__FRACTAL_MANIFEST__.json
             cmd_install: 'python -m pip install -e .'
             cmd_create_manifest: 'python src/fractal_helper_tasks/dev/create_manifest.py'
+            custom_dependencies: ''
 
           - package: APx_fractal_task_collection
             github_repo: Apricot-Therapeutics/APx_fractal_task_collection
+            github_branch: pydantic_v2
             manifest_path: src/apx_fractal_task_collection/__FRACTAL_MANIFEST__.json
             cmd_install: 'python -m pip install -e .'
             cmd_create_manifest: 'python src/apx_fractal_task_collection/dev/update_manifest.py'
+            custom_dependencies: ''
 
         exclude:
           - package: skip
             github_repo: skip
+            github_branch: skip
             manifest_path: skip
             cmd_install: skip
             cmd_create_manifest: skip
+            custom_dependencies: skip
 
     steps:
 
@@ -63,6 +73,7 @@ jobs:
         uses: actions/checkout@v4
         with:
           repository: ${{ matrix.github_repo }}
+          ref: ${{ matrix.github_branch }}
 
       - uses: actions/setup-python@v5
         with:
@@ -75,11 +86,29 @@ jobs:
       - name: Install package
         run:  ${{ matrix.cmd_install }}
 
+      - name: Get current branch of `fractal-tasks-core`
+        uses: actions/checkout@v4
+        with:
+          path: fractal-tasks-core
+
+      - name: Install current fractal-tasks-core (this may fail)
+        run: python -m pip install -e ./fractal-tasks-core
+
+      - name: Install custom additional dependencies (see issue 803)
+        if: ${{ matrix.custom_dependencies != '' }}
+        run: python -m pip install ${{ matrix.custom_dependencies }}
+
       - name: Create manifest
         run: ${{ matrix.cmd_create_manifest }}
 
+      - name: Setup friendly diff style
+        run: echo "*.json diff=json" >> .gitattributes && git config diff.json.textconv "jq --sort-keys '.' \$1"
+
       - name: Run git diff for manifest
         run: git diff ${{ matrix.manifest_path }}
 
+      - name: Clean up before checking repo status
+        run: rm -rf fractal-tasks-core .gitattributes
+
       - name: Check repo status
         run: if [[ -z $(git status -s) ]]; then echo "Clean status"; else echo "Dirty status"; git status; exit 1; fi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

Successfully merging a pull request may close this issue.

1 participant