188 lines
5.9 KiB
YAML
188 lines
5.9 KiB
YAML
name: CI
|
|
on: [ push, pull_request ]
|
|
jobs:
|
|
build-java:
|
|
name: Build Java
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout Repository
|
|
uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Setup Java
|
|
uses: actions/setup-java@v3
|
|
with:
|
|
java-version: 8
|
|
distribution: liberica
|
|
cache: gradle
|
|
|
|
- name: Build
|
|
run: ./gradlew buildAll
|
|
|
|
- name: Upload Artifacts
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: java-libraries
|
|
path: |
|
|
imgui-app/build/libs/*.jar
|
|
imgui-binding/build/libs/*.jar
|
|
imgui-lwjgl3/build/libs/*.jar
|
|
|
|
build-natives:
|
|
name: Build Native (${{ matrix.type }}${{ matrix.freetype && ', freetype' || '' }})
|
|
strategy:
|
|
matrix:
|
|
os: [ ubuntu-latest, macos-latest ]
|
|
type: [ windows, linux, macos ]
|
|
freetype: [ true, false ]
|
|
include:
|
|
- type: windows
|
|
expected: /tmp/imgui/libsNative/windows64/imgui-java64.dll
|
|
- type: linux
|
|
expected: /tmp/imgui/libsNative/linux64/libimgui-java64.so
|
|
- type: macos
|
|
expected: /tmp/imgui/libsNative/macosx64/libimgui-java64.dylib
|
|
exclude:
|
|
- os: ubuntu-latest
|
|
type: macos
|
|
- os: macos-latest
|
|
type: windows
|
|
- os: macos-latest
|
|
type: linux
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- name: Checkout Repository and Submodules
|
|
uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
submodules: recursive
|
|
|
|
- name: Setup Java
|
|
uses: actions/setup-java@v3
|
|
with:
|
|
java-version: 8
|
|
distribution: liberica
|
|
cache: gradle
|
|
|
|
- name: Ant Version
|
|
run: ant -version
|
|
|
|
- name: Install MinGW-w64/GCC/G++ (Linux & Windows)
|
|
if: matrix.os == 'ubuntu-latest'
|
|
run: sudo apt install mingw-w64
|
|
|
|
- name: FreeType - Install (Linux)
|
|
if: matrix.os == 'ubuntu-latest' && matrix.type == 'linux' && matrix.freetype == true
|
|
run: sudo apt install libfreetype6-dev
|
|
|
|
- name: FreeType - Install (Windows)
|
|
if: matrix.os == 'ubuntu-latest' && matrix.type == 'windows' && matrix.freetype == true
|
|
run: |
|
|
sudo mkdir /freetype
|
|
sudo tar -xzf ./vendor/freetype-2.12.1.tar.gz -C /freetype --strip-components=1
|
|
cd /freetype
|
|
sudo ./configure --with-zlib=no --with-bzip2=no --with-png=no --with-harfbuzz=no --with-brotli=no --host=x86_64-w64-mingw32 --prefix=/usr/x86_64-w64-mingw32
|
|
sudo make
|
|
sudo make install
|
|
|
|
- name: Build
|
|
run: ./gradlew imgui-binding:generateLibs -Denvs=${{ matrix.type }} -Dfreetype=${{ matrix.freetype }}
|
|
|
|
- name: Upload Artifacts
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: ${{ matrix.freetype && 'native-libraries-with-freetype' || 'native-libraries' }}
|
|
if-no-files-found: error
|
|
path: ${{ matrix.expected }}
|
|
|
|
update-bin:
|
|
name: Update Binaries
|
|
if: github.ref == 'refs/heads/main' && !github.event.repository.fork # runs only on the main branch and not forks (sometimes people do PRs from the main branch)
|
|
runs-on: ubuntu-latest
|
|
needs: build-natives
|
|
steps:
|
|
- name: Checkout Repository
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Download Artifacts
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
path: /tmp/artifacts
|
|
|
|
# Job compares sha1 hash of the imgui-binding/src/main directory.
|
|
# If there are any changes, then we update native libraries.
|
|
# We do not rely on git in terms of comparing binaries,
|
|
# since DLL files will always have versioning difference.
|
|
- name: Compare Binding Hash
|
|
id: cmp-binding-hash
|
|
continue-on-error: true
|
|
run: |
|
|
touch bin/binding.sha1
|
|
cat bin/binding.sha1 > /tmp/hash
|
|
find imgui-binding/src/main -type f -print0 | xargs -0 sha1sum > bin/binding.sha1
|
|
cmp /tmp/hash bin/binding.sha1
|
|
|
|
- name: Update
|
|
if: steps.cmp-binding-hash.outcome != 'success'
|
|
run: |
|
|
mv /tmp/artifacts/native-libraries/* bin/
|
|
mv /tmp/artifacts/native-libraries-with-freetype/* bin/freetype/
|
|
|
|
- name: Commit
|
|
if: steps.cmp-binding-hash.outcome != 'success'
|
|
uses: EndBug/add-and-commit@v9
|
|
with:
|
|
default_author: github_actions
|
|
message: '[ci skip] update native binaries'
|
|
|
|
release:
|
|
name: Release
|
|
if: startsWith(github.ref, 'refs/tags/v') # if tag starts with "v"
|
|
runs-on: ubuntu-latest
|
|
needs: [ build-java, build-natives ]
|
|
steps:
|
|
- name: Checkout Repository
|
|
uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Setup Java
|
|
uses: actions/setup-java@v3
|
|
with:
|
|
java-version: 8
|
|
distribution: liberica
|
|
cache: gradle
|
|
|
|
- name: Download Artifacts
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
path: out/artifacts
|
|
|
|
- name: Zip Artifacts
|
|
run: |
|
|
mkdir out/archives
|
|
zip -rj out/archives/native-libraries out/artifacts/native-libraries
|
|
zip -rj out/archives/native-libraries-with-freetype out/artifacts/native-libraries-with-freetype
|
|
zip -rj out/archives/java-libraries out/artifacts/java-libraries
|
|
|
|
- name: Publish
|
|
env:
|
|
NEXUS_UPD_ID: ${{ secrets.RELEASE_NEXUS_UPD_ID }}
|
|
NEXUS_UPD_PASS: ${{ secrets.RELEASE_NEXUS_UPD_PASS }}
|
|
SIGNING_KEY_ID: ${{ secrets.RELEASE_SIGNING_KEY_ID }}
|
|
SIGNING_KEY: ${{ secrets.RELEASE_SIGNING_KEY }}
|
|
run: |
|
|
chmod +x ./buildSrc/scripts/publish.sh
|
|
buildSrc/scripts/publish.sh
|
|
|
|
- name: Release
|
|
uses: softprops/action-gh-release@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
draft: true
|
|
prerelease: false
|
|
files: |
|
|
out/archives/**
|