Skip to content

Universal macOS ARM64 binary and statically compiled FreeType (#239) #490

Universal macOS ARM64 binary and statically compiled FreeType (#239)

Universal macOS ARM64 binary and statically compiled FreeType (#239) #490

Workflow file for this run

name: CI
on:
push:
branches:
- main
tags:
- v*
pull_request:
branches:
- main
jobs:
build-java:
name: Build Java
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: 8
distribution: liberica
cache: gradle
- name: Build
run: ./gradlew buildAll
# This helps to upload only jar files into the build artifact
- name: Copy Build Results to Temp
run: |
mkdir -p tmp/
cp imgui-app/build/libs/*.jar tmp/
cp imgui-binding/build/libs/*.jar tmp/
cp imgui-lwjgl3/build/libs/*.jar tmp/
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: java-libraries
path: tmp/*.jar
build-natives:
name: Build Native (${{ matrix.target.os }} - ${{ matrix.target.type }})
needs: build-java
strategy:
fail-fast: false
matrix:
target:
- os: ubuntu-latest
type: linux
- os: ubuntu-latest
type: windows
- os: macos-latest
type: macos
runs-on: ${{ matrix.target.os }}
steps:
- name: Checkout Repository and Submodules
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: 8
distribution: liberica
cache: gradle
- name: Install Dependencies (for Windows build)
if: matrix.target.type == 'windows'
run: sudo apt install mingw-w64
- name: Build
run: |
chmod +x buildSrc/scripts/build.sh
buildSrc/scripts/build.sh ${{ matrix.target.type }}
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: native-library-${{ matrix.target.type }}
path: /tmp/imgui/dst/
# This required to pack all native libraries into single archive
archive-natives:
name: Archive Natives
runs-on: ubuntu-latest
needs: build-natives
steps:
- name: Merge Artifacts
uses: actions/upload-artifact/merge@v4
with:
name: native-libraries
pattern: native-library-*
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: archive-natives
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Download Artifacts
uses: actions/download-artifact@v4
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 | sort -z | 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/
- 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, archive-natives ]
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Java
uses: actions/setup-java@v4
with:
java-version: 8
distribution: liberica
cache: gradle
- name: Download Artifacts
uses: actions/download-artifact@v4
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/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 }}
SIGNING_KEY_PASS: ${{ secrets.RELEASE_SIGNING_KEY_PASS }}
run: |
chmod +x ./buildSrc/scripts/publish.sh
buildSrc/scripts/publish.sh
- name: Release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
draft: true
prerelease: false
files: |
out/archives/**