-
Notifications
You must be signed in to change notification settings - Fork 4
170 lines (140 loc) · 5.68 KB
/
jnigen.yaml
File metadata and controls
170 lines (140 loc) · 5.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
name: Build Workflow
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
release:
types: [ published ]
jobs:
build-linux:
runs-on: ubuntu-22.04
steps:
- name: Install cross-compilation toolchains
run: |
sudo apt update
sudo apt install -y --force-yes gcc g++
sudo apt install -y --force-yes gcc-aarch64-linux-gnu g++-aarch64-linux-gnu libc6-dev-arm64-cross
sudo apt install -y --force-yes gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf libc6-dev-armhf-cross
sudo apt install -y --force-yes gcc-riscv64-linux-gnu g++-riscv64-linux-gnu libc6-dev-riscv64-cross
sudo apt install -y --force-yes mingw-w64 lib32z1
- name: Download Android NDK
run: |
mkdir -p $HOME/android-ndk
cd $HOME/android-ndk
wget https://dl.google.com/android/repository/android-ndk-r27d-linux.zip -O android-ndk.zip
echo "601246087a682d1944e1e16dd85bc6e49560fe8b6d61255be2829178c8ed15d9 android-ndk.zip" | sha256sum --check
unzip android-ndk.zip
echo "NDK_HOME=$HOME/android-ndk/android-ndk-r27d" >> $GITHUB_ENV
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: 'recursive'
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'
- name: Build box2d
run: ./gradlew build_linux build_android build_windows
- name: Initialize jnigen
run: ./gradlew jnigen
- name: Build natives
run: ./gradlew jnigenBuildAllLinux jnigenBuildAllWindows jnigenBuildAllAndroid
- name: Pack artifacts
run: |
find . -name "*.a" -o -name "*.dll" -o -name "*.dylib" -o -name "*.so" | grep "libs" > native-files-list
zip natives-linux -@ < native-files-list
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: natives-linux.zip
path: natives-linux.zip
build-mac:
runs-on: macos-14
steps:
- name: Setup Xcode SDK
run: |
# See https://github.com/actions/virtual-environments/issues/2557
sudo mv /Library/Developer/CommandLineTools/SDKs/* /tmp
sudo mv /Applications/Xcode.app /Applications/Xcode.app.bak
sudo mv /Applications/Xcode_15.4.0.app /Applications/Xcode.app
sudo xcode-select -switch /Applications/Xcode.app
/usr/bin/xcodebuild -version
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: 'recursive'
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'
- name: Build box2d
run: ./gradlew build_macos build_ios
- name: Initialize jnigen
run: ./gradlew jnigen
- name: Build natives
run: ./gradlew jnigenBuildAllIOS jnigenBuildAllMacOsX
- name: Pack artifacts
run: |
find . -name "*.a" -o -name "*.dll" -o -name "*.dylib" -o -name "*.so" -o -name "*.xcframework" | grep "libs" > native-files-list
zip natives-mac -@ < native-files-list
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: natives-mac.zip
path: natives-mac.zip
publish:
runs-on: ubuntu-latest
needs: [build-linux, build-mac]
env:
ORG_GRADLE_PROJECT_MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
ORG_GRADLE_PROJECT_MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: 'recursive'
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '17'
- name: Download Artifacts from linux
if: success() && needs.build-linux.result == 'success'
uses: actions/download-artifact@v4
with:
name: natives-linux.zip
- name: Unzip artifacts
run: unzip -o natives-linux.zip
- name: Download Artifacts from mac
if: success() && needs.build-mac.result == 'success'
uses: actions/download-artifact@v4
with:
name: natives-mac.zip
- name: Unzip artifacts
run: unzip -o natives-mac.zip
- name: Package All
run: ./gradlew jnigenPackageAll
- name: Snapshot build deploy
if: github.event_name == 'push' && github.ref == 'refs/heads/master' && github.repository_owner == 'libgdx'
run: |
./gradlew build publish -x test
- name: Import GPG key
if: github.event_name == 'release' && github.repository_owner == 'libgdx'
id: import_gpg
uses: crazy-max/ghaction-import-gpg@1c6a9e9d3594f2d743f1b1dd7669ab0dfdffa922
with:
gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.GPG_PASSPHRASE }}
- name: Release build deploy
if: github.event_name == 'release' && github.repository_owner == 'libgdx'
run: ./gradlew build publish -PRELEASE -Psigning.gnupg.keyId=${{ secrets.GPG_KEYID }} -Psigning.gnupg.passphrase=${{ secrets.GPG_PASSPHRASE }} -Psigning.gnupg.keyName=${{ secrets.GPG_KEYID }} -x test
- name: Trigger manual upload to Central Repository
if: github.event_name == 'release' && github.repository_owner == 'libgdx'
run: |
curl -X POST \
-H "Authorization: Bearer $(echo -n '${{ secrets.OSSRH_USERNAME }}:${{ secrets.OSSRH_PASSWORD }}' | base64)" \
-H "Content-Type: application/json" \
https://ossrh-staging-api.central.sonatype.com/manual/upload/defaultRepository/com.badlogicgames