|
1 | 1 | name: Building dengine libs, dengitor and tests(including apk) |
2 | | - |
3 | 2 | on: |
4 | 3 | push: |
5 | | - branches: [ "main" ] |
| 4 | + branches: |
| 5 | + - main |
| 6 | + tags: |
| 7 | + - "v*" |
6 | 8 | pull_request: |
7 | | - branches: [ "main" ] |
| 9 | + workflow_dispatch: |
8 | 10 |
|
9 | 11 | jobs: |
10 | | - build_linux: |
11 | | - runs-on: ubuntu-latest |
| 12 | + build: |
12 | 13 | strategy: |
13 | 14 | fail-fast: true |
| 15 | + matrix: |
| 16 | + include: |
| 17 | + - os: windows-2019 |
| 18 | + shell: msys2 |
| 19 | + name: "x86_64_windows" |
| 20 | + - os: ubuntu-22.04 |
| 21 | + shell: bash |
| 22 | + name: "x86_64_linux" |
| 23 | + runs-on: ${{ matrix.os }} |
| 24 | + defaults: |
| 25 | + run: |
| 26 | + shell: ${{ matrix.shell}} {0} |
14 | 27 |
|
15 | 28 | steps: |
16 | | - - uses: actions/checkout@v3 |
17 | | - |
18 | | - - name: submodules |
19 | | - run: | |
20 | | - git submodule update --init --depth 1 deps/cglm deps/stb deps/cpython deps/cpython-portable |
21 | | -
|
22 | 29 | - name: linux setup and dependencies |
| 30 | + if: matrix.name == 'x86_64_linux' |
23 | 31 | run: | |
24 | 32 | sudo apt update |
25 | | - sudo apt -y install libgtk-3-dev pkgconf libgl-dev libx11-dev libegl-dev |
| 33 | + sudo apt -y install libgtk-3-dev python3-dev pkgconf libgl-dev libx11-dev libegl-dev libbullet-dev |
| 34 | +
|
| 35 | + - name: msys2 setup |
| 36 | + uses: msys2/setup-msys2@v2 |
| 37 | + if: matrix.name == 'x86_64_windows' |
| 38 | + with: |
| 39 | + msystem: UCRT64 |
| 40 | + update: true |
| 41 | + pacboy: gcc gtk3 bullet cmake python |
| 42 | + install: git zip |
26 | 43 |
|
| 44 | + - name: fix crlf |
| 45 | + run: git config --global core.autocrlf input |
| 46 | + |
| 47 | + - name: checkout |
| 48 | + uses: actions/checkout@v3 |
| 49 | + |
| 50 | + - name: submodules |
| 51 | + run: | |
| 52 | + git submodule update --init --depth 1 deps/cglm deps/stb deps/mingw-ldd deps/ntldd |
| 53 | + |
27 | 54 | - name: dengine-rc |
28 | 55 | run: | |
29 | 56 | cmake -S main/dengine-rc -B build/dengine-rc |
30 | 57 | cmake --build build/dengine-rc |
31 | 58 |
|
32 | | - - name: linux config, build and install |
| 59 | + - name: ${{ matrix.name }} config, build and install |
33 | 60 | run: | |
34 | | - cmake -S . -B build/linux -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_SHARED_LIBS=ON |
35 | | - cmake --build build/linux -j$(nproc) |
36 | | - cmake --install build/linux --prefix out-linux |
| 61 | + cmake -S . -B build/${{ matrix.name }} -DBUILD_SHARED_LIBS=ON |
| 62 | + cmake --build build/${{ matrix.name }} -j$(nproc) |
| 63 | + cmake --install build/${{ matrix.name }} --prefix out-${{ matrix.name }} |
37 | 64 |
|
38 | | - - name: linux build |
39 | | - uses: actions/upload-artifact@v4 |
40 | | - with: |
41 | | - name: linux_build |
42 | | - path: out-linux |
| 65 | + - name: ${{ matrix.name }} zip |
| 66 | + run: | |
| 67 | + zip -r ${{ matrix.name }}.zip out-${{ matrix.name }}/ |
| 68 | +
|
| 69 | + - name: assets zip |
| 70 | + if: matrix.name == 'x86_64_linux' |
| 71 | + run: | |
| 72 | + zip -r assets.zip ./assets |
43 | 73 |
|
44 | 74 | - name: assets package |
| 75 | + if: matrix.name == 'x86_64_linux' |
45 | 76 | uses: actions/upload-artifact@v4 |
46 | 77 | with: |
47 | 78 | name: assets package |
48 | | - path: ./assets |
| 79 | + path: assets.zip |
| 80 | + |
| 81 | + |
| 82 | + - name: ${{ matrix.name }} build |
| 83 | + uses: actions/upload-artifact@v4 |
| 84 | + with: |
| 85 | + name: ${{ matrix.name }}_build |
| 86 | + path: ${{ matrix.name }}.zip |
49 | 87 |
|
50 | 88 | - name: Set Up JDK |
| 89 | + if: matrix.name == 'x86_64_linux' |
51 | 90 | uses: actions/setup-java@v3 |
52 | 91 | with: |
53 | 92 | distribution: zulu |
54 | | - java-version: '17' |
| 93 | + java-version: '21' |
55 | 94 | cache: 'gradle' |
56 | 95 |
|
57 | | - - name: Change wrapper permissions |
| 96 | + - name: test apk |
| 97 | + if: matrix.name == 'x86_64_linux' |
| 98 | + env: |
| 99 | + ANDROID_KEYSTORE: ${{ secrets.ANDROID_KEYSTORE }} |
| 100 | + ANDROID_KEYSTORE_ALIAS: ${{ secrets.ANDROID_KEYSTORE_ALIAS }} |
| 101 | + ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }} |
58 | 102 | run: | |
59 | | - cd tests/src/testdengine-android/apk |
| 103 | + git submodule update --init --depth 1 deps/bullet3_src deps/cpython deps/cpython-portable |
| 104 | + cd ./tests/src/testdengine-android/apk/ |
| 105 | +
|
| 106 | + echo "$ANDROID_KEYSTORE" > ks |
| 107 | + openssl base64 -A -d -in ks -out ks_dec |
| 108 | + echo "storeFile=$(pwd)/ks_dec" > signing.properties |
| 109 | + echo "storePassword=$ANDROID_KEYSTORE_PASSWORD" >> signing.properties |
| 110 | + echo "keyAlias=$ANDROID_KEYSTORE_ALIAS" >> signing.properties |
| 111 | + echo "keyPassword=$ANDROID_KEYSTORE_PASSWORD" >> signing.properties |
| 112 | + |
60 | 113 | chmod +x ./gradlew |
| 114 | + ./gradlew assembleRelease |
| 115 | + ./gradlew assembleDebug |
61 | 116 |
|
62 | | - - name: test apk |
| 117 | + - name: zip all apks |
| 118 | + if: matrix.name == 'x86_64_linux' |
63 | 119 | run: | |
64 | | - git submodule update --init --depth 1 deps/bullet3_src |
65 | | - cd ./tests/src/testdengine-android/apk/ |
66 | | - ./gradlew assembleDebug -x lintVitalAnalyzeRelease -x lintAnalyzeDebug -x lintDebug |
| 120 | + zip apks.zip $(find ./tests/src/testdengine-android/apk/app/build/outputs -iname '*.apk') |
67 | 121 |
|
| 122 | + - name: all_android apks |
| 123 | + if: matrix.name == 'x86_64_linux' |
| 124 | + uses: actions/upload-artifact@v4 |
| 125 | + with: |
| 126 | + name: all_android_apks |
| 127 | + path: apks.zip |
68 | 128 |
|
69 | 129 | - name: android build universal |
| 130 | + if: matrix.name == 'x86_64_linux' |
70 | 131 | uses: actions/upload-artifact@v4 |
71 | 132 | with: |
72 | 133 | name: android_universal_debug |
73 | 134 | path: ./tests/src/testdengine-android/apk/app/build/outputs/apk/debug/app-universal-debug.apk |
74 | 135 |
|
75 | 136 | - name: android build armebi-v7a |
| 137 | + if: matrix.name == 'x86_64_linux' |
76 | 138 | uses: actions/upload-artifact@v4 |
77 | 139 | with: |
78 | 140 | name: android_armebi-v7a_debug |
79 | 141 | path: ./tests/src/testdengine-android/apk/app/build/outputs/apk/debug/app-armeabi-v7a-debug.apk |
80 | 142 |
|
81 | 143 | - name: android build arm64-v8a |
| 144 | + if: matrix.name == 'x86_64_linux' |
82 | 145 | uses: actions/upload-artifact@v4 |
83 | 146 | with: |
84 | 147 | name: android_arm64-v8a_debug |
85 | 148 | path: ./tests/src/testdengine-android/apk/app/build/outputs/apk/debug/app-arm64-v8a-debug.apk |
86 | 149 |
|
87 | 150 | - name: android build x86 |
| 151 | + if: matrix.name == 'x86_64_linux' |
88 | 152 | uses: actions/upload-artifact@v4 |
89 | 153 | with: |
90 | 154 | name: android_x86_debug |
91 | 155 | path: ./tests/src/testdengine-android/apk/app/build/outputs/apk/debug/app-x86-debug.apk |
92 | 156 |
|
93 | 157 | - name: android build x86_64 |
| 158 | + if: matrix.name == 'x86_64_linux' |
94 | 159 | uses: actions/upload-artifact@v4 |
95 | 160 | with: |
96 | 161 | name: android_x86_64_debug |
97 | 162 | path: ./tests/src/testdengine-android/apk/app/build/outputs/apk/debug/app-x86_64-debug.apk |
98 | 163 |
|
99 | | - build_msys2: |
100 | | - runs-on: windows-latest |
101 | | - strategy: |
102 | | - fail-fast: true |
103 | | - defaults: |
104 | | - run: |
105 | | - shell: msys2 {0} |
106 | | - |
| 164 | + release: |
| 165 | + needs: build |
| 166 | + if: startsWith(github.ref, 'refs/tags/') |
| 167 | + runs-on: ubuntu-latest |
| 168 | + permissions: |
| 169 | + contents: write |
107 | 170 | steps: |
108 | | - - uses: actions/checkout@v3 |
109 | | - |
110 | | - - uses: msys2/setup-msys2@v2 |
| 171 | + - name: download all artifacts |
| 172 | + uses: actions/download-artifact@v4 |
111 | 173 | with: |
112 | | - msystem: UCRT64 |
113 | | - update: true |
114 | | - install: git mingw-w64-ucrt-x86_64-toolchain base-devel mingw-w64-ucrt-x86_64-cmake mingw-w64-ucrt-x86_64-gtk3 mingw-w64-ucrt-x86_64-bullet |
| 174 | + path: rel |
115 | 175 |
|
116 | | - - name: submodules |
| 176 | + |
| 177 | + - name: cleanup |
117 | 178 | run: | |
118 | | - git submodule update --init --depth 1 deps/stb deps/cglm |
| 179 | + rm $(find -iname '*.apk') |
| 180 | + unzip -j rel/all_android_apks/apks.zip -d rel |
| 181 | + rm rel/all_android_apks/apks.zip |
119 | 182 |
|
120 | | - - name: dengine-rc |
| 183 | + - name: github sha |
121 | 184 | run: | |
122 | | - cmake -S main/dengine-rc -B build/dengine-rc |
123 | | - cmake --build build/dengine-rc |
| 185 | + echo ${{ github.sha }} > rel/github.sha |
124 | 186 |
|
125 | | - - name: configure, build and install msys2 |
| 187 | + - name: release files list |
126 | 188 | run: | |
127 | | - cmake -S . -B build/msys2 -DCMAKE_BUILD_TYPE=RelWithDebInfo -DBUILD_SHARED_LIBS=ON |
128 | | - cmake --build build/msys2 -j$(nproc) |
129 | | - cmake --install build/msys2 --prefix out-msys2 |
| 189 | + ls rel/** |
130 | 190 |
|
131 | | - - name: msys2 build |
132 | | - uses: actions/upload-artifact@v4 |
| 191 | + - name: GitHub Release |
| 192 | + uses: softprops/action-gh-release@v2 |
133 | 193 | with: |
134 | | - name: msys2_build |
135 | | - path: out-msys2 |
136 | | - |
| 194 | + files: | |
| 195 | + rel/** |
0 commit comments