diff --git a/.github/workflows/documentation.yaml b/.github/workflows/documentation.yaml index 109c574..ae40dd7 100644 --- a/.github/workflows/documentation.yaml +++ b/.github/workflows/documentation.yaml @@ -1,4 +1,4 @@ -name: docs +name: Build and deploy on: push: @@ -6,57 +6,111 @@ on: pull_request: branches: ["main"] + # Re-run every Tuesday at 6AM + # schedule: + # - cron: "0 6 * * 2" + + # Re-run on demand: + workflow_dispatch: + jobs: - mkdocs-link-check: - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v4 - - name: mkdocs-link-check (soft) - uses: byrnereese/github-action-mkdocs-link-check@1.0 - continue-on-error: true - with: - recurse: 'yes' - verbose-mode: 'yes' - - docs: - name: "Deploy docs" - runs-on: ubuntu-22.04 - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} + build-and-deploy: + + runs-on: ubuntu-24.04 steps: + - uses: actions/checkout@v4 + with: + path: MAIN + - name: Set fractal-web reference + run: | + FRACTAL_WEB_REFERENCE=$(cat MAIN/fractal-web-reference.txt) + echo "FRACTAL_WEB_REFERENCE=$FRACTAL_WEB_REFERENCE" >> $GITHUB_ENV + + - run: echo ${{ env.FRACTAL_WEB_REFERENCE }} + + - uses: actions/checkout@v4 + with: + repository: fractal-analytics-platform/fractal-web + ref: ${{ env.FRACTAL_WEB_REFERENCE }} + path: WEB + sparse-checkout: | + components + tasks-list + - uses: actions/setup-python@v5 with: - python-version: '3.10' + python-version: '3.11' cache: pip - - name: Install requirements - run: python -m pip install -r requirements.txt + # MKDocs build - - name: Deploy docs - uses: mhausenblas/mkdocs-deploy-gh-pages@master - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - REQUIREMENTS: docs/doc-requirements.txt + - name: Install dependencies + run: python -m pip install -r MAIN/requirements.txt + - name: MKDocs build + run: mkdocs build --config-file MAIN/mkdocs.yml --strict --site-dir ./site - docs-build: - name: "Test docs build" - runs-on: ubuntu-22.04 - if: ${{ github.event_name != 'push' || github.ref != 'refs/heads/main' }} + - run: mv MAIN/site ./site - steps: - - uses: actions/checkout@v4 + # Retrieve remote task-list data - - uses: actions/setup-python@v5 + - name: Install requirements + run: python3 -m pip install -r MAIN/tasks_data_retrieval/requirements.txt + + - name: Fetch tasks data + run: python3 -u MAIN/tasks_data_retrieval/create_tasks_data.py + + - run: cat MAIN/tasks_data_retrieval/tasks.json + + - uses: actions/setup-node@v4 with: - python-version: '3.10' - cache: pip + node-version: 20 + cache: npm + cache-dependency-path: WEB/package-lock.json - - name: Install requirements - run: python -m pip install -r requirements.txt + - name: Install main fractal-web dependencies + run: | + cd WEB + npm install - - name: MKDocs build - run: mkdocs build --config-file mkdocs.yml + - name: Install components dependencies + run: | + cd WEB/components + npm install + + - name: Install tasks-list dependencies + run: | + cd WEB/tasks-list + npm install + + - name: Move tasks.json file to tasks-list/src + run: mv MAIN/tasks_data_retrieval/tasks.json WEB/tasks-list/src/ + + - name: Build tasks-list page + run: | + cd WEB/tasks-list + npm run build + + - name: Move tasks-list built files in docs site + run: mv WEB/tasks-list/build/ site/task-table + + - name: Set last-updated timestamp + run: | + CURRENT_DATE=$(date +"%Y-%m-%d %H:%M %Z") + echo "$CURRENT_DATE" + sed -i'.bak1' "s/LASTUPDATEDPLACEHOLDER/$CURRENT_DATE/" site/available_tasks/index.html + sed -i'.bak2' "s/FRACTALWEBREFERENCEPLACEHOLDER/${{ env.FRACTAL_WEB_REFERENCE }}/" site/available_tasks/index.html + rm site/available_tasks/index.html.bak1 site/available_tasks/index.html.bak2 + + - run: ls -lh site/* + + - name: Deploy docs + if: ${{ ( github.event_name == 'push' || github.event_name == 'workflow_dispatch' ) && github.event.ref == 'refs/heads/main' }} + uses: peaceiris/actions-gh-pages@v4 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_dir: ./site diff --git a/.github/workflows/links.yaml b/.github/workflows/links.yaml deleted file mode 100644 index 2970704..0000000 --- a/.github/workflows/links.yaml +++ /dev/null @@ -1,14 +0,0 @@ -name: Check Markdown links - -on: push - -jobs: - markdown-link-check: - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v4 - - uses: gaurav-nelson/github-action-markdown-link-check@v1 - # checks all markdown files from /docs including all subfolders - with: - use-verbose-mode: 'yes' - folder-path: 'docs/' diff --git a/.github/workflows/task_list.yaml b/.github/workflows/task_list.yaml deleted file mode 100644 index 069d379..0000000 --- a/.github/workflows/task_list.yaml +++ /dev/null @@ -1,31 +0,0 @@ -name: Task-list page - -on: - push: - branches: ["main"] - pull_request: - branches: ["main"] - workflow_dispatch: - - -jobs: - retrieve-tasks-data: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 1 - - - uses: actions/setup-python@v5 - with: - python-version: 3.11 - cache: pip - - - name: Install requirements - run: python3 -m pip install -r tasks/data_retrieval/requirements.txt - - - name: Fetch tasks data - run: python3 -u tasks/data_retrieval/create_tasks_data.py - - - run: cat tasks/data_retrieval/tasks_data.json \ No newline at end of file diff --git a/docs/available_tasks.md b/docs/available_tasks.md new file mode 100644 index 0000000..d4bf728 --- /dev/null +++ b/docs/available_tasks.md @@ -0,0 +1,27 @@ +--- +hide: + - navigation + - toc + - title +--- + + + + + + + + +(last updated: LASTUPDATEDPLACEHOLDER; `fractal-web` version: FRACTALWEBREFERENCEPLACEHOLDER) diff --git a/docs/index.md b/docs/index.md index c87b424..2ae0999 100644 --- a/docs/index.md +++ b/docs/index.md @@ -2,6 +2,14 @@ layout: default --- + + + Fractal is a framework developed at the [BioVisionCenter](https://www.biovisioncenter.uzh.ch/en.html) to process bioimaging data at scale in the OME-Zarr format and prepare the images for interactive visualization. ![Fractal overview](https://github.com/user-attachments/assets/666c8797-2594-4b8e-b1d2-b43fca66d1df) diff --git a/fractal-web-reference.txt b/fractal-web-reference.txt new file mode 100644 index 0000000..b281204 --- /dev/null +++ b/fractal-web-reference.txt @@ -0,0 +1 @@ +v1.13.0 diff --git a/mkdocs.yml b/mkdocs.yml index 0b7595e..8664edd 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -46,6 +46,7 @@ nav: - Fractal V2 Changes: version_2/ - Build Your Own Fractal Task: build_your_own_fractal_task.md - Deploy Fractal Server & Web: run_fractal.md + - Available tasks: available_tasks.md # Include some page, without including them in the ToC # not_in_nav: something.md diff --git a/tasks/data_retrieval/.gitignore b/tasks/data_retrieval/.gitignore deleted file mode 100644 index 3d4072f..0000000 --- a/tasks/data_retrieval/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -downloads -venv -tasks_data.json diff --git a/tasks_data_retrieval/.gitignore b/tasks_data_retrieval/.gitignore new file mode 100644 index 0000000..f3371cd --- /dev/null +++ b/tasks_data_retrieval/.gitignore @@ -0,0 +1,2 @@ +tasks.json +venv diff --git a/tasks/data_retrieval/create_tasks_data.py b/tasks_data_retrieval/create_tasks_data.py similarity index 99% rename from tasks/data_retrieval/create_tasks_data.py rename to tasks_data_retrieval/create_tasks_data.py index 86e5454..2cfc2bc 100644 --- a/tasks/data_retrieval/create_tasks_data.py +++ b/tasks_data_retrieval/create_tasks_data.py @@ -196,6 +196,7 @@ def _get_task_type( "input_types", "output_types", "docs_link", + "docs_info", ] COLUMN_DEFAULTS = { "input_types": {}, @@ -253,7 +254,7 @@ def _get_task_type( print(f"END processing {source=} - version={pkg_version}' - added {ntasks} tasks - elapsed {t_end-t_start:.3f} s.") print() -output_file = Path(__file__).parent / "tasks_data.json" +output_file = Path(__file__).parent / "tasks.json" with output_file.open("w") as f: json.dump(TASK_GROUPS, f, indent=2) diff --git a/tasks/data_retrieval/requirements.txt b/tasks_data_retrieval/requirements.txt similarity index 100% rename from tasks/data_retrieval/requirements.txt rename to tasks_data_retrieval/requirements.txt diff --git a/tasks/data_retrieval/sources.txt b/tasks_data_retrieval/sources.txt similarity index 75% rename from tasks/data_retrieval/sources.txt rename to tasks_data_retrieval/sources.txt index a7281bf..0368162 100644 --- a/tasks/data_retrieval/sources.txt +++ b/tasks_data_retrieval/sources.txt @@ -1,14 +1,10 @@ -# PyPI https://pypi.org/project/fractal-tasks-core/ https://pypi.org/project/fractal-faim-ipa https://pypi.org/project/fractal-lif-converters https://pypi.org/project/operetta-compose +https://github.com/fractal-analytics-platform/fractal-helper-tasks -# GitHub releases with wheels -https://github.com/fractal-analytics-platform/fractal-lif-converters/ - -# https://github.com/fractal-analytics-platform/fractal-helper-tasks # https://github.com/fmi-basel/gliberal-scMultipleX # https://github.com/Apricot-Therapeutics/APx_fractal_task_collection # https://github.com/fractal-analytics-platform/fractal-plantseg-tasks diff --git a/tools/full_local_build.sh b/tools/full_local_build.sh new file mode 100755 index 0000000..9614567 --- /dev/null +++ b/tools/full_local_build.sh @@ -0,0 +1,52 @@ +#!/bin/bash + +set -e + +date + +FRACTAL_WEB_REFERENCE=$(cat fractal-web-reference.txt) + +CURRENT_DIR=$(pwd) +WEBDIR="/tmp/WEB" +VENVDIR="/tmp/venv-for-landing-page" + +python3 -m venv "$VENVDIR" +source "$VENVDIR/bin/activate" + +# MKDocs +python3 -m pip install -r requirements.txt +mkdocs build --config-file mkdocs.yml --strict --site-dir ./site + +# Parse packages +python3 -m pip install -r tasks_data_retrieval/requirements.txt +python3 -u tasks_data_retrieval/create_tasks_data.py +ls -lh tasks_data_retrieval/tasks.json + +# Build +git clone git@github.com:fractal-analytics-platform/fractal-web "$WEBDIR" +cd "$WEBDIR" +git checkout "$FRACTAL_WEB_REFERENCE" +cd "$WEBDIR" +npm install +cd "$WEBDIR/components/" +npm install +cd "$WEBDIR/tasks-list" +npm install +cp "$CURRENT_DIR/tasks_data_retrieval/tasks.json" ./src/ +npm run build +cp -r build "$CURRENT_DIR/site/task-table" + +CURRENT_DATE=$(date +"%Y-%m-%d %H:%M %Z") +sed -i'.bak1' "s/LASTUPDATEDPLACEHOLDER/$CURRENT_DATE/" "$CURRENT_DIR/site/available_tasks/index.html" +sed -i'.bak2' "s/FRACTALWEBREFERENCEPLACEHOLDER/$FRACTAL_WEB_REFERENCE/" "$CURRENT_DIR/site/available_tasks/index.html" +rm "$CURRENT_DIR/site/available_tasks/index.html.bak1" +rm "$CURRENT_DIR/site/available_tasks/index.html.bak2" + + +deactivate +rm -r "$VENVDIR" +rm -rf "$WEBDIR" + +cd "$CURRENT_DIR/site" +date +python3 -m http.server