Skip to content

Commit 0a33550

Browse files
authored
refactor: use uv for the CI action (#175)
* refactor: use uv for the CI action * Update pylint.yml * refactor client * Update hugegraph-python-client.yml * Update hugegraph-python-client.yml * Update hugegraph-python-client.yml * Update hugegraph-python-client.yml * Update hugegraph-python-client.yml * Update hugegraph-python-client.yml * Update hugegraph-python-client.yml * Update hugegraph-python-client.yml * Update hugegraph-python-client.yml * Update hugegraph-python-client.yml * Update hugegraph-python-client.yml * Update hugegraph-python-client.yml
1 parent d01e07e commit 0a33550

File tree

2 files changed

+68
-14
lines changed

2 files changed

+68
-14
lines changed

.github/workflows/hugegraph-python-client.yml

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,29 +13,57 @@ jobs:
1313
fail-fast: false
1414
matrix:
1515
python-version: ["3.9", "3.10", "3.11", "3.12"]
16+
1617
steps:
18+
# TODO: upgrade to HugeGraph 1.5.0 (need to update the test cases)
19+
- name: Prepare HugeGraph Server Environment
20+
run: |
21+
docker run -d --name=graph -p 8080:8080 -e PASSWORD=admin hugegraph/hugegraph:1.3.0
22+
#sleep 5
23+
1724
- uses: actions/checkout@v4
25+
1826
- name: Set up Python ${{ matrix.python-version }}
1927
uses: actions/setup-python@v5
2028
with:
2129
python-version: ${{ matrix.python-version }}
22-
cache: 'pip'
23-
- name: Install dependencies
30+
31+
- name: Install uv
2432
run: |
25-
python -m pip install --upgrade pip
26-
pip install pytest
27-
pip install -r ./hugegraph-python-client/requirements.txt
28-
- name: Prepare HugeGraph Server Environment
29-
# TODO: update the HugeGraph Server version to 1.5.0
33+
curl -LsSf https://astral.sh/uv/install.sh | sh
34+
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
35+
36+
- name: Cache dependencies
37+
id: cache-deps
38+
uses: actions/cache@v4
39+
with:
40+
path: |
41+
.venv
42+
~/.cache/uv
43+
~/.cache/pip
44+
key: ${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('hugegraph-python-client/requirements.txt') }}
45+
restore-keys: |
46+
${{ runner.os }}-venv-${{ matrix.python-version }}-
47+
${{ runner.os }}-venv-
48+
49+
# TODO: use pyproject.toml later
50+
- name: Install dependencies
51+
if: steps.cache-deps.outputs.cache-hit != 'true'
3052
run: |
31-
docker run -d --name=graph -p 8080:8080 -e PASSWORD=admin hugegraph/hugegraph:1.3.0
32-
sleep 20
53+
uv venv
54+
source .venv/bin/activate
55+
uv pip install pytest
56+
uv pip install -r ./hugegraph-python-client/requirements.txt
57+
3358
- name: Test example
3459
run: |
60+
ls -al && source .venv/bin/activate
3561
export PYTHONPATH=$(pwd)/hugegraph-python-client/src
3662
echo ${PYTHONPATH}
3763
python hugegraph-python-client/src/pyhugegraph/example/hugegraph_example.py
64+
3865
- name: Test with pytest
3966
run: |
67+
ls -al ../ && source ../.venv/bin/activate
4068
pytest
4169
working-directory: hugegraph-python-client

.github/workflows/pylint.yml

Lines changed: 31 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,47 @@ jobs:
1717

1818
steps:
1919
- uses: actions/checkout@v4
20+
2021
- name: Setup Python ${{ matrix.python-version }}
2122
uses: actions/setup-python@v5
2223
with:
2324
python-version: ${{ matrix.python-version }}
24-
cache: 'pip'
25+
26+
- name: Install uv
27+
run: |
28+
curl -LsSf https://astral.sh/uv/install.sh | sh
29+
echo "$HOME/.cargo/bin" >> $GITHUB_PATH
30+
31+
- name: Cache dependencies
32+
id: cache-deps
33+
uses: actions/cache@v4
34+
with:
35+
path: |
36+
.venv
37+
~/.cache/uv
38+
~/.cache/pip
39+
key: ${{ runner.os }}-venv-${{ matrix.python-version }}-${{ hashFiles('**/requirements.txt', '**/pyproject.toml') }}
40+
restore-keys: |
41+
${{ runner.os }}-venv-${{ matrix.python-version }}-
42+
${{ runner.os }}-venv-
2543
2644
- name: Install dependencies
45+
if: steps.cache-deps.outputs.cache-hit != 'true'
2746
run: |
28-
pip install pylint pytest
29-
pip install -r ./hugegraph-llm/requirements.txt
30-
pip install -r ./hugegraph-ml/requirements.txt
31-
pip install -r ./hugegraph-python-client/requirements.txt
47+
uv venv
48+
source .venv/bin/activate
49+
uv pip install pylint pytest
50+
# TODO: use pyproject.toml later (unify all projects)
51+
uv pip install -r ./hugegraph-llm/requirements.txt
52+
uv pip install -r ./hugegraph-ml/requirements.txt
53+
uv pip install -r ./hugegraph-python-client/requirements.txt
54+
3255
- name: Check DGL version
3356
run: |
57+
source .venv/bin/activate
3458
python -c "import dgl; print(dgl.__version__)"
59+
3560
- name: Analysing the code with pylint
3661
run: |
62+
source .venv/bin/activate
3763
bash ./style/code_format_and_analysis.sh -p

0 commit comments

Comments
 (0)