Repository navigation
129 lines (125 loc) · 5.03 KB
/
Copy pathhugegraph-python-client.yml
File metadata and controls
129 lines (125 loc) · 5.03 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
name: HG-Python-Client CI
on:
workflow_call:
inputs:
python-versions:
type: string
required: true
integration-python:
type: string
required: true
uv-version:
type: string
required: true
server-image:
type: string
required: true
version:
type: string
required: true
permissions:
contents: read
jobs:
tests:
name: client / Python ${{ matrix.python-version }} / ${{ matrix.server-profile }}
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
python-version: ${{ fromJSON(inputs.python-versions) }}
server-profile: [latest]
include:
- python-version: ${{ inputs.integration-python }}
server-profile: compatibility
services:
hugegraph:
image: ${{ matrix.python-version == inputs.integration-python && (matrix.server-profile == 'compatibility' && 'hugegraph/hugegraph:1.7.0' || inputs.server-image) || '' }}
env:
PASSWORD: admin
options: >-
--health-cmd="curl -f http://localhost:8080/versions || exit 1"
--health-interval=10s --health-timeout=5s --health-retries=12 --health-start-period=90s
ports:
- 8080:8080
env:
HUGEGRAPH_URL: http://127.0.0.1:8080
HUGEGRAPH_GRAPH: hugegraph
HUGEGRAPH_USER: admin
HUGEGRAPH_PASSWORD: admin
HUGEGRAPH_REQUIRED: 'true'
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- uses: ./.github/actions/setup-python-env
id: python-env
with:
python-version: ${{ matrix.python-version }}
uv-version: ${{ inputs.uv-version }}
component: client
- name: Install client and test dependencies
run: uv sync --extra python-client --extra dev
- name: Verify source archive build and installation
if: matrix.python-version == inputs.integration-python
run: |
archive_dir=$(mktemp -d)
trap 'rm -rf "$archive_dir"' EXIT
git archive HEAD | tar -x -C "$archive_dir"
test ! -e "$archive_dir/hugegraph-ml"
test ! -e "$archive_dir/docker"
uv build --all-packages "$archive_dir" --out-dir "$archive_dir/dist"
uv sync --project "$archive_dir" --all-packages
uv pip check --python "$archive_dir/.venv/bin/python"
- name: Type check client (advisory while existing diagnostics are resolved)
if: matrix.python-version == inputs.integration-python
continue-on-error: true
run: uv run --no-sync ty check hugegraph-python-client/src/pyhugegraph
- name: Check REST contract synchronization
run: python3 scripts/client_api.py --check
- name: Run unit and contract tests
run: >-
uv run --no-sync pytest hugegraph-python-client/src/tests -m "unit or contract"
--cov=pyhugegraph --cov-fail-under=45 --cov-report=term
--cov-report=xml:client-unit-contract.xml -v --tb=short --durations=20
- name: Verify HugeGraph image and version
if: matrix.python-version == inputs.integration-python
env:
EXPECTED_SERVER_VERSION: ${{ matrix.server-profile == 'compatibility' && '1.7.0' || inputs.version }}
HUGEGRAPH_CONTAINER_ID: ${{ job.services.hugegraph.id }}
run: bash scripts/check_hugegraph.sh "$EXPECTED_SERVER_VERSION" "$HUGEGRAPH_CONTAINER_ID"
- name: Run HugeGraph integration tests
if: matrix.python-version == inputs.integration-python
run: uv run --no-sync pytest hugegraph-python-client/src/tests -m "integration and hugegraph" -v --tb=short
- uses: actions/upload-artifact@v7
with:
name: client-unit-contract-coverage-${{ matrix.python-version }}-${{ matrix.server-profile }}
path: client-unit-contract.xml
retention-days: 7
if-no-files-found: error
- name: Dump HugeGraph diagnostics
if: failure() && matrix.python-version == inputs.integration-python
run: |
docker ps -a
docker logs "${{ job.services.hugegraph.id }}"
- name: Prune uv cache before upload
if: always() && steps.python-env.outcome == 'success'
run: uv cache prune --ci