-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- split jvm build from publication - split github/maven into their own jobs - make github publication depend on maven one
- Loading branch information
1 parent
64593b7
commit 092f2e4
Showing
4 changed files
with
177 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
name: Build (JVM) | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
branch: | ||
description: Target branch | ||
type: string | ||
required: false | ||
workflow_dispatch: | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
JNI_LIB_PATHS: jni-libs # Edit on the inner build.gradle.kts file as well. | ||
|
||
jobs: | ||
builds: | ||
name: Build for ${{ matrix.job.target }} on ${{ matrix.job.os }} | ||
if: ${{ !(github.event.inputs.build == 'false') }} | ||
runs-on: ${{ matrix.job.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
job: | ||
# In order to load any added target at runtime, editing the Zenoh class under jvmMain is required. | ||
- { | ||
target: x86_64-unknown-linux-gnu, | ||
arch: amd64, | ||
os: ubuntu-20.04, | ||
build-cmd: "cargo", | ||
} | ||
- { | ||
target: aarch64-unknown-linux-gnu, | ||
arch: arm64, | ||
os: ubuntu-20.04, | ||
build-cmd: "cross", | ||
} | ||
- { | ||
target: x86_64-apple-darwin, | ||
arch: darwin, | ||
os: macos-latest, | ||
build-cmd: "cargo", | ||
} | ||
- { | ||
target: aarch64-apple-darwin, | ||
arch: darwin, | ||
os: macos-latest, | ||
build-cmd: "cargo", | ||
} | ||
- { | ||
target: x86_64-pc-windows-msvc, | ||
arch: win64, | ||
os: windows-2019, | ||
build-cmd: "cargo", | ||
} | ||
- { | ||
target: aarch64-pc-windows-msvc, | ||
arch: arm64, | ||
os: windows-2019, | ||
build-cmd: "cargo", | ||
} | ||
steps: | ||
- name: Checkout source code | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ inputs.branch }} | ||
|
||
- name: Install prerequisites | ||
shell: bash | ||
run: | | ||
case ${{ matrix.job.target }} in | ||
*-linux-gnu*) cargo +stable install cargo-deb --locked ;; | ||
esac | ||
case ${{ matrix.job.target }} in | ||
aarch64-unknown-linux-gnu) | ||
sudo apt-get -y update | ||
sudo apt-get -y install gcc-aarch64-linux-gnu | ||
;; | ||
esac | ||
cargo +stable install cross --locked | ||
- name: Install Rust toolchain | ||
run: | | ||
rustup show | ||
rustup target add ${{ matrix.job.target }} | ||
- name: Build | ||
run: ${{ matrix.job.build-cmd }} build --release --bins --lib --features=${{ github.event.inputs.features}} --target=${{ matrix.job.target }} --manifest-path zenoh-jni/Cargo.toml | ||
|
||
- name: Packaging | ||
id: package | ||
shell: bash | ||
run: | | ||
TARGET=${{ matrix.job.target }} | ||
MAIN_PKG_NAME="${GITHUB_WORKSPACE}/${TARGET}.zip" | ||
case ${TARGET} in | ||
*linux*) | ||
cd "zenoh-jni/target/${TARGET}/release/" | ||
echo "Packaging ${MAIN_PKG_NAME}:" | ||
zip ${MAIN_PKG_NAME} libzenoh_jni.so | ||
cd - | ||
echo "MAIN_PKG_NAME=${MAIN_PKG_NAME}" >> $GITHUB_OUTPUT | ||
;; | ||
*apple*) | ||
cd "zenoh-jni/target/${TARGET}/release/" | ||
echo "Packaging ${MAIN_PKG_NAME}:" | ||
zip ${MAIN_PKG_NAME} libzenoh_jni.dylib | ||
cd - | ||
echo "MAIN_PKG_NAME=${MAIN_PKG_NAME}" >> $GITHUB_OUTPUT | ||
;; | ||
*windows*) | ||
cd "zenoh-jni/target/${TARGET}/release/" | ||
echo "Packaging ${MAIN_PKG_NAME}:" | ||
7z -y a "${MAIN_PKG_NAME}" zenoh_jni.dll | ||
cd - | ||
echo "MAIN_PKG_NAME=${MAIN_PKG_NAME}" >> $GITHUB_OUTPUT | ||
;; | ||
esac | ||
- name: "Upload packages" | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ matrix.job.target }} | ||
path: | | ||
${{ steps.package.outputs.MAIN_PKG_NAME }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,25 +68,68 @@ jobs: | |
GIT_USER_NAME: eclipse-zenoh-bot | ||
GIT_USER_EMAIL: [email protected] | ||
|
||
publish-jvm: | ||
name: Publish JVM package | ||
build-jvm: | ||
name: Build JVM package | ||
needs: tag | ||
uses: ./.github/workflows/build-jvm.yml | ||
with: | ||
branch: ${{ needs.tag.outputs.branch }} | ||
permissions: | ||
contents: read | ||
packages: write | ||
secrets: inherit | ||
|
||
publish-jvm-maven: | ||
name: Publish JVM package | ||
needs: [tag, build-jvm] | ||
uses: ./.github/workflows/publish-jvm.yml | ||
with: | ||
snapshot: ${{ !(inputs.live-run || false) }} | ||
branch: ${{ needs.tag.outputs.branch }} | ||
maven_publish: true | ||
github_publish: false | ||
permissions: | ||
contents: read | ||
packages: write | ||
secrets: inherit | ||
|
||
publish-jvm-github: | ||
name: Publish JVM package | ||
needs: [tag, build-jvm, publish-jvm-maven] | ||
uses: ./.github/workflows/publish-jvm.yml | ||
with: | ||
snapshot: ${{ !(inputs.live-run || false) }} | ||
branch: ${{ needs.tag.outputs.branch }} | ||
maven_publish: false | ||
github_publish: true | ||
permissions: | ||
contents: read | ||
packages: write | ||
secrets: inherit | ||
|
||
publish-android: | ||
publish-android-maven: | ||
name: Publish Android package | ||
needs: tag | ||
uses: ./.github/workflows/publish-android.yml | ||
with: | ||
snapshot: ${{ !(inputs.live-run || false) }} | ||
branch: ${{ needs.tag.outputs.branch }} | ||
maven_publish: true | ||
github_publish: false | ||
permissions: | ||
contents: read | ||
packages: write | ||
secrets: inherit | ||
|
||
publish-android-github: | ||
name: Publish Android package | ||
needs: [tag, publish-android-maven] | ||
uses: ./.github/workflows/publish-android.yml | ||
with: | ||
snapshot: ${{ !(inputs.live-run || false) }} | ||
branch: ${{ needs.tag.outputs.branch }} | ||
maven_publish: false | ||
github_publish: true | ||
permissions: | ||
contents: read | ||
packages: write | ||
|
@@ -101,7 +144,7 @@ jobs: | |
branch: ${{ needs.tag.outputs.branch }} | ||
|
||
publish-github: | ||
needs: tag | ||
needs: [tag, publish-android-github, publish-jvm-github] | ||
runs-on: macos-latest | ||
steps: | ||
- uses: eclipse-zenoh/ci/publish-crates-github@main | ||
|