mirror of
https://github.com/langgenius/dify.git
synced 2026-05-28 04:43:33 +08:00
Bumps the github-actions-dependencies group with 8 updates: | Package | From | To | | --- | --- | --- | | [codecov/codecov-action](https://github.com/codecov/codecov-action) | `6.0.0` | `6.0.1` | | [docker/login-action](https://github.com/docker/login-action) | `4.1.0` | `4.2.0` | | [docker/metadata-action](https://github.com/docker/metadata-action) | `6.0.0` | `6.1.0` | | [depot/build-push-action](https://github.com/depot/build-push-action) | `1.17.0` | `1.18.0` | | [docker/setup-buildx-action](https://github.com/docker/setup-buildx-action) | `4.0.0` | `4.1.0` | | [docker/build-push-action](https://github.com/docker/build-push-action) | `7.1.0` | `7.2.0` | | [actions/stale](https://github.com/actions/stale) | `10.2.0` | `10.3.0` | | [anthropics/claude-code-action](https://github.com/anthropics/claude-code-action) | `1.0.119` | `1.0.133` | Updates `codecov/codecov-action` from 6.0.0 to 6.0.1 - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](57e3a136b7...e79a6962e0) Updates `docker/login-action` from 4.1.0 to 4.2.0 - [Release notes](https://github.com/docker/login-action/releases) - [Commits](4907a6ddec...650006c6eb) Updates `docker/metadata-action` from 6.0.0 to 6.1.0 - [Release notes](https://github.com/docker/metadata-action/releases) - [Commits](030e881283...80c7e94dd9) Updates `depot/build-push-action` from 1.17.0 to 1.18.0 - [Release notes](https://github.com/depot/build-push-action/releases) - [Commits](5f3b3c2e5a...98e78adca7) Updates `docker/setup-buildx-action` from 4.0.0 to 4.1.0 - [Release notes](https://github.com/docker/setup-buildx-action/releases) - [Commits](4d04d5d948...d7f5e7f509) Updates `docker/build-push-action` from 7.1.0 to 7.2.0 - [Release notes](https://github.com/docker/build-push-action/releases) - [Commits](bcafcacb16...f9f3042f7e) Updates `actions/stale` from 10.2.0 to 10.3.0 - [Release notes](https://github.com/actions/stale/releases) - [Changelog](https://github.com/actions/stale/blob/main/CHANGELOG.md) - [Commits](b5d41d4e1d...eb5cf3af3a) Updates `anthropics/claude-code-action` from 1.0.119 to 1.0.133 - [Release notes](https://github.com/anthropics/claude-code-action/releases) - [Commits](476e359e62...787c5a0ce9) --- updated-dependencies: - dependency-name: codecov/codecov-action dependency-version: 6.0.1 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: github-actions-dependencies - dependency-name: docker/login-action dependency-version: 4.2.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: github-actions-dependencies - dependency-name: docker/metadata-action dependency-version: 6.1.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: github-actions-dependencies - dependency-name: depot/build-push-action dependency-version: 1.18.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: github-actions-dependencies - dependency-name: docker/setup-buildx-action dependency-version: 4.1.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: github-actions-dependencies - dependency-name: docker/build-push-action dependency-version: 7.2.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: github-actions-dependencies - dependency-name: actions/stale dependency-version: 10.3.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: github-actions-dependencies - dependency-name: anthropics/claude-code-action dependency-version: 1.0.133 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: github-actions-dependencies ... Signed-off-by: dependabot[bot] <support@github.com>
213 lines
6.2 KiB
YAML
213 lines
6.2 KiB
YAML
name: Run Pytest
|
|
|
|
on:
|
|
workflow_call:
|
|
secrets:
|
|
CODECOV_TOKEN:
|
|
required: false
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: api-tests-${{ github.head_ref || github.run_id }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
api-unit:
|
|
name: API Unit Tests
|
|
runs-on: depot-ubuntu-24.04
|
|
env:
|
|
COVERAGE_FILE: coverage-unit
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
strategy:
|
|
matrix:
|
|
python-version:
|
|
- "3.12"
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
with:
|
|
fetch-depth: 0
|
|
persist-credentials: false
|
|
|
|
- name: Setup UV and Python
|
|
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
|
|
with:
|
|
enable-cache: true
|
|
python-version: ${{ matrix.python-version }}
|
|
cache-dependency-glob: api/uv.lock
|
|
|
|
- name: Check UV lockfile
|
|
run: uv lock --project api --check
|
|
|
|
- name: Install dependencies
|
|
run: uv sync --project api --dev
|
|
|
|
- name: Run dify config tests
|
|
run: uv run --project api dev/pytest/pytest_config_tests.py
|
|
|
|
- name: Run Unit Tests
|
|
run: uv run --project api bash dev/pytest/pytest_unit_tests.sh
|
|
|
|
- name: Upload unit coverage data
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
with:
|
|
name: api-coverage-unit
|
|
path: coverage-unit
|
|
retention-days: 1
|
|
|
|
api-integration:
|
|
name: API Integration Tests
|
|
runs-on: depot-ubuntu-24.04
|
|
env:
|
|
COVERAGE_FILE: coverage-integration
|
|
STORAGE_TYPE: opendal
|
|
OPENDAL_SCHEME: fs
|
|
OPENDAL_FS_ROOT: /tmp/dify-storage
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
strategy:
|
|
matrix:
|
|
python-version:
|
|
- "3.12"
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
with:
|
|
fetch-depth: 0
|
|
persist-credentials: false
|
|
|
|
- name: Setup UV and Python
|
|
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
|
|
with:
|
|
enable-cache: true
|
|
python-version: ${{ matrix.python-version }}
|
|
cache-dependency-glob: api/uv.lock
|
|
|
|
- name: Check UV lockfile
|
|
run: uv lock --project api --check
|
|
|
|
- name: Install dependencies
|
|
run: uv sync --project api --dev
|
|
|
|
- name: Set up dotenvs
|
|
run: |
|
|
cp docker/.env.example docker/.env
|
|
cp docker/envs/middleware.env.example docker/middleware.env
|
|
|
|
- name: Expose Service Ports
|
|
run: sh .github/workflows/expose_service_ports.sh
|
|
|
|
- name: Set up Sandbox
|
|
uses: hoverkraft-tech/compose-action@d2bee4f07e8ca410d6b196d00f90c12e7d48c33a # v2.6.0
|
|
with:
|
|
compose-file: |
|
|
docker/docker-compose.middleware.yaml
|
|
services: |
|
|
db_postgres
|
|
redis
|
|
sandbox
|
|
ssrf_proxy
|
|
|
|
- name: setup test config
|
|
run: |
|
|
cp api/tests/integration_tests/.env.example api/tests/integration_tests/.env
|
|
|
|
- name: Run Integration Tests
|
|
run: |
|
|
uv run --project api pytest \
|
|
-n auto \
|
|
--timeout "${PYTEST_TIMEOUT:-180}" \
|
|
api/tests/integration_tests/workflow \
|
|
api/tests/integration_tests/tools \
|
|
api/tests/test_containers_integration_tests
|
|
|
|
- name: Upload integration coverage data
|
|
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
with:
|
|
name: api-coverage-integration
|
|
path: coverage-integration
|
|
retention-days: 1
|
|
|
|
api-coverage:
|
|
name: API Coverage
|
|
runs-on: depot-ubuntu-24.04
|
|
needs:
|
|
- api-unit
|
|
- api-integration
|
|
env:
|
|
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
|
COVERAGE_FILE: .coverage
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
with:
|
|
fetch-depth: 0
|
|
persist-credentials: false
|
|
|
|
- name: Setup UV and Python
|
|
uses: astral-sh/setup-uv@08807647e7069bb48b6ef5acd8ec9567f424441b # v8.1.0
|
|
with:
|
|
enable-cache: true
|
|
python-version: "3.12"
|
|
cache-dependency-glob: api/uv.lock
|
|
|
|
- name: Install dependencies
|
|
run: uv sync --project api --dev
|
|
|
|
- name: Download coverage data
|
|
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
|
|
with:
|
|
path: coverage-data
|
|
pattern: api-coverage-*
|
|
merge-multiple: true
|
|
|
|
- name: Combine coverage
|
|
run: |
|
|
set -euo pipefail
|
|
|
|
echo "### API Coverage" >> "$GITHUB_STEP_SUMMARY"
|
|
echo "" >> "$GITHUB_STEP_SUMMARY"
|
|
echo "Merged backend coverage report generated for Codecov project status." >> "$GITHUB_STEP_SUMMARY"
|
|
echo "" >> "$GITHUB_STEP_SUMMARY"
|
|
|
|
unit_coverage="$(find coverage-data -type f -name coverage-unit -print -quit)"
|
|
integration_coverage="$(find coverage-data -type f -name coverage-integration -print -quit)"
|
|
: "${unit_coverage:?coverage-unit artifact not found}"
|
|
: "${integration_coverage:?coverage-integration artifact not found}"
|
|
|
|
report_file="$(mktemp)"
|
|
uv run --project api coverage combine "$unit_coverage" "$integration_coverage"
|
|
uv run --project api coverage report --show-missing | tee "$report_file"
|
|
echo "Summary: \`$(tail -n 1 "$report_file")\`" >> "$GITHUB_STEP_SUMMARY"
|
|
{
|
|
echo ""
|
|
echo "<details><summary>Coverage report</summary>"
|
|
echo ""
|
|
echo '```'
|
|
cat "$report_file"
|
|
echo '```'
|
|
echo "</details>"
|
|
} >> "$GITHUB_STEP_SUMMARY"
|
|
uv run --project api coverage xml -o coverage.xml
|
|
|
|
- name: Report coverage
|
|
if: ${{ env.CODECOV_TOKEN != '' }}
|
|
uses: codecov/codecov-action@e79a6962e0d4c0c17b229090214935d2e33f8354 # v6.0.1
|
|
with:
|
|
files: ./coverage.xml
|
|
disable_search: true
|
|
flags: api
|
|
env:
|
|
CODECOV_TOKEN: ${{ env.CODECOV_TOKEN }}
|