2020-01-18 00:54:52 -05:00
|
|
|
name: Build, package, and upload Java library
|
|
|
|
|
|
|
|
on:
|
|
|
|
create:
|
|
|
|
tags:
|
|
|
|
- 'v*'
|
|
|
|
|
|
|
|
jobs:
|
2020-01-18 02:20:00 -05:00
|
|
|
build:
|
2020-01-18 00:54:52 -05:00
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
|
|
|
include:
|
|
|
|
- os: ubuntu-latest
|
|
|
|
ARCH: linux-x86_64
|
2020-01-18 02:20:00 -05:00
|
|
|
FILE: 'libhyperbuild_java.so'
|
2020-01-18 00:54:52 -05:00
|
|
|
- os: windows-latest
|
|
|
|
ARCH: windows-x86_64
|
2020-01-18 02:20:00 -05:00
|
|
|
FILE: 'hyperbuild_java.dll'
|
2020-01-18 00:54:52 -05:00
|
|
|
- os: macos-latest
|
|
|
|
ARCH: macos-x86_64
|
2020-01-18 02:20:00 -05:00
|
|
|
FILE: 'libhyperbuild_java.dylib'
|
2020-01-18 00:54:52 -05:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v1
|
|
|
|
- name: Set up Rust
|
|
|
|
uses: actions-rs/toolchain@v1
|
|
|
|
with:
|
|
|
|
toolchain: stable
|
|
|
|
profile: minimal
|
|
|
|
default: true
|
|
|
|
- name: Build Java native library
|
|
|
|
run: cargo build --release
|
|
|
|
working-directory: ./java
|
|
|
|
- name: Upload built library
|
|
|
|
uses: actions/upload-artifact@v1
|
|
|
|
with:
|
|
|
|
name: ${{ matrix.ARCH }}
|
2020-01-18 02:20:00 -05:00
|
|
|
path: ./java/target/rust/release/${{ matrix.FILE }}
|
2020-01-18 00:54:52 -05:00
|
|
|
package:
|
2020-01-18 01:02:02 -05:00
|
|
|
runs-on: ubuntu-latest
|
2020-01-18 02:20:00 -05:00
|
|
|
needs: build
|
2020-01-18 00:54:52 -05:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v1
|
|
|
|
- name: Get version
|
|
|
|
id: version
|
|
|
|
shell: bash
|
|
|
|
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/v}
|
|
|
|
- name: Set up JDK
|
|
|
|
uses: actions/setup-java@v1
|
|
|
|
with:
|
2020-01-18 08:21:58 -05:00
|
|
|
java-version: '1.7'
|
2020-01-18 00:54:52 -05:00
|
|
|
java-package: jdk
|
|
|
|
architecture: x64
|
|
|
|
- name: Download Windows built library
|
|
|
|
uses: actions/download-artifact@v1
|
|
|
|
with:
|
|
|
|
name: windows-x86_64
|
2020-01-18 08:15:44 -05:00
|
|
|
path: java/src/main/resources/windows-x86_64
|
2020-01-18 00:54:52 -05:00
|
|
|
- name: Download Linux built library
|
|
|
|
uses: actions/download-artifact@v1
|
|
|
|
with:
|
|
|
|
name: linux-x86_64
|
2020-01-18 08:15:44 -05:00
|
|
|
path: java/src/main/resources/linux-x86_64
|
2020-01-18 00:54:52 -05:00
|
|
|
- name: Download macOS built library
|
|
|
|
uses: actions/download-artifact@v1
|
|
|
|
with:
|
|
|
|
name: macos-x86_64
|
2020-01-18 08:15:44 -05:00
|
|
|
path: java/src/main/resources/macos-x86_64
|
|
|
|
- name: Move native library files to correct location
|
|
|
|
shell: bash
|
|
|
|
working-directory: ./java/src/main/resources
|
|
|
|
run: |
|
|
|
|
for f in *; do
|
|
|
|
mv $f/* "$f.nativelib"
|
|
|
|
rmdir "$f"
|
|
|
|
done
|
2020-01-18 00:54:52 -05:00
|
|
|
- name: Build and package JAR
|
|
|
|
working-directory: ./java
|
2020-01-18 02:20:00 -05:00
|
|
|
run: mvn clean package
|
2020-01-18 00:54:52 -05:00
|
|
|
- uses: chrislennon/action-aws-cli@v1.1
|
|
|
|
- name: Upload to S3
|
|
|
|
env:
|
|
|
|
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
|
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
|
|
AWS_REGION: us-west-2
|
2020-01-19 07:44:05 -05:00
|
|
|
run: aws s3 cp ./java/target/hyperbuild-${{ steps.version.outputs.VERSION }}.jar s3://${{ secrets.AWS_S3_BUCKET }}/hyperbuild/bin/${{ steps.version.outputs.VERSION }}.jar
|