Skip to content
Closed
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
16 changes: 16 additions & 0 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,13 @@ on:
- dify-agent/src/**
- web/Dockerfile
- dify-agent-runtime/docker/Dockerfile
- dify-agent-runtime/docker/Dockerfile.rust
- dify-agent-runtime/.dockerignore
- dify-agent-runtime/go.mod
- dify-agent-runtime/go.sum
- dify-agent-runtime/cmd/**
- dify-agent-runtime/internal/**
- dify-agent-runtime/rust/**

concurrency:
group: docker-build-${{ github.head_ref || github.run_id }}
Expand Down Expand Up @@ -63,6 +66,16 @@ jobs:
runs_on: depot-ubuntu-24.04-4
context: '{{defaultContext}}:dify-agent-runtime'
file: 'docker/Dockerfile'
- service_name: 'local-sandbox-rust-amd64'
platform: linux/amd64
runs_on: depot-ubuntu-24.04-4
context: '{{defaultContext}}:dify-agent-runtime'
file: 'docker/Dockerfile.rust'
- service_name: 'local-sandbox-rust-arm64'
platform: linux/arm64
runs_on: depot-ubuntu-24.04-4
context: '{{defaultContext}}:dify-agent-runtime'
file: 'docker/Dockerfile.rust'
steps:
- name: Set up Depot CLI
uses: depot/setup-action@15c09a5f77a0840ad4bce955686522a257853461 # v1.7.1
Expand Down Expand Up @@ -94,6 +107,9 @@ jobs:
- service_name: 'local-sandbox-amd64'
context: '{{defaultContext}}:dify-agent-runtime'
file: 'docker/Dockerfile'
- service_name: 'local-sandbox-rust-amd64'
context: '{{defaultContext}}:dify-agent-runtime'
file: 'docker/Dockerfile.rust'
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2.0
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/main-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,21 @@ jobs:
- 'api/pyproject.toml'
sandbox-runtime:
- 'dify-agent-runtime/**'
- 'dify-agent/src/dify_agent/runtime_backend/**'
- 'dify-agent/src/dify_agent/server/settings.py'
- 'dify-agent/tests/local/dify_agent/runtime_backend/**'
- 'dify-agent/tests/local/dify_agent/server/test_settings.py'
- 'dify-agent/tests/integration/dify_agent/runtime_backend/**'
- 'dify-agent/pyproject.toml'
- 'dify-agent/uv.lock'
- 'benchmarks/**'
- 'docker/.env.example'
- 'docker/envs/core-services/dify-agent.env.example'
- 'docker/docker-compose.yaml'
- 'docker/docker-compose-template.yaml'
- 'docker/docker-compose.rust-runtime.yaml'
- '.github/workflows/sandbox-runtime-tests.yml'
- '.github/workflows/main-ci.yml'
migration:
- 'api/migrations/**'
- 'api/.env.example'
Expand Down
88 changes: 88 additions & 0 deletions .github/workflows/sandbox-runtime-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,50 @@ jobs:
- name: Run unit tests
run: go test -race -count=1 ./...

- name: Validate benchmark harness
working-directory: .
run: |
python3 -m compileall -q \
benchmarks/run_container_benchmarks.py \
benchmarks/test_container_benchmark.py
PYTHONPATH=benchmarks python3 -m unittest discover \
-s benchmarks -p 'test_container_benchmark.py' -v

- name: Setup UV and Python
uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
with:
enable-cache: true
python-version: '3.12'
cache-dependency-glob: dify-agent/uv.lock

- name: Install agent rollout test dependencies
working-directory: dify-agent
run: uv sync --extra server --dev

- name: Validate safe Go/Rust rollout routing
working-directory: dify-agent
env:
PYTHONPATH: src
run: |
uv run ruff check \
src/dify_agent/runtime_backend/local_rollout.py \
src/dify_agent/runtime_backend/profile.py \
src/dify_agent/server/settings.py \
tests/local/dify_agent/runtime_backend/test_local_rollout.py \
tests/local/dify_agent/runtime_backend/test_profile.py \
tests/local/dify_agent/server/test_settings.py
uv run pytest -q \
tests/local/dify_agent/runtime_backend/test_local_rollout.py \
tests/local/dify_agent/runtime_backend/test_profile.py \
tests/local/dify_agent/server/test_settings.py
uv run basedpyright --level error \
src/dify_agent/runtime_backend/local_rollout.py \
src/dify_agent/runtime_backend/profile.py \
src/dify_agent/server/settings.py \
tests/local/dify_agent/runtime_backend/test_local_rollout.py \
tests/local/dify_agent/runtime_backend/test_profile.py \
tests/local/dify_agent/server/test_settings.py

sandbox-runtime-lint:
name: Sandbox Runtime Lint
runs-on: depot-ubuntu-24.04
Expand Down Expand Up @@ -62,6 +106,36 @@ jobs:
working-directory: dify-agent-runtime
version: latest

sandbox-runtime-rust:
name: Sandbox Runtime Rust Tests
runs-on: depot-ubuntu-24.04
defaults:
run:
shell: bash
working-directory: dify-agent-runtime

steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@4360b52568e2003a75bf9bc1d59f33a8e3fc893c # stable
with:
toolchain: 1.95.0
components: rustfmt, clippy

- name: Check formatting
run: cargo fmt --manifest-path rust/Cargo.toml --all -- --check

- name: Run Clippy
run: cargo clippy --locked --manifest-path rust/Cargo.toml --all-targets -- -D warnings

- name: Run unit tests
run: cargo test --locked --manifest-path rust/Cargo.toml

sandbox-runtime-integration:
name: Sandbox Runtime Integration Tests
runs-on: depot-ubuntu-24.04
Expand All @@ -83,12 +157,26 @@ jobs:
go-version-file: dify-agent-runtime/go.mod
cache-dependency-path: dify-agent-runtime/go.sum

- name: Setup UV and Python
uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
with:
enable-cache: true
python-version: '3.12'
cache-dependency-glob: dify-agent/uv.lock

- name: Install agent rollout test dependencies
working-directory: dify-agent
run: uv sync --extra server --dev

- name: Build and start runtime
run: make integration-up

- name: Run integration tests
run: make integration-test

- name: Run real Go/Rust rollout integration tests
run: make integration-test-rollout

- name: Dump container logs on failure
if: failure()
run: make integration-logs || true
Expand Down
Loading
Loading