|
4 | 4 | build-java:
|
5 | 5 | strategy:
|
6 | 6 | matrix:
|
7 |
| - os: [ubuntu-latest, macos-latest] |
| 7 | + os: [ ubuntu-latest, macos-latest ] |
8 | 8 | name: Build Java
|
9 | 9 | runs-on: ${{ matrix.os }}
|
10 | 10 | steps:
|
11 | 11 | - name: Checkout Repository
|
12 |
| - uses: actions/checkout@v2 |
| 12 | + uses: actions/checkout@v3 |
| 13 | + with: |
| 14 | + fetch-depth: 0 |
13 | 15 |
|
14 |
| - - name: Setup Java 8 |
15 |
| - uses: actions/setup-java@v1 |
| 16 | + - name: Setup Java |
| 17 | + uses: actions/setup-java@v3 |
16 | 18 | with:
|
17 | 19 | java-version: 8
|
| 20 | + distribution: liberica |
18 | 21 |
|
19 | 22 | - name: Build
|
20 |
| - uses: eskatos/gradle-command-action@v1 |
| 23 | + run: ./gradlew buildAll |
| 24 | + |
| 25 | + - name: Upload Artifacts |
| 26 | + uses: actions/upload-artifact@v3 |
21 | 27 | 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 |
23 | 33 |
|
24 | 34 | build-natives:
|
25 |
| - env: |
26 |
| - FREETYPE_URL: https://download.savannah.gnu.org/releases/freetype/freetype-2.12.1.tar.gz |
27 | 35 | strategy:
|
28 | 36 | 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 ] |
32 | 40 | include:
|
33 |
| - - type: win |
| 41 | + - type: windows |
34 | 42 | expected: /tmp/imgui/libsNative/windows64/imgui-java64.dll
|
35 | 43 | - type: linux
|
36 | 44 | expected: /tmp/imgui/libsNative/linux64/libimgui-java64.so
|
37 |
| - - type: mac |
| 45 | + - type: macos |
38 | 46 | expected: /tmp/imgui/libsNative/macosx64/libimgui-java64.dylib
|
39 | 47 | exclude:
|
40 | 48 | - os: ubuntu-latest
|
41 |
| - type: mac |
| 49 | + type: macos |
42 | 50 | - os: macos-latest
|
43 |
| - type: win |
| 51 | + type: windows |
44 | 52 | - os: macos-latest
|
45 | 53 | type: linux
|
46 |
| - name: Build Native (type=${{ matrix.type }}, freetype=${{ matrix.freetype }}) |
| 54 | + name: Build Native (${{ matrix.type }}${{ matrix.freetype && ', freetype' || '' }}) |
47 | 55 | runs-on: ${{ matrix.os }}
|
48 | 56 | steps:
|
49 | 57 | - name: Checkout Repository and Submodules
|
50 |
| - uses: actions/checkout@v2 |
| 58 | + uses: actions/checkout@v3 |
51 | 59 | with:
|
| 60 | + fetch-depth: 0 |
52 | 61 | submodules: recursive
|
53 | 62 |
|
54 |
| - - name: Setup Java 8 |
55 |
| - uses: actions/setup-java@v1 |
| 63 | + - name: Setup Java |
| 64 | + uses: actions/setup-java@v3 |
56 | 65 | with:
|
57 | 66 | java-version: 8
|
| 67 | + distribution: liberica |
58 | 68 |
|
59 | 69 | - name: Ant Version
|
60 | 70 | run: ant -version
|
61 | 71 |
|
62 | 72 | - if: matrix.os == 'ubuntu-latest'
|
63 |
| - name: Install MinGW-w64/GCC/G++ |
| 73 | + name: Install MinGW-w64/GCC/G++ (Linux & Windows) |
64 | 74 | run: sudo apt install mingw-w64
|
65 | 75 |
|
66 | 76 | - if: matrix.os == 'ubuntu-latest' && matrix.type == 'linux' && matrix.freetype == true
|
67 |
| - name: FreeType - Install |
| 77 | + name: FreeType - Install (Linux) |
68 | 78 | run: sudo apt install libfreetype6-dev
|
69 | 79 |
|
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) |
72 | 82 | run: |
|
73 |
| - sudo wget -O /freetype.tar.gz ${{ env.FREETYPE_URL }} |
74 | 83 | 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 |
81 | 86 | 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
|
82 | 87 | sudo make
|
83 | 88 | sudo make install
|
84 | 89 |
|
85 | 90 | - 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 }} |
89 | 92 |
|
90 |
| - - name: Upload Native |
91 |
| - uses: actions/upload-artifact@v2 |
| 93 | + - name: Upload Artifacts |
| 94 | + uses: actions/upload-artifact@v3 |
92 | 95 | with:
|
93 |
| - name: ${{ matrix.freetype && 'freetype' || 'common' }} |
94 |
| - path: ${{ matrix.expected }} |
| 96 | + name: ${{ matrix.freetype && 'native-libraries-with-freetype' || 'native-libraries' }} |
95 | 97 | 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/** |
0 commit comments