Skip to content

Commit ba9be47

Browse files
committed
merge master
2 parents 0e062ca + eb81613 commit ba9be47

File tree

4 files changed

+180
-1
lines changed

4 files changed

+180
-1
lines changed
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
name: integration_test
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
working-directory:
7+
required: true
8+
type: string
9+
default: './libs/chatchat-server'
10+
description: "From which folder this pipeline executes"
11+
12+
env:
13+
POETRY_VERSION: "1.7.1"
14+
15+
jobs:
16+
build:
17+
defaults:
18+
run:
19+
working-directory: ${{ inputs.working-directory }}
20+
if: github.ref == 'refs/heads/master'
21+
environment: Scheduled testing publish
22+
runs-on: ${{ matrix.os }}
23+
strategy:
24+
matrix:
25+
os: [ubuntu-latest, windows-latest, macos-latest]
26+
python-version: ["3.8", "3.9", "3.10", "3.11"]
27+
28+
name: "make integration_test #${{ matrix.os }} Python ${{ matrix.python-version }}"
29+
steps:
30+
- uses: actions/checkout@v4
31+
32+
- name: Set up Python ${{ matrix.python-version }} + Poetry ${{ env.POETRY_VERSION }}
33+
uses: "./.github/actions/poetry_setup"
34+
with:
35+
python-version: ${{ matrix.python-version }}
36+
poetry-version: ${{ env.POETRY_VERSION }}
37+
working-directory: ${{ inputs.working-directory }}
38+
cache-key: core
39+
40+
41+
- name: Import test dependencies
42+
run: poetry install --with test
43+
working-directory: ${{ inputs.working-directory }}
44+
45+
- name: Run integration tests
46+
shell: bash
47+
env:
48+
ZHIPUAI_API_KEY: ${{ secrets.ZHIPUAI_API_KEY }}
49+
ZHIPUAI_BASE_URL: ${{ secrets.ZHIPUAI_BASE_URL }}
50+
run: |
51+
make integration_tests
52+
53+
54+
- name: Remove chatchat Test Untracked files (Linux/macOS)
55+
if: runner.os != 'Windows'
56+
working-directory: ${{ inputs.working-directory }}
57+
run: |
58+
if [ -d "tests/unit_tests/config/chatchat/" ]; then
59+
rm -rf tests/unit_tests/config/chatchat/
60+
fi
61+
62+
- name: Remove chatchat Test Untracked files (Windows)
63+
if: runner.os == 'Windows'
64+
working-directory: ${{ inputs.working-directory }}
65+
run: |
66+
if (Test-Path -Path "tests/unit_tests/config/chatchat/") {
67+
Remove-Item -Recurse -Force "tests/unit_tests/config/chatchat/"
68+
}
69+
70+
- name: Ensure the tests did not create any additional files (Linux/macOS)
71+
if: runner.os != 'Windows'
72+
shell: bash
73+
run: |
74+
set -eu
75+
76+
STATUS="$(git status)"
77+
echo "$STATUS"
78+
79+
# grep will exit non-zero if the target message isn't found,
80+
# and `set -e` above will cause the step to fail.
81+
echo "$STATUS" | grep 'nothing to commit, working tree clean'
82+
83+
- name: Ensure the tests did not create any additional files (Windows)
84+
if: runner.os == 'Windows'
85+
shell: powershell
86+
run: |
87+
$STATUS = git status
88+
Write-Host $STATUS
89+
90+
# Select-String will exit non-zero if the target message isn't found.
91+
$STATUS | Select-String 'nothing to commit, working tree clean'

.github/workflows/_release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ jobs:
9191
# maximally sensitive to catching breakage.
9292
#
9393
# For example, here's a way that caching can cause a falsely-passing test:
94-
# - Make the langchain package manifest no longer list a dependency package
94+
# - Make the chatchat package manifest no longer list a dependency package
9595
# as a requirement. This means it won't be installed by `pip install`,
9696
# and attempting to use it would cause a crash.
9797
# - That dependency used to be required, so it may have been cached.

.github/workflows/_test.yml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: test
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
working-directory:
7+
required: true
8+
type: string
9+
default: './libs/chatchat-server'
10+
description: "From which folder this pipeline executes"
11+
12+
env:
13+
POETRY_VERSION: "1.7.1"
14+
15+
jobs:
16+
build:
17+
defaults:
18+
run:
19+
working-directory: ${{ inputs.working-directory }}
20+
runs-on: ${{ matrix.os }}
21+
strategy:
22+
matrix:
23+
os: [ubuntu-latest, windows-latest, macos-latest]
24+
python-version: ["3.8", "3.9", "3.10", "3.11"]
25+
26+
name: "make test #${{ matrix.os }} Python ${{ matrix.python-version }}"
27+
steps:
28+
- uses: actions/checkout@v4
29+
30+
- name: Set up Python ${{ matrix.python-version }} + Poetry ${{ env.POETRY_VERSION }}
31+
uses: "./.github/actions/poetry_setup"
32+
with:
33+
python-version: ${{ matrix.python-version }}
34+
poetry-version: ${{ env.POETRY_VERSION }}
35+
working-directory: ${{ inputs.working-directory }}
36+
cache-key: core
37+
38+
- name: Install chatchat editable
39+
working-directory: ${{ inputs.working-directory }}
40+
shell: bash
41+
run: poetry install --with test
42+
43+
- name: Run core tests
44+
shell: bash
45+
run: |
46+
make test
47+
48+
- name: Remove chatchat Test Untracked files (Linux/macOS)
49+
if: runner.os != 'Windows'
50+
working-directory: ${{ inputs.working-directory }}
51+
run: |
52+
if [ -d "tests/unit_tests/config/chatchat/" ]; then
53+
rm -rf tests/unit_tests/config/chatchat/
54+
fi
55+
56+
- name: Remove chatchat Test Untracked files (Windows)
57+
if: runner.os == 'Windows'
58+
working-directory: ${{ inputs.working-directory }}
59+
run: |
60+
if (Test-Path -Path "tests/unit_tests/config/chatchat/") {
61+
Remove-Item -Recurse -Force "tests/unit_tests/config/chatchat/"
62+
}
63+
64+
- name: Ensure the tests did not create any additional files (Linux/macOS)
65+
if: runner.os != 'Windows'
66+
shell: bash
67+
run: |
68+
set -eu
69+
70+
STATUS="$(git status)"
71+
echo "$STATUS"
72+
73+
# grep will exit non-zero if the target message isn't found,
74+
# and `set -e` above will cause the step to fail.
75+
echo "$STATUS" | grep 'nothing to commit, working tree clean'
76+
77+
- name: Ensure the tests did not create any additional files (Windows)
78+
if: runner.os == 'Windows'
79+
shell: powershell
80+
run: |
81+
$STATUS = git status
82+
Write-Host $STATUS
83+
84+
# Select-String will exit non-zero if the target message isn't found.
85+
$STATUS | Select-String 'nothing to commit, working tree clean'
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
def test_sdk_import_unit():
2+
from langchain_chatchat.configs import DEFAULT_EMBEDDING_MODEL, MODEL_PLATFORMS
3+
from langchain_chatchat.server.utils import is_port_in_use

0 commit comments

Comments
 (0)