mirror of
https://mirror.skon.top/github.com/langgenius/dify.git
synced 2026-04-20 15:20:15 +08:00
Bumps the github-actions-dependencies group with 7 updates: | Package | From | To | | --- | --- | --- | | [peakoss/anti-slop](https://github.com/peakoss/anti-slop) | `0.2.1` | `0.3.0` | | [astral-sh/setup-uv](https://github.com/astral-sh/setup-uv) | `8.0.0` | `8.1.0` | | [hoverkraft-tech/compose-action](https://github.com/hoverkraft-tech/compose-action) | `2.5.0` | `2.6.0` | | [tj-actions/changed-files](https://github.com/tj-actions/changed-files) | `47.0.5` | `47.0.6` | | [autofix-ci/action](https://github.com/autofix-ci/action) | `1.3.3` | `1.3.4` | | [actions/cache](https://github.com/actions/cache) | `5.0.4` | `5.0.5` | | [anthropics/claude-code-action](https://github.com/anthropics/claude-code-action) | `1.0.93` | `1.0.101` | Updates `peakoss/anti-slop` from 0.2.1 to 0.3.0 - [Release notes](https://github.com/peakoss/anti-slop/releases) - [Changelog](https://github.com/peakoss/anti-slop/blob/main/CHANGELOG.md) - [Commits](85daca1880...57858eead4) Updates `astral-sh/setup-uv` from 8.0.0 to 8.1.0 - [Release notes](https://github.com/astral-sh/setup-uv/releases) - [Commits](cec208311d...08807647e7) Updates `hoverkraft-tech/compose-action` from 2.5.0 to 2.6.0 - [Release notes](https://github.com/hoverkraft-tech/compose-action/releases) - [Commits](4894d24920...d2bee4f07e) Updates `tj-actions/changed-files` from 47.0.5 to 47.0.6 - [Release notes](https://github.com/tj-actions/changed-files/releases) - [Changelog](https://github.com/tj-actions/changed-files/blob/main/HISTORY.md) - [Commits](22103cc46b...9426d40962) Updates `autofix-ci/action` from 1.3.3 to 1.3.4 - [Release notes](https://github.com/autofix-ci/action/releases) - [Commits](7a166d7532...c5b2d67aa2) Updates `actions/cache` from 5.0.4 to 5.0.5 - [Release notes](https://github.com/actions/cache/releases) - [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - [Commits](668228422a...27d5ce7f10) Updates `anthropics/claude-code-action` from 1.0.93 to 1.0.101 - [Release notes](https://github.com/anthropics/claude-code-action/releases) - [Commits](b47fd721da...38ec876110) --- updated-dependencies: - dependency-name: peakoss/anti-slop dependency-version: 0.3.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: github-actions-dependencies - dependency-name: astral-sh/setup-uv dependency-version: 8.1.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: github-actions-dependencies - dependency-name: hoverkraft-tech/compose-action dependency-version: 2.6.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: github-actions-dependencies - dependency-name: tj-actions/changed-files dependency-version: 47.0.6 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: github-actions-dependencies - dependency-name: autofix-ci/action dependency-version: 1.3.4 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: github-actions-dependencies - dependency-name: actions/cache dependency-version: 5.0.5 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: github-actions-dependencies - dependency-name: anthropics/claude-code-action dependency-version: 1.0.101 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: ubuntu-latest
|
|
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: ubuntu-latest
|
|
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/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: ubuntu-latest
|
|
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@57e3a136b779b570ffcdbf80b3bdc90e7fab3de2 # v6.0.0
|
|
with:
|
|
files: ./coverage.xml
|
|
disable_search: true
|
|
flags: api
|
|
env:
|
|
CODECOV_TOKEN: ${{ env.CODECOV_TOKEN }}
|