forked from Tencent/WeKnora
-
Notifications
You must be signed in to change notification settings - Fork 0
96 lines (81 loc) · 2.54 KB
/
Copy pathdocreader.yml
File metadata and controls
96 lines (81 loc) · 2.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
name: DocReader
on:
push:
branches: [main]
paths:
- "docreader/**"
- "go.mod"
- "go.sum"
- "testdata/**"
- "packages/**"
- "docker/Dockerfile.docreader"
- "docker/Dockerfile.odl-hybrid"
- ".github/workflows/docreader.yml"
pull_request:
paths:
- "docreader/**"
- "go.mod"
- "go.sum"
- "testdata/**"
- "packages/**"
- "docker/Dockerfile.docreader"
- "docker/Dockerfile.odl-hybrid"
- ".github/workflows/docreader.yml"
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
env:
PYTHON_VERSION: "3.10.18"
GO_VERSION: "1.26"
GOPROXY: https://proxy.golang.org,direct
jobs:
verify:
name: Python tests and Go client tests
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v6
- uses: actions/setup-python@v6
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
enable-cache: true
cache-dependency-glob: docreader/uv.lock
- name: Install Python dependencies
run: uv sync --project docreader --locked --no-dev --python ${{ env.PYTHON_VERSION }}
- name: Compile Python sources
run: uv run --project docreader --python ${{ env.PYTHON_VERSION }} python -m compileall -q docreader
- name: Run Python tests
run: uv run --project docreader --python ${{ env.PYTHON_VERSION }} python -m unittest discover -s docreader/tests -p "test_*.py" -v
- uses: actions/setup-go@v6
with:
go-version: ${{ env.GO_VERSION }}
cache: true
- name: Download Go modules
run: go mod download
- name: Start DocReader gRPC server
run: |
uv run --project docreader --python ${{ env.PYTHON_VERSION }} python -m docreader.main &
echo $! > /tmp/docreader.pid
for i in $(seq 1 30); do
if nc -z 127.0.0.1 50051 2>/dev/null; then
echo "DocReader gRPC server is ready"
exit 0
fi
sleep 1
done
echo "DocReader gRPC server failed to start"
exit 1
- name: Run Go client tests
run: go test ./docreader/client ./docreader/proto
- name: Stop DocReader gRPC server
if: always()
run: |
if [ -f /tmp/docreader.pid ]; then
kill "$(cat /tmp/docreader.pid)" 2>/dev/null || true
fi