Skip to content

Commit e497983

Browse files
committed
refactor: Use JAR artifact sharing instead of Docker on macOS/Windows
- Linux job downloads JARs from Docker and uploads as artifact - macOS/Windows jobs download JAR artifact (no Docker needed) - build-native.sh uses existing JARs if present - Eliminates Docker/Colima requirement on macOS/Windows
1 parent 387ce38 commit e497983

3 files changed

Lines changed: 126 additions & 43 deletions

File tree

.github/workflows/release-python-packages.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,17 +86,54 @@ jobs:
8686
include:
8787
- platform: linux/amd64
8888
runs-on: ubuntu-latest
89+
download-jars: true # Only Linux downloads JARs
8990
- platform: darwin/amd64
9091
runs-on: macos-13
92+
download-jars: false
9193
- platform: darwin/arm64
9294
runs-on: macos-latest
95+
download-jars: false
9396
- platform: windows/amd64
9497
runs-on: windows-latest
98+
download-jars: false
9599

96100
steps:
97101
- name: Checkout code
98102
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
99103

104+
- name: Download ArcadeDB JARs (Linux only)
105+
if: matrix.download-jars
106+
shell: bash
107+
run: |
108+
cd bindings/python
109+
110+
# Detect ArcadeDB version
111+
ARCADEDB_TAG=$(../../extract_version.py)
112+
echo "📌 ArcadeDB version: $ARCADEDB_TAG"
113+
114+
# Download JARs from official Docker image
115+
echo "📦 Downloading JARs from arcadedata/arcadedb:$ARCADEDB_TAG..."
116+
docker run --rm -v "$(pwd)/src/arcadedb_embedded/jars:/output" \
117+
arcadedata/arcadedb:$ARCADEDB_TAG \
118+
sh -c 'cp /home/arcadedb/lib/*.jar /output/'
119+
120+
ls -lh src/arcadedb_embedded/jars/
121+
122+
- name: Upload JARs as artifact (Linux only)
123+
if: matrix.download-jars
124+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
125+
with:
126+
name: arcadedb-jars
127+
path: bindings/python/src/arcadedb_embedded/jars/*.jar
128+
retention-days: 1
129+
130+
- name: Download JARs artifact (non-Linux only)
131+
if: ${{ ! matrix.download-jars }}
132+
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
133+
with:
134+
name: arcadedb-jars
135+
path: bindings/python/src/arcadedb_embedded/jars
136+
100137
- name: Set up Python
101138
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
102139
with:
@@ -114,6 +151,7 @@ jobs:
114151
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
115152

116153
- name: Write version file for build
154+
shell: bash
117155
run: |
118156
cd bindings/python
119157
# Use tag version directly

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

Lines changed: 49 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,49 @@ on:
1414
workflow_dispatch:
1515

1616
jobs:
17+
# First job: Download ArcadeDB JARs (platform-agnostic)
18+
download-jars:
19+
name: Download ArcadeDB JARs
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
24+
25+
- name: Set up Docker Buildx
26+
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
27+
28+
- name: Download JARs from ArcadeDB Docker image
29+
shell: bash
30+
run: |
31+
cd bindings/python
32+
33+
# Detect ArcadeDB version from pom.xml
34+
ARCADEDB_TAG=$(../../extract_version.py)
35+
echo "📌 ArcadeDB version: $ARCADEDB_TAG"
36+
37+
# Download JARs from official Docker image
38+
echo "📦 Downloading JARs from arcadedata/arcadedb:$ARCADEDB_TAG..."
39+
docker run --rm -v "$(pwd)/src/arcadedb_embedded/jars:/output" \
40+
arcadedata/arcadedb:$ARCADEDB_TAG \
41+
sh -c 'cp /home/arcadedb/lib/*.jar /output/'
42+
43+
# Verify JARs were downloaded
44+
ls -lh src/arcadedb_embedded/jars/
45+
JAR_COUNT=$(ls -1 src/arcadedb_embedded/jars/*.jar 2>/dev/null | wc -l)
46+
echo "✅ Downloaded $JAR_COUNT JAR files"
47+
48+
- name: Upload JARs as artifact
49+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
50+
with:
51+
name: arcadedb-jars
52+
path: bindings/python/src/arcadedb_embedded/jars/*.jar
53+
retention-days: 1
54+
55+
# Second job: Build and test on each platform
1756
test:
1857
name: Test arcadedb-embedded (${{ matrix.platform }})
1958
runs-on: ${{ matrix.runs-on }}
59+
needs: download-jars
2060
strategy:
2161
# Don't cancel other matrix jobs if one fails
2262
fail-fast: false
@@ -35,21 +75,19 @@ jobs:
3575
- name: Checkout code
3676
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
3777

78+
- name: Download ArcadeDB JARs artifact
79+
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
80+
with:
81+
name: arcadedb-jars
82+
path: bindings/python/src/arcadedb_embedded/jars
83+
3884
- name: Set up Java (for native builds on macOS/Windows)
3985
if: matrix.platform != 'linux/amd64'
4086
uses: actions/setup-java@7a6d8a8234af8eb26422e24e3006232cccaa061b # v4.6.0
4187
with:
4288
distribution: 'temurin'
4389
java-version: '21'
4490

45-
# Docker is needed on all platforms to download ArcadeDB JARs
46-
- name: Set up Docker (macOS)
47-
if: startsWith(matrix.platform, 'darwin/')
48-
run: |
49-
# Docker Desktop is pre-installed on macOS runners but may need to be started
50-
# GitHub's macos runners have Docker available
51-
docker version || echo "Docker not available"
52-
5391
- name: Set up Docker Buildx (Linux only)
5492
if: matrix.platform == 'linux/amd64'
5593
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
@@ -62,6 +100,7 @@ jobs:
62100
./build.sh ${{ matrix.platform }}
63101
64102
- name: Extract wheel for additional testing
103+
shell: bash
65104
run: |
66105
cd bindings/python
67106
mkdir -p test-install
@@ -76,12 +115,14 @@ jobs:
76115
# This package works without any external Java installation!
77116

78117
- name: Install wheel and test dependencies
118+
shell: bash
79119
run: |
80120
cd bindings/python
81121
pip install test-install/*.whl pytest pytest-cov requests
82122
83123
- name: Run pytest on host
84124
id: pytest
125+
shell: bash
85126
run: |
86127
cd bindings/python
87128
echo "🧪 Testing arcadedb-embedded (with bundled JRE)..."

bindings/python/build-native.sh

Lines changed: 39 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -53,32 +53,40 @@ if ! command -v jlink &> /dev/null; then
5353
exit 1
5454
fi
5555

56-
# Check for Docker (needed to download JARs from ArcadeDB image)
57-
if ! command -v docker &> /dev/null; then
58-
echo -e "${RED}❌ Docker not found${NC}"
59-
echo -e "${YELLOW}💡 Docker is required to download ArcadeDB JARs from the official image${NC}"
60-
echo -e "${YELLOW}💡 Please install Docker: https://www.docker.com/get-started${NC}"
61-
exit 1
62-
fi
63-
6456
echo ""
6557

66-
# Step 1: Download ArcadeDB JARs from Docker image
67-
echo -e "${CYAN}📥 Downloading ArcadeDB JARs from Docker image...${NC}"
68-
TEMP_JARS=$(mktemp -d)
58+
# Step 1: Download ArcadeDB JARs (if not already present)
59+
JARS_DIR="$SCRIPT_DIR/src/arcadedb_embedded/jars"
60+
if [[ -d "$JARS_DIR" ]] && [[ $(ls -1 "$JARS_DIR"/*.jar 2> /dev/null | wc -l) -gt 0 ]]; then
61+
echo -e "${GREEN}✅ Using existing JARs from: $JARS_DIR${NC}"
62+
JAR_COUNT=$(ls -1 "$JARS_DIR"/*.jar | wc -l)
63+
echo -e "${CYAN}📦 Found $JAR_COUNT JAR files${NC}"
64+
else
65+
# Check for Docker (needed to download JARs from ArcadeDB image)
66+
if ! command -v docker &> /dev/null; then
67+
echo -e "${RED}❌ Docker not found and JARs not present${NC}"
68+
echo -e "${YELLOW}💡 Either:${NC}"
69+
echo -e "${YELLOW} 1. Install Docker to download JARs: https://www.docker.com/get-started${NC}"
70+
echo -e "${YELLOW} 2. Or manually place JARs in: $JARS_DIR${NC}"
71+
exit 1
72+
fi
73+
74+
echo -e "${CYAN}📥 Downloading ArcadeDB JARs from Docker image...${NC}"
75+
TEMP_JARS=$(mktemp -d)
76+
77+
if ! docker run --rm arcadedata/arcadedb:${ARCADEDB_TAG} tar -cf - -C /home/arcadedb lib | tar -xf - -C "$TEMP_JARS"; then
78+
echo -e "${RED}❌ Failed to download JARs from Docker image${NC}"
79+
echo -e "${YELLOW}💡 Make sure Docker is running and you have internet access${NC}"
80+
rm -rf "$TEMP_JARS"
81+
exit 1
82+
fi
6983

70-
if ! docker run --rm arcadedata/arcadedb:${ARCADEDB_TAG} tar -cf - -C /home/arcadedb lib | tar -xf - -C "$TEMP_JARS"; then
71-
echo -e "${RED}❌ Failed to download JARs from Docker image${NC}"
72-
echo -e "${YELLOW}💡 Make sure Docker is running and you have internet access${NC}"
84+
mkdir -p "$JARS_DIR"
85+
cp "$TEMP_JARS/lib"/*.jar "$JARS_DIR/"
7386
rm -rf "$TEMP_JARS"
74-
exit 1
87+
echo -e "${GREEN}✅ JARs downloaded to: $JARS_DIR${NC}"
7588
fi
7689

77-
rm -rf "$SCRIPT_DIR/temp_jars"
78-
mv "$TEMP_JARS/lib" "$SCRIPT_DIR/temp_jars"
79-
rm -rf "$TEMP_JARS"
80-
echo -e "${GREEN}✅ JARs downloaded${NC}"
81-
8290
# Step 2: Build minimal JRE with jlink
8391
echo -e "${CYAN}🔨 Building minimal JRE with jlink...${NC}"
8492
REQUIRED_MODULES="java.base,java.compiler,java.desktop,java.logging,java.management,java.naming,java.prefs,java.rmi,java.scripting,java.security.jgss,java.security.sasl,java.sql,java.transaction.xa,java.xml,jdk.incubator.vector,jdk.internal.vm.ci,jdk.jfr,jdk.management,jdk.sctp,jdk.unsupported,jdk.zipfs"
@@ -98,25 +106,22 @@ echo -e "${GREEN}✅ JRE built${NC}"
98106
JRE_SIZE=$(du -sh "$SCRIPT_DIR/temp_jre" | cut -f1)
99107
echo -e "${CYAN}📊 JRE size: ${YELLOW}${JRE_SIZE}${NC}"
100108

101-
# Step 3: Copy JARs and JRE to package
109+
# Step 3: Copy JRE to package (JARs already in place)
102110
echo -e "${CYAN}📦 Preparing package...${NC}"
103-
rm -rf "$SCRIPT_DIR/src/arcadedb_embedded/jars"
104-
rm -rf "$SCRIPT_DIR/src/arcadedb_embedded/jre"
105-
mkdir -p "$SCRIPT_DIR/src/arcadedb_embedded/jars"
106-
mkdir -p "$SCRIPT_DIR/src/arcadedb_embedded/jre"
107111

108-
# Copy JARs (excluding gRPC wire protocol)
109-
for jar in "$SCRIPT_DIR/temp_jars"/*.jar; do
110-
jar_name=$(basename "$jar")
111-
if [[ "$jar_name" != *"arcadedb-grpcw-"* ]]; then
112-
cp "$jar" "$SCRIPT_DIR/src/arcadedb_embedded/jars/"
113-
fi
114-
done
112+
# Clean up: Remove gRPC wire protocol JAR if present (not needed)
113+
if ls "$JARS_DIR"/arcadedb-grpcw-*.jar 1> /dev/null 2>&1; then
114+
rm -f "$JARS_DIR"/arcadedb-grpcw-*.jar
115+
echo -e "${YELLOW}🗑️ Removed gRPC wire protocol JAR (not needed)${NC}"
116+
fi
115117

116-
# Copy JRE
118+
# Build and copy JRE
119+
rm -rf "$SCRIPT_DIR/src/arcadedb_embedded/jre"
120+
mkdir -p "$SCRIPT_DIR/src/arcadedb_embedded/jre"
117121
cp -R "$SCRIPT_DIR/temp_jre"/* "$SCRIPT_DIR/src/arcadedb_embedded/jre/"
118122

119-
echo -e "${GREEN}✅ Package prepared${NC}"
123+
JAR_COUNT=$(ls -1 "$JARS_DIR"/*.jar | wc -l)
124+
echo -e "${GREEN}✅ Package prepared (${JAR_COUNT} JARs + JRE)${NC}"
120125

121126
# Step 4: Write version to pyproject.toml
122127
echo -e "${CYAN}📝 Writing version...${NC}"
@@ -186,7 +191,6 @@ echo -e "${GREEN}✅ Wheel built${NC}"
186191

187192
# Step 6: Clean up temp files
188193
echo -e "${CYAN}🧹 Cleaning up...${NC}"
189-
rm -rf "$SCRIPT_DIR/temp_jars"
190194
rm -rf "$SCRIPT_DIR/temp_jre"
191195

192196
echo ""

0 commit comments

Comments
 (0)