Skip to content

Commit db50e67

Browse files
georg-getzZurcusa
andauthored
Binaries update (#8)
* removed bintray mentions and added bonus configuration in the release yaml that requires testing Signed-off-by: Georgi Georgiev <georgi.getz@outlook.com> * changed action provider for prerelease Signed-off-by: Georgi Georgiev <georgi.getz@outlook.com> * removed creating pre-release Signed-off-by: Georgi Georgiev <georgi.getz@outlook.com> * update gradelev Signed-off-by: Georgi Georgiev <georgi.getz@outlook.com> * added echo command for arch Signed-off-by: Georgi Georgiev <georgi.getz@outlook.com> * added line Signed-off-by: Georgi Georgiev <georgi.getz@outlook.com> * fix Signed-off-by: Georgi Georgiev <georgi.getz@outlook.com> * trying Signed-off-by: Georgi Georgiev <georgi.getz@outlook.com> * added missing line Signed-off-by: Georgi Georgiev <georgi.getz@outlook.com> * switched sopaces for tabs Signed-off-by: Georgi Georgiev <georgi.getz@outlook.com> * small changes Signed-off-by: Georgi Georgiev <georgi.getz@outlook.com> * typo Signed-off-by: Georgi Georgiev <georgi.getz@outlook.com> * added a separate file for the mac release Signed-off-by: Georgi Georgiev <georgi.getz@outlook.com> * 2nd try with arch Signed-off-by: Georgi Georgiev <georgi.getz@outlook.com> * distribution Signed-off-by: Georgi Georgiev <georgi.getz@outlook.com> * added additional file for building the dylibs Signed-off-by: Georgi Georgiev <georgi.getz@outlook.com> * nerf eddition level Signed-off-by: Georgi Georgiev <georgi.getz@outlook.com> * another nerf Signed-off-by: Georgi Georgiev <georgi.getz@outlook.com> * aded file for dylib generation Signed-off-by: Georgi Georgiev <georgi.getz@outlook.com> * /testing Signed-off-by: Georgi Georgiev <georgi.getz@outlook.com> * changed generation command Signed-off-by: Georgi Georgiev <georgi.getz@outlook.com> * changed release action Signed-off-by: Georgi Georgiev <georgi.getz@outlook.com> * added rustup target Signed-off-by: Georgi Georgiev <georgi.getz@outlook.com> * typo Signed-off-by: Georgi Georgiev <georgi.getz@outlook.com> * typo Signed-off-by: Georgi Georgiev <georgi.getz@outlook.com> * testing Signed-off-by: Georgi Georgiev <georgi.getz@outlook.com> * testing Signed-off-by: Georgi Georgiev <georgi.getz@outlook.com> * testing Signed-off-by: Georgi Georgiev <georgi.getz@outlook.com> * testing Signed-off-by: Georgi Georgiev <georgi.getz@outlook.com> * testing Signed-off-by: Georgi Georgiev <georgi.getz@outlook.com> * changed all the yamls to activate on release to test everything together Signed-off-by: Georgi Georgiev <georgi.getz@outlook.com> * added some logs as well Signed-off-by: Georgi Georgiev <georgi.getz@outlook.com> * removed the 32 linux platform as github doesnt support such images and wasmer-vm causes crash when trying to cross-compile Signed-off-by: Georgi Georgiev <georgi.getz@outlook.com> * change to on push Signed-off-by: Georgi Georgiev <georgi.getz@outlook.com> * the aarch64v linux is incompatible too Signed-off-by: Georgi Georgiev <georgi.getz@outlook.com> * removed slashes Signed-off-by: Georgi Georgiev <georgi.getz@outlook.com> * deleted the outdated commandd in makefile Signed-off-by: Georgi Georgiev <georgi.getz@outlook.com> * undo deleting the makefile rust build commands as it is apperantly used by the test yaml as well Signed-off-by: Georgi Georgiev <georgi.getz@outlook.com> * Package all natives in a single jar. (#9) * Adapt dynamic_libs.yaml so that it uploads libs as artifacts. * Add condition when copying native libs to build dir. Test download artifacts in release.yaml. * Test fix pattern. * Test fix pattern. * Remove matrix. * Test remove pattern from artifact download. * Refactor dynamic_libs.yaml so that it's callable from release.yaml. * Add needs flag to release.yaml * Test list structure in native-libs directory. * Rework dynamic_libs.yaml so that it's reusable. Adapt release.yaml to use dynamic_libs_reusable.yaml. Executing release.yaml from a branch uploads the jar with all the possible native libs inside the workflow artifacts. Executing it from a tag uploads it to the tag's release. * Test param passs fix. * test * test * Remove github.event from the reusable workflow. * Use github.ref.type instead of github.ref * test * test * test * Remove test step from dynamic_libs_reusable.yaml. Use startsWith expression in release.yaml. * Add docs. Change name of JAR. * Test using randomizes artifacts dir. * Fix export syntax. * Add section in README.md for env variable. Rename GH_ARTIFACTS_DIR to EXT_ARTIFACTS_DIR * Change 'native-libs' to using env var. * test * test * Push EXT_ARTIFACTS_DIR to gh env. * Add mkdir. * Fix mkdir. * Fix mkdir. * Fix usage of env var in "with" section of step. * Test * Remove comments. * Remove leftovers. * fix: use "uname -m" when retrieving os arch in Native.java. Change win32 to windows. * fix: translate x86_64 to amd64 to keep uniform naming of artifacts. * Substitute random uuid for mktemp command. * Test fix env var assign * Test fix env var assign * Test remove cache steps. * Revert cache removal. --------- Signed-off-by: Georgi Georgiev <georgi.getz@outlook.com> Co-authored-by: Yordan Atanasov <99724706+Zurcusa@users.noreply.github.com>
1 parent cb4fafe commit db50e67

File tree

11 files changed

+232
-257
lines changed

11 files changed

+232
-257
lines changed
Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
# This workflow compiles the native wasmer_jni lib into various OS and architectures using dynamic_libs_reusable.yaml.
2+
# Then it builds and publishes the JAR based on the GITHUB_REF that calls the workflow. There are 2 options:
3+
# 1. The workflow is executed from a branch. In that case the JAR is available in the GitHub action as an artifact.
4+
# 2. The workflow is executed from a tag. In that case the JAR is published in the corresponding GitHub release.
5+
name: Build and publish
6+
7+
on:
8+
push:
9+
branches:
10+
- '*' # Trigger on push to any branch
11+
tags:
12+
- '*' # Trigger on push to any tag
13+
14+
jobs:
15+
upload_dynamic_libs:
16+
strategy:
17+
matrix:
18+
platform:
19+
- os: 'macos-latest'
20+
target: 'aarch64-apple-darwin'
21+
artifact: 'darwin-arm64'
22+
lib_name: 'libwasmer_jni.dylib'
23+
24+
- os: 'macos-latest'
25+
target: 'x86_64-apple-darwin'
26+
artifact: 'darwin-amd64'
27+
lib_name: 'libwasmer_jni.dylib'
28+
29+
- os: 'ubuntu-latest'
30+
target: 'x86_64-unknown-linux-gnu'
31+
artifact: 'linux-amd64'
32+
lib_name: 'libwasmer_jni.so'
33+
34+
- os: 'windows-latest'
35+
target: 'x86_64-pc-windows-msvc'
36+
artifact: 'windows-amd64'
37+
lib_name: 'wasmer_jni.dll'
38+
uses: ./.github/workflows/dynamic_libs_reusable.yaml
39+
with:
40+
platform_os: ${{ matrix.platform.os }}
41+
platform_target: ${{ matrix.platform.target }}
42+
platform_artifact: ${{ matrix.platform.artifact }}
43+
platform_lib_name: ${{ matrix.platform.lib_name }}
44+
45+
publish_jar:
46+
name: Publish the JARs
47+
runs-on: ubuntu-latest
48+
needs: [upload_dynamic_libs]
49+
50+
steps:
51+
- name: Check out code
52+
uses: actions/checkout@v2
53+
54+
- name: Set up Java 21
55+
uses: actions/setup-java@v1
56+
with:
57+
java-version: 21
58+
59+
- name: Set up Rust
60+
uses: actions-rs/toolchain@v1
61+
with:
62+
toolchain: stable
63+
default: true
64+
override: true
65+
66+
- name: Cache Cargo registry
67+
uses: actions/cache@v1
68+
with:
69+
path: ~/.cargo/registry
70+
key: cargo-registry-${{ hashFiles('**/Cargo.lock') }}
71+
72+
- name: Cache Cargo bin
73+
uses: actions/cache@v1
74+
with:
75+
path: ~/.cargo/bin
76+
key: cargo-bin-${{ hashFiles('**/Cargo.lock') }}
77+
78+
- name: Cache Cargo build
79+
uses: actions/cache@v1
80+
with:
81+
path: target
82+
key: cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
83+
84+
- name: Setup wasmer-jni artifacts dir
85+
shell: bash
86+
run: |
87+
echo "EXT_ARTIFACTS_DIR=$(mktemp -d)" >> $GITHUB_ENV
88+
89+
- name: Download wasmer_jni artifacts
90+
uses: actions/download-artifact@v4
91+
with:
92+
path: ${{ env.EXT_ARTIFACTS_DIR }}
93+
94+
- name: Display structure of downloaded files
95+
run: ls -R $EXT_ARTIFACTS_DIR
96+
97+
- name: Run all the tests
98+
shell: bash
99+
run: |
100+
export PATH="$HOME/.cargo/bin:$PATH"
101+
make test
102+
103+
- name: Create the JAR
104+
id: create_jar
105+
shell: bash
106+
run: |
107+
export PATH="$HOME/.cargo/bin:$PATH"
108+
make package
109+
110+
- name: Upload JAR as workflow artifact
111+
if: startsWith(github.ref, 'refs/heads/')
112+
uses: actions/upload-artifact@v4
113+
with:
114+
name: ${{ steps.create_jar.outputs.name }}
115+
path: ${{ steps.create_jar.outputs.path }}
116+
retention-days: 1
117+
118+
- name: Get release info
119+
id: get_release_info
120+
if: startsWith(github.ref, 'refs/tags/')
121+
uses: bruceadams/get-release@v1.3.2
122+
env:
123+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
124+
125+
- name: Upload JAR as Github pre-release asset
126+
if: startsWith(github.ref, 'refs/tags/')
127+
uses: actions/upload-release-asset@v1
128+
env:
129+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
130+
with:
131+
upload_url: ${{ steps.get_release_info.outputs.upload_url }}
132+
asset_path: ${{ steps.create_jar.outputs.path }}
133+
asset_name: ${{ steps.create_jar.outputs.name }}
134+
asset_content_type: application/java-archive
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# This workflow cross compiles a rust library into a native based on a provided target.
2+
# The compiled library is then uploaded as a GitHub artifact.
3+
name: upload_dynamic_libs
4+
5+
on:
6+
workflow_call:
7+
inputs:
8+
platform_os:
9+
description: Operating system that the runner will use.
10+
type: string
11+
required: true
12+
platform_target:
13+
description: The architecture that rust will compile the libs for.
14+
type: string
15+
required: true
16+
platform_artifact:
17+
description: The name of the artifact that will be uploaded.
18+
type: string
19+
required: true
20+
platform_lib_name:
21+
description: Name of the native library to be uploaded in the artifact.
22+
type: string
23+
required: true
24+
25+
26+
jobs:
27+
publish_dlibs:
28+
name: Publish the dynamic libraries
29+
runs-on: ${{ inputs.platform_os }}
30+
steps:
31+
- name: Check out code
32+
uses: actions/checkout@v3
33+
34+
- name: Set up Rust
35+
uses: actions-rs/toolchain@v1
36+
with:
37+
toolchain: stable
38+
default: true
39+
override: true
40+
41+
- name: Create the dynamic libs
42+
shell: bash
43+
run: |
44+
export PATH="$HOME/.cargo/bin:$PATH"
45+
rustup target add ${{ inputs.platform_target }}
46+
cargo build --release --target=${{ inputs.platform_target }}
47+
48+
- name: Upload the dynamic libs
49+
uses: actions/upload-artifact@v4
50+
with:
51+
name: ${{ inputs.platform_artifact }}
52+
path: ./target/${{ inputs.platform_target }}/release/${{ inputs.platform_lib_name }}
53+
retention-days: 1

.github/workflows/release.yml

Lines changed: 0 additions & 130 deletions
This file was deleted.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ jobs:
1010
strategy:
1111
matrix:
1212
# The job runs on 3 different OS.
13-
os: [ubuntu-latest, macos-latest, windows-latest]
13+
os: [ubuntu-latest, macos-13, windows-latest]
1414
# The job runs on different Java versions (LTS).
15-
java: [8]
15+
java: [21]
1616
# As soon as one job fails in the matrix, all the other
1717
# in-progress jobs are canceled.
1818
fail-fast: true

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
[package]
22
publish = false
33
name = "wasmer-jni"
4-
version = "0.3.0"
5-
authors = ["Ivan Enderlin <ivan.enderlin@hoa-project.net>"]
6-
edition = "2018"
4+
version = "1.1.0"
5+
edition = "2021"
76

87
[lib]
98
crate-type = ["cdylib"]

Makefile

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,6 @@ javadoc:
112112
package:
113113
"./gradlew" --info jar
114114

115-
# Publish the package artifact to a public repository
116-
publish:
117-
"./gradlew" --info uploadToBintray
118-
119115
# Run a specific example, with `make run-example EXAMPLE=Simple` for instance.
120116
run-example:
121117
$(eval JAR := $(shell find ./build/libs/ -name "wasmer-jni-*.jar"))

0 commit comments

Comments
 (0)