Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix publish ci #7

Merged
merged 20 commits into from
Apr 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Docs
on:
workflow_dispatch:
push:
branches: [ main, fix-docs-ci ]
branches: [ main ]
tags:
- 'v*'
jobs:
Expand Down
87 changes: 83 additions & 4 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,93 @@ on:
tags:
- 'v*'
jobs:

build_rust_libs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, ubuntu-latest]
rust: [stable]
java: [8, 11, 15, 16]
steps:
- uses: actions/checkout@v2

- name: Install ${{ matrix.rust }}
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
override: true

- name: Setup java
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}

- name: Build Rust
run: ./gradlew rust-deploy

- name: "Upload Rust Static lib for ${{matrix.os}} for java - ${{matrix.java}}"
uses: actions/upload-artifact@v2
with:
name: "${{matrix.os}}-${{matrix.java}}"
path: ./fluvio/libs/
retention-days: 5

- name: 'Upload Java src - linux'
uses: actions/upload-artifact@v2
if: startsWith(matrix.os, 'ubuntu')
with:
name: "java-src-${{matrix.java}}"
path: ./fluvio/src/main/java/com/infinyon/fluvio/
retention-days: 5

publish:
runs-on: ubuntu-latest
runs-on: [ubuntu-latest]
needs: [build_rust_libs]
strategy:
matrix:
rust: [stable]
java: [8, 11, 15, 16]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-java@v1

- name: Install ${{ matrix.rust }}
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
override: true

- name: Setup java
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}

- name: Download MacOS Lib
uses: actions/download-artifact@v2
with:
name: "macos-latest-${{matrix.java}}"
path: ./fluvio/libs/

- name: Download Linux Lib
uses: actions/download-artifact@v2
with:
name: "ubuntu-latest-${{matrix.java}}"
path: ./fluvio/libs/

- name: Download Java src
uses: actions/download-artifact@v2
with:
java-version: 1.8
name: "java-src-${{matrix.java}}"
path: ./fluvio/src/main/java/com/infinyon/fluvio/

- name: Publish local
run: |
make publish-local
ls ./fluvio/libs/ ./fluvio/build/resources/main/
jar tf ~/.m2/repository/com/infinyon/fluvio-*/*/fluvio-*-*.jar

- name: Publish package
run: gradle publish
run: |
make publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,8 @@ clean:
docs:
$(GRADLE) javadoc

publish-local:
$(GRADLE) publishToMavenLocal -x rust-deploy

publish:
$(GRADLE) publish
$(GRADLE) publish -x rust-deploy
31 changes: 30 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

## Documentation
Fluvio client uses javadoc to generate the client API
[documentation](https://infinyon.github.io/fluvio-client-java/javadoc/com/infinyon/fluvio/package-summary.html).
[documentation](https://infinyon.github.io/fluvio-client-java/).

Note: topic creation and deletion is not yet supported in this client.

Expand All @@ -24,6 +24,35 @@ project](https://github.com/infinyon/fluvio-client-java/tree/main/examples) and
our
[`Simple.java`](https://github.com/infinyon/fluvio-client-java/blob/main/examples/src/main/java/com/fluvio/example/Simple.java).

Make sure your `build.gradle` has the `maven` section below
```groovy
repositories {
jcenter()
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/infinyon/fluvio-client-java")
}
}
```
and add `com.infinyon:fluvio-16:0.0.0` as a dependency. The section should look
something like:
```groovy
dependencies {
// Use JUnit test framework.
testImplementation 'junit:junit:4.13'

// This dependency is used by the application.
implementation 'com.google.guava:guava:29.0-jre'

implementation 'com.infinyon:fluvio-16:0.0.0'
}
```

The `artfiactId` is dependent on the version of java. See [our
packages](https://github.com/orgs/infinyon/packages?repo_name=fluvio-client-java)
to see the published versions. If there's a version you'd like to be published
please [open an issue](https://github.com/infinyon/fluvio-client-java/issues).

# Developer Notes

Ensure that `JAVA_ROOT` points to the base directory for the java installation.
Expand Down
17 changes: 4 additions & 13 deletions fluvio/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,11 @@ plugins {
id 'maven-publish'
}
group 'com.infinyon'
version '0.0.0'
version '0.0.1'

repositories {
// Use JCenter for resolving dependencies.
jcenter()
flatDir {
dirs 'libs'
}
}

sourceSets {
Expand Down Expand Up @@ -74,17 +71,12 @@ tasks.create(name: "cargo-build", type: Exec, description: "Running Cargo build"
workingDir rustBasePath
commandLine 'cargo', 'build', '--release'
}
tasks.create(name: "sync-rust-deps", type: Sync, dependsOn: "cargo-build") {

tasks.create(name: "rust-deploy", type: Sync, dependsOn: "cargo-build") {
from "${project.ext.cargo_target_directory}/release"
include "*.dylib","*.so"
into "libs/"
}
// Copy build libs into this app's libs directory
tasks.create(name: "rust-deploy", type: Copy, dependsOn: "sync-rust-deps", description: "Copy rust libs to jniLibs") {
from "${project.ext.cargo_target_directory}/release"
include "*.dylib","*.so"
into "${buildDir}/libs/shared/"
}

// Hook up tasks to execute before building java
tasks.withType(JavaCompile) {
Expand Down Expand Up @@ -118,9 +110,8 @@ publishing {
}
publications {
gpr(MavenPublication) {
groupId 'com.infinyon'
artifactId 'fluvio'
from(components.java)
artifactId "fluvio-${JavaVersion.current()}"
}
}
}
8 changes: 8 additions & 0 deletions fluvio/src/main/java/com/infinyon/fluvio/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Fluvio.java
FluvioError.java
InternalPointerMarker.java
Offset.java
PartitionConsumer.java
PartitionConsumerStream.java
Record.java
TopicProducer.java