Skip to content

Commit 74d10ff

Browse files
committed
Build and release fs-storage JNI libraries and publish Java library
1 parent 66c9362 commit 74d10ff

File tree

7 files changed

+144
-58
lines changed

7 files changed

+144
-58
lines changed

.github/workflows/build.yml

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ jobs:
2525
toolchain: nightly # nightly is required for fmt
2626
components: rustfmt, clippy
2727

28+
- name: Set up Cargo Cache
29+
uses: Swatinem/rust-cache@v2
30+
with:
31+
save-if: false
32+
2833
- name: Check
2934
run: cargo check
3035

@@ -33,18 +38,15 @@ jobs:
3338
cargo fmt --all -- --check
3439
cargo clippy --workspace --bins -- -D warnings
3540
36-
- name: Build Debug
37-
run: cargo build --verbose
38-
3941
- name: Run tests
4042
run: cargo test --verbose
4143

42-
- name: Build Release
43-
run: cargo build --verbose --release
44-
4544
- name: Run `ark-cli watch` test
4645
run: ./integration/ark-cli-watch.sh
4746

47+
- name: Build Release
48+
run: cargo build --verbose --release
49+
4850
- name: Install JDK
4951
uses: actions/[email protected]
5052
with:
@@ -68,15 +70,20 @@ jobs:
6870
- name: Install Rust
6971
uses: dtolnay/rust-toolchain@stable
7072

71-
- name: Build Release
72-
run: cargo build --verbose --release
73+
- name: Set up Cargo Cache
74+
uses: Swatinem/rust-cache@v2
75+
with:
76+
save-if: false
7377

7478
- name: Run tests
7579
run: cargo test --workspace --verbose
7680

7781
- name: Run `ark-cli watch` test
7882
run: ./integration/ark-cli-watch.sh
7983

84+
- name: Build Release
85+
run: cargo build --verbose --release
86+
8087
- name: Install JDK
8188
uses: actions/[email protected]
8289
with:
@@ -100,14 +107,16 @@ jobs:
100107
- name: Install Rust
101108
uses: dtolnay/rust-toolchain@stable
102109

103-
- name: Build Release
104-
run: cargo build --verbose --release
110+
- name: Set up Cargo Cache
111+
uses: Swatinem/rust-cache@v2
112+
with:
113+
save-if: false
105114

106115
- name: Run tests
107116
run: cargo test --workspace --verbose
108117

109-
- name: Run `ark-cli watch` test
110-
run: ./integration/ark-cli-watch.sh
118+
- name: Build Release
119+
run: cargo build --verbose --release
111120

112121
- name: Install JDK
113122
uses: actions/[email protected]

.github/workflows/release.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "*"
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Install Rust
17+
uses: dtolnay/rust-toolchain@stable
18+
with:
19+
targets: aarch64-linux-android armv7-linux-androideabi i686-linux-android x86_64-linux-android
20+
21+
- name: Set up Cargo Cache
22+
uses: Swatinem/rust-cache@v2
23+
with:
24+
save-if: false
25+
26+
- name: Run tests
27+
run: cargo test --workspace --verbose
28+
29+
- name: Build Release
30+
run: cargo build --verbose --release
31+
32+
- name: Install JDK
33+
uses: actions/[email protected]
34+
with:
35+
distribution: "temurin"
36+
java-version: "22"
37+
38+
- name: Set up Gradle
39+
uses: gradle/actions/setup-gradle@v3
40+
41+
- name: Java tests
42+
run: gradle test
43+
working-directory: ./java
44+
45+
- name: Install cargo-ndk
46+
run: cargo install cargo-ndk
47+
48+
- name: Build fs-storage JNI libs
49+
run: cargo ndk -o ./target/release/fs-storage/jniLibs --target aarch64-linux-android --target armv7-linux-androideabi --target i686-linux-android --target x86_64-linux-android build -p fs-storage --release
50+
51+
- name: Create JNI Libraries ZIP
52+
run: |
53+
cd target/release/fs-storage
54+
zip -r ../../../jniLibs.zip jniLibs
55+
cd -
56+
57+
- name: Release JNI Libraries ZIP
58+
uses: ncipollo/release-action@v1
59+
with:
60+
allowUpdates: true
61+
artifacts: "jniLibs.zip"
62+
63+
- name: Publish Java release
64+
run: gradle publish
65+
working-directory: ./java
66+
env:
67+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/weekly.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ jobs:
1919
- name: Install Rust
2020
uses: dtolnay/rust-toolchain@stable
2121

22+
- name: Set up Cargo Cache
23+
uses: Swatinem/rust-cache@v2
24+
with:
25+
save-if: true
26+
2227
- name: Run tests
2328
run: cargo test --workspace --verbose --release
2429

@@ -32,6 +37,11 @@ jobs:
3237
- name: Install Rust
3338
uses: dtolnay/rust-toolchain@stable
3439

40+
- name: Set up Cargo Cache
41+
uses: Swatinem/rust-cache@v2
42+
with:
43+
save-if: true
44+
3545
- name: Run tests
3646
run: cargo test --workspace --verbose --release
3747

@@ -45,6 +55,11 @@ jobs:
4555
- name: Install Rust
4656
uses: dtolnay/rust-toolchain@stable
4757

58+
- name: Set up Cargo Cache
59+
uses: Swatinem/rust-cache@v2
60+
with:
61+
save-if: true
62+
4863
- name: Run tests
4964
run: cargo test --workspace --verbose --release
5065

@@ -58,5 +73,10 @@ jobs:
5873
- name: Install Rust
5974
uses: dtolnay/rust-toolchain@stable
6075

76+
- name: Set up Cargo Cache
77+
uses: Swatinem/rust-cache@v2
78+
with:
79+
save-if: true
80+
6181
- name: Run tests
6282
run: cargo test --workspace --verbose --release

ark-cli/README.md

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,5 @@
11
# Ark-CLI
22

3-
### Installation
4-
5-
To compile you will need openssl libraries and headers:
6-
7-
```shell
8-
# macOS (Homebrew)
9-
$ brew install openssl@3
10-
11-
# macOS (MacPorts)
12-
$ sudo port install openssl
13-
14-
# macOS (pkgsrc)
15-
$ sudo pkgin install openssl
16-
17-
# Arch Linux
18-
$ sudo pacman -S pkg-config openssl
19-
20-
# Debian and Ubuntu
21-
$ sudo apt-get install pkg-config libssl-dev
22-
23-
# Fedora
24-
$ sudo dnf install pkg-config perl-FindBin openssl-devel
25-
26-
# Alpine Linux
27-
$ apk add pkgconfig openssl-dev
28-
```
29-
303
### Usage
314

325
```shell

data-error/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ bench = false
1010

1111
[dependencies]
1212
thiserror = "1"
13-
reqwest = "0.11.11"
13+
reqwest = { version = "0.11.11", features = [ "json", "rustls-tls" ], default-features = false }
1414
serde_json = "1.0.82"
1515
anyhow = "1"
1616
url = { version = "2.2.2", features = ["serde"] }

data-link/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ log = { version = "0.4.17", features = ["release_max_level_off"] }
1313
serde_json = "1.0.82"
1414
serde = { version = "1.0.138", features = ["derive"] }
1515
url = { version = "2.2.2", features = ["serde"] }
16-
reqwest = "0.11.11"
16+
reqwest = { version = "0.11.11", features = [ "json", "rustls-tls" ], default-features = false }
1717
scraper = "0.13.0"
1818
tokio = { version = "1", features = ["full"] }
1919

java/lib/build.gradle.kts

Lines changed: 34 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,20 @@
11
plugins {
2-
// Apply the java-library plugin for API and implementation separation.
3-
`java-library`
2+
`maven-publish` // Apply the maven-publish plugin before java-library for publishing to GitHub Packages.
3+
`java-library` // Apply the java-library plugin for API and implementation separation.
44
}
55

6+
group = "dev.arkbuilders.core"
7+
version = "1.0-SNAPSHOT"
8+
69
repositories {
7-
// Use Maven Central for resolving dependencies.
8-
mavenCentral()
10+
mavenCentral() // Use Maven Central for resolving dependencies.
911
}
1012

1113
dependencies {
12-
// Use JUnit Jupiter for testing.
13-
testImplementation(libs.junit.jupiter)
14-
14+
testImplementation(libs.junit.jupiter) // Use JUnit Jupiter for testing.
1515
testRuntimeOnly("org.junit.platform:junit-platform-launcher")
16-
17-
// This dependency is exported to consumers, that is to say found on their compile classpath.
18-
api(libs.commons.math3)
19-
20-
// This dependency is used internally, and not exposed to consumers on their own compile classpath.
21-
implementation(libs.guava)
16+
api(libs.commons.math3) // This dependency is exported to consumers, that is to say found on their compile classpath.
17+
implementation(libs.guava) // This dependency is used internally, and not exposed to consumers on their own compile classpath.
2218
}
2319

2420
// Apply a specific Java toolchain to ease working on different environments.
@@ -29,14 +25,35 @@ java {
2925
}
3026

3127
tasks.named<Test>("test") {
32-
// Use JUnit Platform for unit tests.
33-
useJUnitPlatform()
34-
// Set the JVM argument for the java.library.path (To import rust compiled library)
35-
val rustLibPath = projectDir.resolve("../../target/release").absolutePath
28+
val rustLibPath = projectDir.resolve("../../target/release").absolutePath // Set the JVM argument for the java.library.path (To import rust compiled library)
29+
useJUnitPlatform() // Use JUnit Platform for unit tests.
3630
jvmArgs = listOf("-Djava.library.path=$rustLibPath")
3731
}
3832

3933
tasks.named<Javadoc>("javadoc") {
4034
options.encoding = "UTF-8"
4135
options.memberLevel = JavadocMemberLevel.PUBLIC
4236
}
37+
38+
publishing {
39+
// Define a Maven publication for the 'maven' repository
40+
publications {
41+
create<MavenPublication>("Maven") {
42+
from(components["java"])
43+
pom {
44+
name.set("fs_storage")
45+
description.set("File system storage bindings for writing key value pairs to disk.")
46+
}
47+
}
48+
}
49+
repositories {
50+
maven {
51+
name = "GitHubPackages"
52+
url = uri("https://maven.pkg.github.com/ARK-Builders/ark-core")
53+
credentials {
54+
username = System.getenv("GITHUB_ACTOR")
55+
password = System.getenv("GITHUB_TOKEN")
56+
}
57+
}
58+
}
59+
}

0 commit comments

Comments
 (0)