Skip to content

test

test #27

Workflow file for this run

# This workflow compiles the native wasmer_jni lib into various OS and architectures using dynamic_libs_reusable.yaml.
# Then it builds and publishes the JAR based on the GITHUB_REF that calls the workflow. There are 2 options:
# 1. The workflow is executed from a branch. In that case the JAR is available in the GitHub action as an artifact.
# 2. The workflow is executed from a tag. In that case the JAR is published in the corresponding GitHub release.
name: Build and publish
on:
push:
branches:
- '*' # Trigger on push to any branch
tags:
- '*' # Trigger on push to any tag
jobs:
# upload_dynamic_libs:
# strategy:
# matrix:
# platform:
# - os: 'macos-latest'
# target: 'aarch64-apple-darwin'
# artifact: 'darwin-arm64'
# lib_name: 'libwasmer_jni.dylib'
#
# - os: 'macos-latest'
# target: 'x86_64-apple-darwin'
# artifact: 'darwin-amd64'
# lib_name: 'libwasmer_jni.dylib'
#
# - os: 'ubuntu-latest'
# target: 'x86_64-unknown-linux-gnu'
# artifact: 'linux-amd64'
# lib_name: 'libwasmer_jni.so'
#
# - os: 'windows-latest'
# target: 'x86_64-pc-windows-msvc'
# artifact: 'windows-amd64'
# lib_name: 'wasmer_jni.dll'
# uses: ./.github/workflows/dynamic_libs_reusable.yaml
# with:
# platform_os: ${{ matrix.platform.os }}
# platform_target: ${{ matrix.platform.target }}
# platform_artifact: ${{ matrix.platform.artifact }}
# platform_lib_name: ${{ matrix.platform.lib_name }}
publish_jar:
name: Publish the JARs
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Set up Java 21
uses: actions/setup-java@v1
with:
java-version: 21
- name: Set up Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
default: true
override: true
- name: Cache Cargo registry
uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache Cargo bin
uses: actions/cache@v1
with:
path: ~/.cargo/bin
key: cargo-bin-${{ hashFiles('**/Cargo.lock') }}
- name: Cache Cargo build
uses: actions/cache@v1
with:
path: target
key: cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
- name: Setup wasmer-jni artifacts dir
shell: bash
run: |
echo "EXT_ARTIFACTS_DIR=$(mktemp -d)" >> $GITHUB_ENV
- name: Download wasmer_jni artifacts
uses: actions/download-artifact@v4
with:
path: ${{ env.EXT_ARTIFACTS_DIR }}
- name: Display structure of downloaded files
run: ls -R $EXT_ARTIFACTS_DIR
- name: Run all the tests
shell: bash
run: |
export PATH="$HOME/.cargo/bin:$PATH"
make test
- name: Create the JAR
id: create_jar
shell: bash
run: |
export PATH="$HOME/.cargo/bin:$PATH"
make package
- name: Upload JAR as workflow artifact
if: startsWith(github.ref, 'refs/heads/')
uses: actions/upload-artifact@v4
with:
name: ${{ steps.create_jar.outputs.name }}
path: ${{ steps.create_jar.outputs.path }}
retention-days: 1
- name: Get release info
id: get_release_info
if: startsWith(github.ref, 'refs/tags/')
uses: bruceadams/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Upload JAR as Github pre-release asset
if: startsWith(github.ref, 'refs/tags/')
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release_info.outputs.upload_url }}
asset_path: ${{ steps.create_jar.outputs.path }}
asset_name: ${{ steps.create_jar.outputs.name }}
asset_content_type: application/java-archive