Include Cargo.lock for wasmtime-jni #158
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
name: CI | |
on: | |
push: | |
branches: [ master ] | |
tags: | |
- '*' | |
pull_request: | |
branches: [ master ] | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-20.04, macos-latest, windows-latest] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up JDK 1.8 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 1.8 | |
- name: Set up Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: nightly-2022-12-11 | |
override: true | |
components: rustfmt | |
# Binary compatibility settings from bytecodealliance/wasmtime | |
- name: Binary compatibility settings (macOS) | |
if: ${{ startsWith(matrix.os, 'macos') }} | |
run: echo 'MACOSX_DEPLOYMENT_TARGET=10.9' >> $GITHUB_ENV | |
- name: Binary compatibility settings (Windows) | |
if: ${{ startsWith(matrix.os, 'windows') }} | |
run: echo 'RUSTFLAGS=-Ctarget-feature=+crt-static' >> $GITHUB_ENV | |
# Run gradle normally to build the JNI lib | |
- name: Build with Gradle | |
if: ${{ !startsWith(matrix.os, 'ubuntu') }} | |
run: ./gradlew build copyJniLib | |
# Run gradle in a docker container to build the JNI lib on Linux for old glibc compatibility | |
- name: Build with Gradle (Linux) | |
if: ${{ startsWith(matrix.os, 'ubuntu') }} | |
run: | | |
docker build -t build-image ./ci/docker/x86_64-linux | |
docker run --rm --volume $PWD:/build --workdir /build build-image ./gradlew build copyJniLib -x javadoc | |
- name: Save JNI lib output | |
if: startsWith(github.ref, 'refs/tags/') | |
uses: actions/upload-artifact@v2 | |
with: | |
name: jni-libs | |
path: build/jni-libs/* | |
publish: | |
if: startsWith(github.ref, 'refs/tags/') | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up JDK 1.8 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 1.8 | |
- name: Restore JNI libs | |
uses: actions/download-artifact@v2 | |
with: | |
name: jni-libs | |
path: build/jni-libs | |
- name: Build universal jar | |
run: ./gradlew universalJar -x buildJniLib -x copyJniLib | |
- name: Create release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: ${{ github.ref }} | |
- id: get-tag-version | |
run: | | |
version=$(echo ${{github.ref}} | cut -f3 -d/ | sed 's/^v//') | |
echo "::set-output name=version::$version" | |
- name: Upload release asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: build/libs/wasmtime-java-${{ steps.get-tag-version.outputs.version }}-universal.jar | |
asset_name: wasmtime-java-${{ steps.get-tag-version.outputs.version }}-universal.jar | |
asset_content_type: application/octet-stream |