Skip to content

Commit 08ab279

Browse files
committed
feat: enhance Python workflows with caching and shared asset preparation
1 parent 8d962cc commit 08ab279

2 files changed

Lines changed: 245 additions & 40 deletions

File tree

.github/workflows/test-python-bindings.yml

Lines changed: 38 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ on:
3232
permissions:
3333
contents: read
3434

35+
env:
36+
UV_CACHE_DIR: ${{ github.workspace }}/.cache/uv
37+
3538
jobs:
3639
# First job: Download ArcadeDB JARs (platform-agnostic)
3740
download-jars:
@@ -41,10 +44,19 @@ jobs:
4144
- name: Checkout code
4245
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
4346

47+
- name: Restore cached ArcadeDB JARs
48+
id: jars-cache
49+
uses: actions/cache/restore@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
50+
with:
51+
path: bindings/python/src/arcadedb_embedded/jars
52+
key: python-jars-${{ hashFiles('pom.xml', 'bindings/python/extract_version.py', 'bindings/python/jar_exclusions.txt') }}
53+
4454
- name: Set up Docker Buildx
55+
if: steps.jars-cache.outputs.cache-hit != 'true'
4556
uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd # v4.0.0
4657

4758
- name: Download JARs from ArcadeDB Docker image
59+
if: steps.jars-cache.outputs.cache-hit != 'true'
4860
shell: bash
4961
run: |
5062
cd bindings/python
@@ -70,6 +82,7 @@ jobs:
7082
echo "✅ Downloaded $JAR_COUNT JAR files"
7183
7284
- name: Remove excluded JARs
85+
if: steps.jars-cache.outputs.cache-hit != 'true'
7386
shell: bash
7487
run: |
7588
cd bindings/python
@@ -103,6 +116,13 @@ jobs:
103116
echo "⚠️ No jar_exclusions.txt found, skipping exclusions"
104117
fi
105118
119+
- name: Save ArcadeDB JAR cache
120+
if: steps.jars-cache.outputs.cache-hit != 'true'
121+
uses: actions/cache/save@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
122+
with:
123+
path: bindings/python/src/arcadedb_embedded/jars
124+
key: python-jars-${{ hashFiles('pom.xml', 'bindings/python/extract_version.py', 'bindings/python/jar_exclusions.txt') }}
125+
106126
- name: Upload filtered JARs as artifact
107127
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
108128
with:
@@ -154,6 +174,16 @@ jobs:
154174
with:
155175
python-version: ${{ matrix.python-version }}
156176

177+
- name: Restore uv cache
178+
id: uv-cache
179+
uses: actions/cache/restore@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
180+
with:
181+
path: ${{ env.UV_CACHE_DIR }}
182+
key: uv-bindings-${{ runner.os }}-py${{ matrix.python-version }}-${{ hashFiles('bindings/python/pyproject.toml', '.github/workflows/test-python-bindings.yml') }}
183+
restore-keys: |
184+
uv-bindings-${{ runner.os }}-py${{ matrix.python-version }}-
185+
uv-bindings-${{ runner.os }}-
186+
157187
- name: Setup UV package manager
158188
shell: bash
159189
run: |
@@ -163,9 +193,6 @@ jobs:
163193
uv --version
164194
165195
- name: Download ArcadeDB JARs artifact
166-
# Skip for Linux: Docker build downloads JARs from ArcadeDB image directly
167-
# Only needed for native builds (macOS/Windows)
168-
if: matrix.platform != 'linux/amd64' && matrix.platform != 'linux/arm64'
169196
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
170197
with:
171198
name: arcadedb-jars
@@ -208,7 +235,7 @@ jobs:
208235
run: |
209236
cd bindings/python
210237
echo "🔨 Building arcadedb-embedded for ${{ matrix.platform }} with Python ${{ matrix.python-version }}..."
211-
./build.sh ${{ matrix.platform }} ${{ matrix.python-version }}
238+
./build.sh ${{ matrix.platform }} ${{ matrix.python-version }} src/arcadedb_embedded/jars
212239
213240
- name: Extract wheel for additional testing
214241
shell: bash
@@ -413,6 +440,13 @@ jobs:
413440
path: bindings/python/dist/*.whl
414441
retention-days: 7
415442

443+
- name: Save uv cache
444+
if: always() && steps.uv-cache.outputs.cache-hit != 'true'
445+
uses: actions/cache/save@668228422ae6a00e4ad889ee87cd7109ec5666a7 # v5.0.4
446+
with:
447+
path: ${{ env.UV_CACHE_DIR }}
448+
key: uv-bindings-${{ runner.os }}-py${{ matrix.python-version }}-${{ hashFiles('bindings/python/pyproject.toml', '.github/workflows/test-python-bindings.yml') }}
449+
416450
# Summary job that checks all platforms
417451
test-summary:
418452
name: Test Summary

0 commit comments

Comments
 (0)