Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

ci: use native background steps for E2E dependency installs (#43631)

Stephen Zhou4a92fb6fd14a
diff --git a/.github/actions/setup-core-e2e/action.yml b/.github/actions/setup-core-e2e/action.yml
deleted file mode 100644
index 4356699e20b..00000000000
--- a/.github/actions/setup-core-e2e/action.yml
+++ /dev/null
@@ -1,29 +0,0 @@
-name: Setup Core E2E Dependencies
-description: Install API dependencies alongside web dependencies and the selected browser
-
-inputs:
- browser:
- description: Browser to install (chromium or webkit)
- required: true
-
-runs:
- using: composite
- steps:
- - name: Setup web toolchain
- uses: ./.github/actions/setup-web
- with:
- run-install: 'false'
-
- - name: Setup UV and Python
- uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
- with:
- enable-cache: true
- python-version: '3.12'
- cache-dependency-glob: api/uv.lock
-
- - name: Install dependencies in parallel
- shell: bash
- env:
- E2E_INSTALL_BROWSER: ${{ inputs.browser }}
- E2E_SETUP_ACTION_PATH: ${{ github.action_path }}
- run: bash "$E2E_SETUP_ACTION_PATH/install.sh"
diff --git a/.github/actions/setup-core-e2e/install.sh b/.github/actions/setup-core-e2e/install.sh
deleted file mode 100755
index 42270d3f18d..00000000000
--- a/.github/actions/setup-core-e2e/install.sh
+++ /dev/null
@@ -1,56 +0,0 @@
-#!/usr/bin/env bash
-set -euo pipefail
-
-case "${E2E_INSTALL_BROWSER:-}" in
- chromium|webkit) ;;
- *) echo "Expected chromium or webkit" >&2; exit 1 ;;
-esac
-
-# Keep both branches in this step so failures are collected before tests start.
-started=$SECONDS
-timing_dir=$(mktemp -d)
-trap 'rm -rf "$timing_dir"' EXIT
-
-(
- api_started=$SECONDS
- uv sync --project api --dev
- echo "$((SECONDS - api_started))" > "$timing_dir/api"
-) &
-api_pid=$!
-
-(
- web_started=$SECONDS
- vp install --frozen-lockfile
- echo "$((SECONDS - web_started))" > "$timing_dir/web"
- browser_started=$SECONDS
- cd e2e
- vp run "e2e:install:ci:$E2E_INSTALL_BROWSER"
- echo "$((SECONDS - browser_started))" > "$timing_dir/browser"
-) &
-web_pid=$!
-
-api_status=0
-web_status=0
-wait "$api_pid" || api_status=$?
-wait "$web_pid" || web_status=$?
-
-{
- echo "### E2E dependency preparation ($E2E_INSTALL_BROWSER)"
- echo ""
- echo "Parallel install wall time: $((SECONDS - started))s"
- echo ""
- echo "| Phase | Seconds |"
- echo "| --- | ---: |"
- for phase in api web browser; do
- if [[ -f "$timing_dir/$phase" ]]; then
- echo "| $phase | $(cat "$timing_dir/$phase") |"
- fi
- done
- echo ""
- echo "API exit status: $api_status; Web/browser exit status: $web_status"
-} >> "${GITHUB_STEP_SUMMARY:-/dev/null}"
-
-if (( api_status != 0 || web_status != 0 )); then
- echo "E2E dependency installation failed (API: $api_status, Web/browser: $web_status)" >&2
- exit 1
-fi
diff --git a/.github/workflows/accessibility-e2e.yml b/.github/workflows/accessibility-e2e.yml
index ce74b65bf2e..18022e59918 100644
--- a/.github/workflows/accessibility-e2e.yml
+++ b/.github/workflows/accessibility-e2e.yml
@@ -48,8 +48,10 @@ jobs:
with:
persist-credentials: false
- - name: Setup web dependencies
+ - name: Setup web toolchain
uses: ./.github/actions/setup-web
+ with:
+ run-install: 'false'
- name: Setup UV and Python
uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
@@ -59,14 +61,26 @@ jobs:
cache-dependency-glob: |
api/uv.lock
+ # API and web installs are independent, so overlap them; the browser
+ # install needs Playwright from the web dependencies.
- name: Install API dependencies
+ id: install-api-dependencies
+ background: true
+ timeout-minutes: 15
run: uv sync --project api --dev
+ - name: Install web dependencies
+ timeout-minutes: 15
+ run: vp install --frozen-lockfile
+
- name: Install Chromium for accessibility E2E
timeout-minutes: 15
working-directory: ./e2e
run: vp run e2e:install:ci:chromium
+ - name: Wait for API dependencies
+ wait: install-api-dependencies
+
- name: Run automated WCAG Level ${{ inputs.level == 'a' && 'A' || 'AA' }} checks
working-directory: ./e2e
env:
diff --git a/.github/workflows/main-ci.yml b/.github/workflows/main-ci.yml
index 92246c51407..b9a502a8655 100644
--- a/.github/workflows/main-ci.yml
+++ b/.github/workflows/main-ci.yml
@@ -116,7 +116,6 @@ jobs:
- '.github/workflows/web-e2e.yml'
- '.github/workflows/main-ci.yml'
- '.github/actions/setup-web/**'
- - '.github/actions/setup-core-e2e/**'
- '.github/actions/wait-e2e-web-build/**'
vdb:
- 'api/core/rag/datasource/**'
diff --git a/.github/workflows/web-e2e.yml b/.github/workflows/web-e2e.yml
index e52535aa9bc..d3c71f5a2e0 100644
--- a/.github/workflows/web-e2e.yml
+++ b/.github/workflows/web-e2e.yml
@@ -113,11 +113,37 @@ jobs:
with:
persist-credentials: false
- - name: Prepare Chromium E2E dependencies
- timeout-minutes: 15
- uses: ./.github/actions/setup-core-e2e
+ - name: Setup web toolchain
+ uses: ./.github/actions/setup-web
+ with:
+ run-install: 'false'
+
+ - name: Setup UV and Python
+ uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
with:
- browser: chromium
+ enable-cache: true
+ python-version: '3.12'
+ cache-dependency-glob: api/uv.lock
+
+ # API and web installs are independent, so overlap them; the browser
+ # install needs Playwright from the web dependencies.
+ - name: Install API dependencies
+ id: install-api-dependencies
+ background: true
+ timeout-minutes: 15
+ run: uv sync --project api --dev
+
+ - name: Install web dependencies
+ timeout-minutes: 15
+ run: vp install --frozen-lockfile
+
+ - name: Install Chromium
+ timeout-minutes: 15
+ working-directory: ./e2e
+ run: vp run e2e:install:ci:chromium
+
+ - name: Wait for API dependencies
+ wait: install-api-dependencies
# The runner prepares the backend while waiting for and downloading the build.
- name: Run Chromium full shard
@@ -165,11 +191,37 @@ jobs:
with:
persist-credentials: false
- - name: Prepare WebKit E2E dependencies
- timeout-minutes: 15
- uses: ./.github/actions/setup-core-e2e
+ - name: Setup web toolchain
+ uses: ./.github/actions/setup-web
with:
- browser: webkit
+ run-install: 'false'
+
+ - name: Setup UV and Python
+ uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
+ with:
+ enable-cache: true
+ python-version: '3.12'
+ cache-dependency-glob: api/uv.lock
+
+ # API and web installs are independent, so overlap them; the browser
+ # install needs Playwright from the web dependencies.
+ - name: Install API dependencies
+ id: install-api-dependencies
+ background: true
+ timeout-minutes: 15
+ run: uv sync --project api --dev
+
+ - name: Install web dependencies
+ timeout-minutes: 15
+ run: vp install --frozen-lockfile
+
+ - name: Install WebKit
+ timeout-minutes: 15
+ working-directory: ./e2e
+ run: vp run e2e:install:ci:webkit
+
+ - name: Wait for API dependencies
+ wait: install-api-dependencies
# Keep the same overlap and teardown ownership for the WebKit smoke lane.
- name: Run WebKit browser smoke
@@ -211,8 +263,10 @@ jobs:
with:
persist-credentials: false
- - name: Setup web dependencies
+ - name: Setup web toolchain
uses: ./.github/actions/setup-web
+ with:
+ run-install: 'false'
- name: Setup UV and Python
uses: astral-sh/setup-uv@c18668ad3cf93ea998bef934396af7bb5c839dc7 # v10.2.0
@@ -223,14 +277,26 @@ jobs:
api/uv.lock
dify-agent/uv.lock
+ # API and web installs are independent, so overlap them; the browser
+ # install needs Playwright from the web dependencies.
- name: Install API dependencies
+ id: install-api-dependencies
+ background: true
+ timeout-minutes: 15
run: uv sync --project api --dev
+ - name: Install web dependencies
+ timeout-minutes: 15
+ run: vp install --frozen-lockfile
+
- name: Install Chromium
timeout-minutes: 15
working-directory: ./e2e
run: vp run e2e:install:ci:chromium
+ - name: Wait for API dependencies
+ wait: install-api-dependencies
+
- name: Run prepared and external runtime E2E tests
working-directory: ./e2e
env: