[Build] CI refactor (#149)
* [Build] CI refactor * [Build] Fix GenerateLibs * [Build] Up actions/checkout@v3 * [Build] Remove actions/gradle-build-action * [Build] Uncomment publish/release jobs * [Build] Delete obsolete jobs * [Build] Add more info to the jar manifest * [Build] Make checkout to fetch tags * [Build] Return job to update binaries * [Doc] Update README
This commit is contained in:
1 parent
62377c7b1d
commit
2957cb4b88
24 files changed
+290
-352
No files matched your search
+114
-37
@@ -4,92 +4,169 @@ jobs:
|
||||
build-java:
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, macos-latest]
|
||||
os: [ ubuntu-latest, macos-latest ]
|
||||
name: Build Java
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup Java 8
|
||||
uses: actions/setup-java@v1
|
||||
- name: Setup Java
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: 8
|
||||
distribution: liberica
|
||||
|
||||
- name: Build
|
||||
uses: eskatos/gradle-command-action@v1
|
||||
run: ./gradlew buildAll
|
||||
|
||||
- name: Upload Artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
arguments: buildAll
|
||||
name: java-libraries
|
||||
path: |
|
||||
imgui-app/build/libs/*.jar
|
||||
imgui-binding/build/libs/*.jar
|
||||
imgui-lwjgl3/build/libs/*.jar
|
||||
|
||||
build-natives:
|
||||
env:
|
||||
FREETYPE_URL: https://download.savannah.gnu.org/releases/freetype/freetype-2.12.1.tar.gz
|
||||
strategy:
|
||||
matrix:
|
||||
os: [ubuntu-latest, macos-latest]
|
||||
type: [win, linux, mac]
|
||||
freetype: [true, false]
|
||||
os: [ ubuntu-latest, macos-latest ]
|
||||
type: [ windows, linux, macos ]
|
||||
freetype: [ true, false ]
|
||||
include:
|
||||
- type: win
|
||||
- type: windows
|
||||
expected: /tmp/imgui/libsNative/windows64/imgui-java64.dll
|
||||
- type: linux
|
||||
expected: /tmp/imgui/libsNative/linux64/libimgui-java64.so
|
||||
- type: mac
|
||||
- type: macos
|
||||
expected: /tmp/imgui/libsNative/macosx64/libimgui-java64.dylib
|
||||
exclude:
|
||||
- os: ubuntu-latest
|
||||
type: mac
|
||||
type: macos
|
||||
- os: macos-latest
|
||||
type: win
|
||||
type: windows
|
||||
- os: macos-latest
|
||||
type: linux
|
||||
name: Build Native (type=${{ matrix.type }}, freetype=${{ matrix.freetype }})
|
||||
name: Build Native (${{ matrix.type }}${{ matrix.freetype && ', freetype' || '' }})
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- name: Checkout Repository and Submodules
|
||||
uses: actions/checkout@v2
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
fetch-depth: 0
|
||||
submodules: recursive
|
||||
|
||||
- name: Setup Java 8
|
||||
uses: actions/setup-java@v1
|
||||
- name: Setup Java
|
||||
uses: actions/setup-java@v3
|
||||
with:
|
||||
java-version: 8
|
||||
distribution: liberica
|
||||
|
||||
- name: Ant Version
|
||||
run: ant -version
|
||||
|
||||
- if: matrix.os == 'ubuntu-latest'
|
||||
name: Install MinGW-w64/GCC/G++
|
||||
name: Install MinGW-w64/GCC/G++ (Linux & Windows)
|
||||
run: sudo apt install mingw-w64
|
||||
|
||||
- if: matrix.os == 'ubuntu-latest' && matrix.type == 'linux' && matrix.freetype == true
|
||||
name: FreeType - Install
|
||||
name: FreeType - Install (Linux)
|
||||
run: sudo apt install libfreetype6-dev
|
||||
|
||||
- if: matrix.os == 'ubuntu-latest' && matrix.type == 'win' && matrix.freetype == true
|
||||
name: FreeType - Download
|
||||
- if: matrix.os == 'ubuntu-latest' && matrix.type == 'windows' && matrix.freetype == true
|
||||
name: FreeType - Install (Windows)
|
||||
run: |
|
||||
sudo wget -O /freetype.tar.gz ${{ env.FREETYPE_URL }}
|
||||
sudo mkdir /freetype
|
||||
sudo tar -xzf /freetype.tar.gz -C /freetype --strip-components=1
|
||||
|
||||
- if: matrix.os == 'ubuntu-latest' && matrix.type == 'win' && matrix.freetype == true
|
||||
name: FreeType - Compile & Install
|
||||
working-directory: /freetype
|
||||
run: |
|
||||
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
|
||||
uses: eskatos/gradle-command-action@v1
|
||||
with:
|
||||
arguments: :imgui-binding:generateLibs -Denvs=${{ matrix.type }} -Dfreetype=${{ matrix.freetype }}
|
||||
run: ./gradlew imgui-binding:generateLibs -Denvs=${{ matrix.type }} -Dfreetype=${{ matrix.freetype }}
|
||||
|
||||
- name: Upload Native
|
||||
uses: actions/upload-artifact@v2
|
||||
- name: Upload Artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: ${{ matrix.freetype && 'freetype' || 'common' }}
|
||||
path: ${{ matrix.expected }}
|
||||
name: ${{ matrix.freetype && 'native-libraries-with-freetype' || 'native-libraries' }}
|
||||
if-no-files-found: error
|
||||
path: ${{ matrix.expected }}
|
||||
|
||||
update-bin:
|
||||
if: github.ref == 'refs/heads/main' # runs only on the main branch
|
||||
name: Update Binaries
|
||||
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
|
||||
|
||||
- name: Update
|
||||
run: |
|
||||
mv /tmp/artifacts/native-libraries/* bin/
|
||||
mv /tmp/artifacts/native-libraries-with-freetype/* bin/freetype/
|
||||
|
||||
- name: Commit
|
||||
uses: EndBug/add-and-commit@v9
|
||||
with:
|
||||
default_author: github_actions
|
||||
message: '[ci skip] update native binaries'
|
||||
|
||||
release:
|
||||
if: startsWith(github.ref, 'refs/tags/v') # if tag starts with "v"
|
||||
name: Release
|
||||
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
|
||||
|
||||
- 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/**
|
||||
@@ -1,27 +0,0 @@
|
||||
name: Publish to Maven
|
||||
on: workflow_dispatch
|
||||
jobs:
|
||||
publish-to-maven:
|
||||
name: Publish to Maven
|
||||
runs-on: ubuntu-latest
|
||||
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 }}
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Setup Repository
|
||||
run: |
|
||||
chmod +x ./buildSrc/scripts/release.sh
|
||||
chmod +x ./gradlew
|
||||
|
||||
- name: Setup Java 8
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: 8
|
||||
|
||||
- name: Release
|
||||
run: ./buildSrc/scripts/release.sh
|
||||
@@ -1,60 +0,0 @@
|
||||
name: Release
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
description: 'Version'
|
||||
required: true
|
||||
jobs:
|
||||
release:
|
||||
name: Release
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Up Version
|
||||
uses: eskatos/gradle-command-action@v1
|
||||
with:
|
||||
arguments: ${{ format('upVersion -Pnext={0}', github.event.inputs.version) }}
|
||||
|
||||
- name: Commit Version
|
||||
uses: EndBug/add-and-commit@v7
|
||||
with:
|
||||
default_author: github_actions
|
||||
message: ${{ format('v{0}', github.event.inputs.version) }}
|
||||
|
||||
- name: Push Tag
|
||||
uses: mathieudutour/github-tag-action@v5.5
|
||||
id: tag_version
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
custom_tag: ${{ github.event.inputs.version }}
|
||||
|
||||
- name: Build All
|
||||
uses: eskatos/gradle-command-action@v1
|
||||
with:
|
||||
arguments: buildAll
|
||||
|
||||
- name: Generate Changelog
|
||||
id: changelog
|
||||
uses: metcalfc/changelog-generator@v1.0.0
|
||||
with:
|
||||
myToken: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Release
|
||||
uses: softprops/action-gh-release@v1
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
body: ${{ steps.changelog.outputs.changelog }}
|
||||
tag_name: ${{ steps.tag_version.outputs.new_tag }}
|
||||
draft: true
|
||||
prerelease: false
|
||||
files: |
|
||||
imgui-app/build/libs/*.jar
|
||||
imgui-binding/build/libs/*.jar
|
||||
imgui-lwjgl3/build/libs/*.jar
|
||||
bin/imgui-java64.dll
|
||||
bin/libimgui-java64.dylib
|
||||
bin/libimgui-java64.so
|
||||
@@ -1,28 +0,0 @@
|
||||
name: Update Natives
|
||||
on: workflow_dispatch
|
||||
jobs:
|
||||
update-natives:
|
||||
name: Update Natives
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Download Natives
|
||||
uses: dawidd6/action-download-artifact@v2
|
||||
with:
|
||||
workflow: ci.yml
|
||||
branch: main
|
||||
event: push
|
||||
path: /tmp/artifacts
|
||||
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Update Natives
|
||||
run: |
|
||||
mv /tmp/artifacts/common/* bin/
|
||||
mv /tmp/artifacts/freetype/* bin/freetype/
|
||||
|
||||
- name: Commit Natives
|
||||
uses: EndBug/add-and-commit@v7
|
||||
with:
|
||||
default_author: github_actions
|
||||
message: '[ci skip] Update native binaries'
|
||||
Reference in new issue
Block a user