fengmiguoji commited on
Commit
53e7d05
·
verified ·
1 Parent(s): 005e979

Upload .github\workflows\api-tests.yml with huggingface_hub

Browse files
Files changed (1) hide show
  1. .github//workflows//api-tests.yml +78 -0
.github//workflows//api-tests.yml ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Run Pytest
2
+
3
+ on:
4
+ pull_request:
5
+ branches:
6
+ - main
7
+ paths:
8
+ - api/**
9
+ - docker/**
10
+ - .github/workflows/api-tests.yml
11
+
12
+ concurrency:
13
+ group: api-tests-${{ github.head_ref || github.run_id }}
14
+ cancel-in-progress: true
15
+
16
+ jobs:
17
+ test:
18
+ name: API Tests
19
+ runs-on: ubuntu-latest
20
+ strategy:
21
+ matrix:
22
+ python-version:
23
+ - "3.11"
24
+ - "3.12"
25
+
26
+ steps:
27
+ - name: Checkout code
28
+ uses: actions/checkout@v4
29
+ with:
30
+ fetch-depth: 0
31
+ persist-credentials: false
32
+
33
+ - name: Setup Poetry and Python ${{ matrix.python-version }}
34
+ uses: ./.github/actions/setup-poetry
35
+ with:
36
+ python-version: ${{ matrix.python-version }}
37
+ poetry-lockfile: api/poetry.lock
38
+
39
+ - name: Check Poetry lockfile
40
+ run: |
41
+ poetry check -C api --lock
42
+ poetry show -C api
43
+
44
+ - name: Install dependencies
45
+ run: poetry install -C api --with dev
46
+
47
+ - name: Check dependencies in pyproject.toml
48
+ run: poetry run -P api bash dev/pytest/pytest_artifacts.sh
49
+
50
+ - name: Run Unit tests
51
+ run: poetry run -P api bash dev/pytest/pytest_unit_tests.sh
52
+
53
+ - name: Run dify config tests
54
+ run: poetry run -P api python dev/pytest/pytest_config_tests.py
55
+
56
+ - name: Run mypy
57
+ run: |
58
+ poetry run -C api python -m mypy --install-types --non-interactive .
59
+
60
+ - name: Set up dotenvs
61
+ run: |
62
+ cp docker/.env.example docker/.env
63
+ cp docker/middleware.env.example docker/middleware.env
64
+
65
+ - name: Expose Service Ports
66
+ run: sh .github/workflows/expose_service_ports.sh
67
+
68
+ - name: Set up Sandbox
69
+ uses: hoverkraft-tech/compose-action@v2.0.2
70
+ with:
71
+ compose-file: |
72
+ docker/docker-compose.middleware.yaml
73
+ services: |
74
+ sandbox
75
+ ssrf_proxy
76
+
77
+ - name: Run Workflow
78
+ run: poetry run -P api bash dev/pytest/pytest_workflow.sh