Skip to content

Commit 2957cb4

Browse files
authored
[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
1 parent 62377c7 commit 2957cb4

File tree

24 files changed

+288
-350
lines changed

24 files changed

+288
-350
lines changed

.github/workflows/ci.yml

Lines changed: 114 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -4,92 +4,169 @@ jobs:
44
build-java:
55
strategy:
66
matrix:
7-
os: [ubuntu-latest, macos-latest]
7+
os: [ ubuntu-latest, macos-latest ]
88
name: Build Java
99
runs-on: ${{ matrix.os }}
1010
steps:
1111
- name: Checkout Repository
12-
uses: actions/checkout@v2
12+
uses: actions/checkout@v3
13+
with:
14+
fetch-depth: 0
1315

14-
- name: Setup Java 8
15-
uses: actions/setup-java@v1
16+
- name: Setup Java
17+
uses: actions/setup-java@v3
1618
with:
1719
java-version: 8
20+
distribution: liberica
1821

1922
- name: Build
20-
uses: eskatos/gradle-command-action@v1
23+
run: ./gradlew buildAll
24+
25+
- name: Upload Artifacts
26+
uses: actions/upload-artifact@v3
2127
with:
22-
arguments: buildAll
28+
name: java-libraries
29+
path: |
30+
imgui-app/build/libs/*.jar
31+
imgui-binding/build/libs/*.jar
32+
imgui-lwjgl3/build/libs/*.jar
2333
2434
build-natives:
25-
env:
26-
FREETYPE_URL: https://download.savannah.gnu.org/releases/freetype/freetype-2.12.1.tar.gz
2735
strategy:
2836
matrix:
29-
os: [ubuntu-latest, macos-latest]
30-
type: [win, linux, mac]
31-
freetype: [true, false]
37+
os: [ ubuntu-latest, macos-latest ]
38+
type: [ windows, linux, macos ]
39+
freetype: [ true, false ]
3240
include:
33-
- type: win
41+
- type: windows
3442
expected: /tmp/imgui/libsNative/windows64/imgui-java64.dll
3543
- type: linux
3644
expected: /tmp/imgui/libsNative/linux64/libimgui-java64.so
37-
- type: mac
45+
- type: macos
3846
expected: /tmp/imgui/libsNative/macosx64/libimgui-java64.dylib
3947
exclude:
4048
- os: ubuntu-latest
41-
type: mac
49+
type: macos
4250
- os: macos-latest
43-
type: win
51+
type: windows
4452
- os: macos-latest
4553
type: linux
46-
name: Build Native (type=${{ matrix.type }}, freetype=${{ matrix.freetype }})
54+
name: Build Native (${{ matrix.type }}${{ matrix.freetype && ', freetype' || '' }})
4755
runs-on: ${{ matrix.os }}
4856
steps:
4957
- name: Checkout Repository and Submodules
50-
uses: actions/checkout@v2
58+
uses: actions/checkout@v3
5159
with:
60+
fetch-depth: 0
5261
submodules: recursive
5362

54-
- name: Setup Java 8
55-
uses: actions/setup-java@v1
63+
- name: Setup Java
64+
uses: actions/setup-java@v3
5665
with:
5766
java-version: 8
67+
distribution: liberica
5868

5969
- name: Ant Version
6070
run: ant -version
6171

6272
- if: matrix.os == 'ubuntu-latest'
63-
name: Install MinGW-w64/GCC/G++
73+
name: Install MinGW-w64/GCC/G++ (Linux & Windows)
6474
run: sudo apt install mingw-w64
6575

6676
- if: matrix.os == 'ubuntu-latest' && matrix.type == 'linux' && matrix.freetype == true
67-
name: FreeType - Install
77+
name: FreeType - Install (Linux)
6878
run: sudo apt install libfreetype6-dev
6979

70-
- if: matrix.os == 'ubuntu-latest' && matrix.type == 'win' && matrix.freetype == true
71-
name: FreeType - Download
80+
- if: matrix.os == 'ubuntu-latest' && matrix.type == 'windows' && matrix.freetype == true
81+
name: FreeType - Install (Windows)
7282
run: |
73-
sudo wget -O /freetype.tar.gz ${{ env.FREETYPE_URL }}
7483
sudo mkdir /freetype
75-
sudo tar -xzf /freetype.tar.gz -C /freetype --strip-components=1
76-
77-
- if: matrix.os == 'ubuntu-latest' && matrix.type == 'win' && matrix.freetype == true
78-
name: FreeType - Compile & Install
79-
working-directory: /freetype
80-
run: |
84+
sudo tar -xzf ./vendor/freetype-2.12.1.tar.gz -C /freetype --strip-components=1
85+
cd /freetype
8186
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
8287
sudo make
8388
sudo make install
8489
8590
- name: Build
86-
uses: eskatos/gradle-command-action@v1
87-
with:
88-
arguments: :imgui-binding:generateLibs -Denvs=${{ matrix.type }} -Dfreetype=${{ matrix.freetype }}
91+
run: ./gradlew imgui-binding:generateLibs -Denvs=${{ matrix.type }} -Dfreetype=${{ matrix.freetype }}
8992

90-
- name: Upload Native
91-
uses: actions/upload-artifact@v2
93+
- name: Upload Artifacts
94+
uses: actions/upload-artifact@v3
9295
with:
93-
name: ${{ matrix.freetype && 'freetype' || 'common' }}
94-
path: ${{ matrix.expected }}
96+
name: ${{ matrix.freetype && 'native-libraries-with-freetype' || 'native-libraries' }}
9597
if-no-files-found: error
98+
path: ${{ matrix.expected }}
99+
100+
update-bin:
101+
if: github.ref == 'refs/heads/main' # runs only on the main branch
102+
name: Update Binaries
103+
runs-on: ubuntu-latest
104+
needs: build-natives
105+
steps:
106+
- name: Checkout Repository
107+
uses: actions/checkout@v3
108+
109+
- name: Download Artifacts
110+
uses: actions/download-artifact@v3
111+
with:
112+
path: /tmp/artifacts
113+
114+
- name: Update
115+
run: |
116+
mv /tmp/artifacts/native-libraries/* bin/
117+
mv /tmp/artifacts/native-libraries-with-freetype/* bin/freetype/
118+
119+
- name: Commit
120+
uses: EndBug/add-and-commit@v9
121+
with:
122+
default_author: github_actions
123+
message: '[ci skip] update native binaries'
124+
125+
release:
126+
if: startsWith(github.ref, 'refs/tags/v') # if tag starts with "v"
127+
name: Release
128+
runs-on: ubuntu-latest
129+
needs: [ build-java, build-natives ]
130+
steps:
131+
- name: Checkout Repository
132+
uses: actions/checkout@v3
133+
with:
134+
fetch-depth: 0
135+
136+
- name: Setup Java
137+
uses: actions/setup-java@v3
138+
with:
139+
java-version: 8
140+
distribution: liberica
141+
142+
- name: Download Artifacts
143+
uses: actions/download-artifact@v3
144+
with:
145+
path: out/artifacts
146+
147+
- name: Zip Artifacts
148+
run: |
149+
mkdir out/archives
150+
zip -rj out/archives/native-libraries out/artifacts/native-libraries
151+
zip -rj out/archives/native-libraries-with-freetype out/artifacts/native-libraries-with-freetype
152+
zip -rj out/archives/java-libraries out/artifacts/java-libraries
153+
154+
- name: Publish
155+
env:
156+
NEXUS_UPD_ID: ${{ secrets.RELEASE_NEXUS_UPD_ID }}
157+
NEXUS_UPD_PASS: ${{ secrets.RELEASE_NEXUS_UPD_PASS }}
158+
SIGNING_KEY_ID: ${{ secrets.RELEASE_SIGNING_KEY_ID }}
159+
SIGNING_KEY: ${{ secrets.RELEASE_SIGNING_KEY }}
160+
run: |
161+
chmod +x ./buildSrc/scripts/publish.sh
162+
buildSrc/scripts/publish.sh
163+
164+
- name: Release
165+
uses: softprops/action-gh-release@v1
166+
env:
167+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
168+
with:
169+
draft: true
170+
prerelease: false
171+
files: |
172+
out/archives/**

.github/workflows/publish_to_maven.yml

Lines changed: 0 additions & 27 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 0 additions & 60 deletions
This file was deleted.

.github/workflows/update_natives.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,11 @@ logs/
2525
*.tar.gz
2626
*.rar
2727
*.gpg
28+
!vendor/freetype-2.12.1.tar.gz
2829

2930
# Gradle
3031
.gradletasknamecache
3132
.gradle/
32-
!gradle/wrapper/*.jar
3333
build/
3434
out/
35+
!gradle/wrapper/*.jar

0 commit comments

Comments
 (0)