Skip to content

Commit f5d7718

Browse files
committed
wip
1 parent 7a24e3b commit f5d7718

File tree

2 files changed

+55
-66
lines changed

2 files changed

+55
-66
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Setup BLST Sources
2+
description: Install SWIG, generate Java sources, download and place native libraries
3+
4+
runs:
5+
using: composite
6+
steps:
7+
- name: Install SWIG
8+
shell: bash
9+
run: sudo apt-get update && sudo apt-get install -y swig
10+
11+
- name: Generate SWIG Java sources
12+
shell: bash
13+
working-directory: supranational/blst/bindings/java
14+
run: |
15+
PKG=supranational/blst
16+
mkdir -p $PKG
17+
swig -c++ -java -package supranational.blst -outdir $PKG \
18+
-D__BLST_BYTES_T__ -o blst_wrap.cpp ../blst.swg
19+
20+
- name: Download all native library artifacts
21+
uses: actions/download-artifact@v4
22+
with:
23+
path: native-libs
24+
25+
- name: Place native libraries into resource directories
26+
shell: bash
27+
run: |
28+
BASE=supranational/blst/bindings/java/supranational/blst
29+
for artifact_dir in native-libs/blst-*/; do
30+
dir_name=$(basename "$artifact_dir")
31+
os_name=$(echo "$dir_name" | sed 's/^blst-//' | sed 's/-[^-]*$//')
32+
arch=$(echo "$dir_name" | sed 's/.*-//')
33+
34+
target_dir="$BASE/$os_name/$arch"
35+
mkdir -p "$target_dir"
36+
37+
find "$artifact_dir" -type f \( -name "*.so" -o -name "*.dylib" -o -name "*.dll" \) \
38+
-exec cp {} "$target_dir/" \;
39+
40+
echo "Placed: $(ls "$target_dir") -> $target_dir"
41+
done
42+
43+
echo "Final native library layout:"
44+
find "$BASE" -type f

.github/workflows/build_blst.yaml

Lines changed: 11 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@ jobs:
3939
name: test-results
4040
path: target/surefire-reports/
4141

42+
- name: Upload coverage report
43+
if: always()
44+
uses: actions/upload-artifact@v4
45+
with:
46+
name: coverage-report
47+
path: target/site/jacoco/
48+
4249
build-blst:
4350
name: Build blst (${{ matrix.os-name }}/${{ matrix.arch }})
4451
if: github.event_name == 'release'
@@ -228,42 +235,8 @@ jobs:
228235
java-version: '21'
229236
cache: maven
230237

231-
- name: Install SWIG
232-
run: sudo apt-get update && sudo apt-get install -y swig
233-
234-
- name: Generate SWIG Java sources
235-
working-directory: supranational/blst/bindings/java
236-
run: |
237-
PKG=supranational/blst
238-
mkdir -p $PKG
239-
swig -c++ -java -package supranational.blst -outdir $PKG \
240-
-D__BLST_BYTES_T__ -o blst_wrap.cpp ../blst.swg
241-
242-
- name: Download all native library artifacts
243-
uses: actions/download-artifact@v4
244-
with:
245-
path: native-libs
246-
247-
- name: Place native libraries into resource directories
248-
run: |
249-
BASE=supranational/blst/bindings/java/supranational/blst
250-
for artifact_dir in native-libs/blst-*/; do
251-
dir_name=$(basename "$artifact_dir")
252-
# Extract OS name and arch from "blst-{OS}-{arch}"
253-
os_name=$(echo "$dir_name" | sed 's/^blst-//' | sed 's/-[^-]*$//')
254-
arch=$(echo "$dir_name" | sed 's/.*-//')
255-
256-
target_dir="$BASE/$os_name/$arch"
257-
mkdir -p "$target_dir"
258-
259-
find "$artifact_dir" -type f \( -name "*.so" -o -name "*.dylib" -o -name "*.dll" \) \
260-
-exec cp {} "$target_dir/" \;
261-
262-
echo "Placed: $(ls "$target_dir") -> $target_dir"
263-
done
264-
265-
echo "Final native library layout:"
266-
find "$BASE" -type f
238+
- name: Setup BLST sources and native libraries
239+
uses: ./.github/actions/setup-blst-sources
267240

268241
- name: Build and test with Maven
269242
run: mvn clean test
@@ -289,36 +262,8 @@ jobs:
289262
java-version: '21'
290263
cache: maven
291264

292-
- name: Install SWIG
293-
run: sudo apt-get update && sudo apt-get install -y swig
294-
295-
- name: Generate SWIG Java sources
296-
working-directory: supranational/blst/bindings/java
297-
run: |
298-
PKG=supranational/blst
299-
mkdir -p $PKG
300-
swig -c++ -java -package supranational.blst -outdir $PKG \
301-
-D__BLST_BYTES_T__ -o blst_wrap.cpp ../blst.swg
302-
303-
- name: Download all native library artifacts
304-
uses: actions/download-artifact@v4
305-
with:
306-
path: native-libs
307-
308-
- name: Place native libraries into resource directories
309-
run: |
310-
BASE=supranational/blst/bindings/java/supranational/blst
311-
for artifact_dir in native-libs/blst-*/; do
312-
dir_name=$(basename "$artifact_dir")
313-
os_name=$(echo "$dir_name" | sed 's/^blst-//' | sed 's/-[^-]*$//')
314-
arch=$(echo "$dir_name" | sed 's/.*-//')
315-
316-
target_dir="$BASE/$os_name/$arch"
317-
mkdir -p "$target_dir"
318-
319-
find "$artifact_dir" -type f \( -name "*.so" -o -name "*.dylib" -o -name "*.dll" \) \
320-
-exec cp {} "$target_dir/" \;
321-
done
265+
- name: Setup BLST sources and native libraries
266+
uses: ./.github/actions/setup-blst-sources
322267

323268
- name: Publish to GitHub Packages
324269
run: mvn deploy -DskipTests

0 commit comments

Comments
 (0)