Skip to content

Merge pull request #5 from ShirosakiMio/master #21

Merge pull request #5 from ShirosakiMio/master

Merge pull request #5 from ShirosakiMio/master #21

Workflow file for this run

name: Build
on: [workflow_dispatch, push]
defaults:
run:
shell: bash
jobs:
windows:
name: Compile and Link for Windows
runs-on: windows-latest
steps:
- name: msvc
uses: ilammy/msvc-dev-cmd@v1
- name: Checkout Repository
uses: actions/checkout@v2
- name: Setup Java
id: setup-java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
cache: 'gradle'
- name: Make Directory
run: mkdir windows & mkdir output_natives
- name: Compile
run: cl.exe -LD -I$JAVA_HOME/include -I$JAVA_HOME/include/win32 src/main/cpp/zone_rong_imaginebreaker_NativeImagineBreaker.cpp -link -out:output_natives/imaginebreaker.dll
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: resources
path: output_natives/
linux:
name: Compile and Link for Linux
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Setup Java
id: setup-java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
cache: 'gradle'
- name: Make Directory
run: mkdir linux && mkdir output_natives
- name: Compile
run: g++ -c -fPIC -I$JAVA_HOME/include -I$JAVA_HOME/include/linux src/main/cpp/zone_rong_imaginebreaker_NativeImagineBreaker.cpp -o linux/zone_rong_imaginebreaker_NativeImagineBreaker.o
- name: Linking
run: g++ -shared -fPIC -o output_natives/libimaginebreaker.so linux/zone_rong_imaginebreaker_NativeImagineBreaker.o -lc
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: resources
path: output_natives/
osx:
name: Compile and Link for MacOS
runs-on: macos-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Setup Java
id: setup-java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
cache: 'gradle'
- name: Make Directory
run: mkdir macos && mkdir output_natives
- name: Compile
run: g++ -c -fPIC -I$JAVA_HOME/include -I$JAVA_HOME/include/darwin src/main/cpp/zone_rong_imaginebreaker_NativeImagineBreaker.cpp -o macos/zone_rong_imaginebreaker_NativeImagineBreaker.o
- name: Linking
run: g++ -dynamiclib -o output_natives/libimaginebreaker.dylib macos/zone_rong_imaginebreaker_NativeImagineBreaker.o -lc
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: resources
path: output_natives/
android:
name: Compile for Android
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Setup Java
id: setup-java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
cache: 'gradle'
- name: Make Directory
run: mkdir toolchains
- name: Setup NDK and compile
uses: nttld/setup-ndk@v1
with:
ndk-version: r25c
- run: cd src/main/cpp && ndk-build NDK_PROJECT_PATH=. APP_BUILD_SCRIPT=Android.mk APP_PLATFORM=android-21 APP_ABI=arm64-v8a APP_STL=c++_static
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: resources
path: src/main/cpp/libs/arm64-v8a
build-jar:
name: Compile Jar
runs-on: ubuntu-latest
needs: [windows, linux, osx, android]
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Setup Java
id: setup-java
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
cache: 'gradle'
- name: Download Artifacts
uses: actions/download-artifact@v3
with:
path: src/main
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Gradle Build (Skip Tests)
run: ./gradlew build -x test
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: ImagineBreaker
path: build/libs/