-
Notifications
You must be signed in to change notification settings - Fork 10
323 lines (303 loc) · 17.3 KB
/
platform_natives.yaml
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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
name: multi-arch build
on:
push:
branches:
- master
- develop
jobs:
build:
name: ${{ matrix.type }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- { os: ubuntu-22.04, type: "linux_amd64_gnu_ssl1", compiler: "gnu", ssl: "ssl1", debianArch: "amd64", tripleArch: "x86_64", tripleGnu: "gnu", debianVersion: "buster-backports", native: "true" }
- { os: ubuntu-22.04, type: "linux_amd64_gnu_ssl3", compiler: "gnu", ssl: "ssl3", debianArch: "amd64", tripleArch: "x86_64", tripleGnu: "gnu", debianVersion: "bookworm-backports", native: "true" }
- { os: ubuntu-22.04, type: "linux_amd64_clang_ssl3", compiler: "clang", ssl: "ssl3", debianArch: "amd64", tripleArch: "x86_64", tripleGnu: "gnu", debianVersion: "bookworm-backports", native: "true" }
#- { os: ubuntu-22.04, type: "linux_i386_gnu_ssl1", compiler: "gnu", ssl: "ssl1", debianArch: "i386", tripleArch: "i386", tripleGnu: "gnu", debianVersion: "buster-backports", native: "false" }
#- { os: ubuntu-22.04, type: "linux_i386_gnu_ssl3", compiler: "gnu", ssl: "ssl3", debianArch: "i386", tripleArch: "i386", tripleGnu: "gnu", debianVersion: "bookworm-backports", native: "false" }
- { os: ubuntu-22.04, type: "linux_ppc64el_gnu_ssl3", compiler: "gnu", ssl: "ssl3", debianArch: "ppc64el", tripleArch: "powerpc64le", tripleGnu: "gnu", debianVersion: "bookworm-backports", native: "false" }
- { os: ubuntu-22.04, type: "linux_riscv64_gnu_ssl3", compiler: "gnu", ssl: "ssl3", debianArch: "riscv64", tripleArch: "riscv64", tripleGnu: "gnu", debianVersion: "sid", native: "false" }
- { os: ubuntu-22.04, type: "linux_armhf_gnu_ssl1", compiler: "gnu", ssl: "ssl1", debianArch: "armhf", tripleArch: "arm", tripleGnu: "gnueabihf", debianVersion: "buster-backports", native: "false" }
- { os: ubuntu-22.04, type: "linux_armhf_gnu_ssl3", compiler: "gnu", ssl: "ssl3", debianArch: "armhf", tripleArch: "arm", tripleGnu: "gnueabihf", debianVersion: "bookworm-backports", native: "false" }
- { os: ubuntu-22.04, type: "linux_arm64_gnu_ssl1", compiler: "gnu", ssl: "ssl1", debianArch: "arm64", tripleArch: "aarch64", tripleGnu: "gnu", debianVersion: "buster-backports", native: "false" }
- { os: ubuntu-22.04, type: "linux_arm64_gnu_ssl3", compiler: "gnu", ssl: "ssl3", debianArch: "arm64", tripleArch: "aarch64", tripleGnu: "gnu", debianVersion: "bookworm-backports", native: "false" }
- { os: ubuntu-22.04, type: "linux_arm64_clang_ssl3", compiler: "clang", ssl: "ssl3", debianArch: "arm64", tripleArch: "aarch64", tripleGnu: "gnu", debianVersion: "bookworm-backports", native: "false" }
- { os: windows-2019, type: "windows_amd64", vcpkgCommitId: "6ca56aeb457f033d344a7106cb3f9f1abf8f4e98", triplet: "x64-windows-static" }
- { os: macos-12, type: "macos_amd64" }
# todo: do not enable until github actions adds support to apple silicon, accepting PRs
# - { os: macos-12, type: "macos_arm64" }
steps:
- name: Checkout current repo
uses: actions/checkout@v3
with:
submodules: "recursive"
- name: Get version
shell: bash
run: |
set -xeo pipefail
# Get latest commit short hash
HASH_VERSION=$(git rev-parse --short HEAD)
# Strip git ref prefix from version
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,')
# Strip "v" prefix from tag name
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
# Use Docker `latest` tag convention
[ "$VERSION" == "master" ] && VERSION=latest
HASH_VERSION=$(echo "$HASH_VERSION" | awk '{print tolower($0)}')
VERSION=$(echo "$VERSION" | awk '{print tolower($0)}')
TYPE=${{ matrix.type }}
SAFE_TYPE=${TYPE///} # linux_amd64_ -> linux_amd64_
COMPILER=${{ matrix.compiler }}
SSL=${{ matrix.ssl }}
DEBIAN_ARCH=${{ matrix.debianArch }}
TRIPLE_ARCH=${{ matrix.tripleArch }}
TRIPLE_GNU=${{ matrix.tripleGnu }}
NATIVE=${{ matrix.native }}
DEBIAN_VERSION=${{ matrix.debianVersion }}
REVISION=4.0.${{ github.run_number }}
GH_MATRIX_OS=${{ matrix.os }}
GH_MATRIX_TYPE=${{ matrix.type }}
# Store variable for future use
echo "HASH_VERSION=$HASH_VERSION" >> $GITHUB_ENV
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "TYPE=$TYPE" >> $GITHUB_ENV
echo "SAFE_TYPE=$SAFE_TYPE" >> $GITHUB_ENV
echo "COMPILER=$COMPILER" >> $GITHUB_ENV
echo "SSL=$SSL" >> $GITHUB_ENV
echo "DEBIAN_ARCH=$DEBIAN_ARCH" >> $GITHUB_ENV
echo "TRIPLE_ARCH=$TRIPLE_ARCH" >> $GITHUB_ENV
echo "TRIPLE_GNU=$TRIPLE_GNU" >> $GITHUB_ENV
echo "NATIVE=$NATIVE" >> $GITHUB_ENV
echo "DEBIAN_VERSION=$DEBIAN_VERSION" >> $GITHUB_ENV
echo "REVISION=$REVISION" >> $GITHUB_ENV
echo "GH_MATRIX_OS=$GH_MATRIX_OS" >> $GITHUB_ENV
echo "GH_MATRIX_TYPE=$GH_MATRIX_TYPE" >> $GITHUB_ENV
# Print debug info
echo "hash version: $HASH_VERSION"
echo "version: $VERSION"
echo "safe arch: $SAFE_ARCH"
echo "ssl: $SSL"
echo "debian arch: $DEBIAN_ARCH"
echo "triple arch: $TRIPLE_ARCH"
echo "triple gnu: $TRIPLE_GNU"
echo "Variables:"
# Save env to file
cat $GITHUB_ENV > github.env
- name: Setup Java (Snapshot)
if: github.ref == 'refs/heads/develop'
uses: actions/setup-java@v3
with:
java-version: 11
distribution: temurin
server-id: mchv-snapshot-distribution
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
cache: 'maven'
- name: Setup Java (Release)
if: github.ref != 'refs/heads/develop'
uses: actions/setup-java@v3
with:
java-version: 11
distribution: temurin
server-id: mchv-release-distribution
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
cache: 'maven'
- name: Setup PHP with Readline extension
uses: shivammathur/setup-php@v2
with:
php-version: '8.0'
extensions: readline
# - name: Install ubuntu 20.04 dependencies
# if: matrix.os == 'ubuntu-20.04'
# shell: bash
# run: |
# export DEBIAN_FRONTEND=noninteractive
# sudo apt-get --assume-yes update
# sudo apt-get --assume-yes install make git zlib1g-dev libssl-dev gperf php-cli cmake default-jdk clang-12 lld-12 libc++-12-dev libc++abi-12-dev libgcc-9-dev libunwind-dev libclang-common-12-dev maven
- name: Install ubuntu 20.04 dependencies (cached)
if: matrix.os == 'ubuntu-20.04'
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: make git zlib1g-dev libssl-dev gperf php-cli cmake default-jdk clang-12 lld-12 libc++-12-dev libc++abi-12-dev libgcc-9-dev libunwind-dev libclang-common-12-dev maven
version: 1.0
# - name: Install ubuntu 22.04 dependencies
# if: matrix.os == 'ubuntu-22.04'
# shell: bash
# run: |
# export DEBIAN_FRONTEND=noninteractive
# sudo apt-get --assume-yes update
# sudo apt-get --assume-yes install make git zlib1g-dev libssl-dev gperf php-cli cmake default-jdk clang-14 lld-14 libc++-14-dev libc++abi-14-dev libgcc-11-dev libunwind-14-dev libclang-common-14-dev maven
- name: Install ubuntu 22.04 dependencies (cached)
if: matrix.os == 'ubuntu-22.04'
uses: awalsh128/cache-apt-pkgs-action@latest
with:
packages: make git zlib1g-dev libssl-dev gperf php-cli cmake default-jdk clang-14 lld-14 libc++-14-dev libc++abi-14-dev libgcc-11-dev libunwind-14-dev libclang-common-14-dev maven
version: 1.0
- name: Install custom dependencies
if: matrix.os == 'macos-12' || matrix.os == 'windows-2019'
shell: bash
run: |
set -xeo pipefail
echo "REVISION: $REVISION"
if [[ -f "./.github/workflows/scripts/install_deps_${SAFE_TYPE}.sh" ]]; then
if [[ "$GH_MATRIX_OS" == *"windows"* || "$GH_MATRIX_OS" == *"macos"* ]]; then
./.github/workflows/scripts/install_deps_${SAFE_TYPE}.sh
else
sudo ./.github/workflows/scripts/install_deps_${SAFE_TYPE}.sh
fi
fi
- name: Run sccache-cache
uses: mozilla-actions/[email protected]
- name: Install MSVC
if: matrix.os == 'windows-2019'
uses: ilammy/msvc-dev-cmd@v1
with:
toolset: 14.0
vs-version: '[16.4,16.5)'
- name: Setup cmake
if: matrix.os == 'windows-2019'
uses: lukka/get-cmake@latest
- name: Set up Maven
uses: stCarolas/[email protected]
with:
maven-version: 3.8.2
- name: Setup NASM
if: matrix.os == 'windows-2019'
uses: ilammy/setup-nasm@v1
- name: Restore artifacts, or setup vcpkg (do not install any package)
if: matrix.os == 'windows-2019'
uses: lukka/[email protected]
with:
# Just install vcpkg for now, do not install any ports in this step yet.
setupOnly: true
# Location of the vcpkg submodule in the Git repository.
vcpkgDirectory: '${{ github.workspace }}/vcpkg'
vcpkgGitCommitId: '${{ matrix.vcpkgCommitId}}'
# Since the cache must be invalidated when content of the vcpkg.json file changes, let's
# compute its hash and append this to the computed cache's key.
appendedCacheKey: ${{ hashFiles( '**/vcpkg_manifest/vcpkg.json' ) }}
vcpkgTriplet: ${{ matrix.triplet }}
# Ensure the vcpkg artifacts are cached, they are generated in the 'CMAKE_BINARY_DIR/vcpkg_installed' directory.
additionalCachedPaths: ${{ github.workspace }}/vcpkg
- name: Install vcpkg deps
if: matrix.os == 'windows-2019'
run: |
set -xeo pipefail
./vcpkg/vcpkg install gperf openssl:x64-windows-static zlib:x64-windows-static
shell: bash
- name: Build
if: matrix.os == 'macos-12' || matrix.os == 'windows-2019'
shell: bash
run: |
set -xeo pipefail
echo "REVISION: $REVISION"
source ./.github/workflows/scripts/build_${SAFE_TYPE}.sh
env:
SCCACHE_GHA_ENABLED: "on"
- name: Set up Docker buildx
uses: docker/setup-buildx-action@v2
if: matrix.os == 'ubuntu-22.04'
- name: Build
uses: docker/build-push-action@v4
if: matrix.os == 'ubuntu-22.04'
with:
context: .
push: false
file: tdlight.arch.${{env.SSL}}.${{env.COMPILER}}.dockerfile
tags: tdlight.${{env.DEBIAN_ARCH}}.${{env.SSL}}.${{env.COMPILER}}:latest
build-args: |
SCCACHE_GHA_ENABLED=on
ACTIONS_CACHE_URL=${{env.ACTIONS_CACHE_URL}}
ACTIONS_RUNTIME_TOKEN=${{env.ACTIONS_RUNTIME_TOKEN}}
ARCH_DEBIAN=${{env.DEBIAN_ARCH}}
ARCH_TRIPLE=${{env.TRIPLE_ARCH}}
TRIPLE_GNU=${{env.TRIPLE_GNU}}
NATIVE=${{env.NATIVE}}
DEBIAN_VERSION=${{env.DEBIAN_VERSION}}
cache-from: type=gha
cache-to: type=gha,mode=max
outputs: type=local,dest=./docker-out
- name: Copy built files from docker
if: matrix.os == 'ubuntu-22.04'
shell: bash
run: |
set -xeo pipefail
echo "REVISION: $REVISION"
rm -rf natives
mv ./docker-out/out/natives natives
mv ./docker-out/out/libtdjni.so "libtdjni.${REVISION}-${TYPE}.so"
mv ./docker-out/out/tdlight-natives.jar "natives/target-${TYPE}/tdlight-natives-${REVISION}-${TYPE}.jar"
- uses: actions/upload-artifact@v3
with:
name: tdlight-natives-${{env.REVISION}}-${{env.TYPE}}.jar
path: natives/target-${{env.TYPE}}/tdlight-natives-${{env.REVISION}}-${{env.TYPE}}.jar
- name: Deploy to Maven (Snapshot)
if: github.ref == 'refs/heads/develop'
shell: bash
run: |
set -xeo pipefail
echo "REVISION: $REVISION"
echo "TYPE: $TYPE"
mvn -B -f natives/pom.xml -Drevision="$REVISION" -Dnative.type.classifier="$TYPE" clean package
mvn -B org.apache.maven.plugins:maven-deploy-plugin:3.1.1:deploy-file -Durl=https://mvn.mchv.eu/repository/mchv-snapshot \
-DrepositoryId=mchv-snapshot-distribution \
-Dfile=natives/target-$TYPE/tdlight-natives-$REVISION-$TYPE.jar \
-Dpackaging=pom \
-DgroupId=it.tdlight \
-DartifactId=tdlight-natives \
-Dversion=$REVISION \
-Drevision=$REVISION \
-Dclassifier=$TYPE \
-Dnative.type.classifier="$TYPE"
if [[ "$TYPE" == "linux_amd64_gnu_ssl1" ]]; then
mvn -B org.apache.maven.plugins:maven-deploy-plugin:3.1.1:deploy-file -Durl=https://mvn.mchv.eu/repository/mchv-snapshot \
-DrepositoryId=mchv-snapshot-distribution \
-Dfile=natives/.ci-friendly-pom.xml \
-Dpackaging=pom \
-DgroupId=it.tdlight \
-DartifactId=tdlight-natives \
-Dversion=$REVISION \
-Drevision=$REVISION \
-Dnative.type.classifier="$TYPE"
fi
echo "Done."
exit 0
env:
MAVEN_USERNAME: ${{ secrets.MCHV_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MCHV_TOKEN }}
- name: Deploy to Maven (Release)
if: github.ref == 'refs/heads/master'
shell: bash
run: |
set -xeo pipefail
echo "REVISION: $REVISION"
echo "TYPE: $TYPE"
mvn -B -f natives/pom.xml -Drevision="$REVISION" -Dnative.type.classifier="$TYPE" clean package
mvn -B org.apache.maven.plugins:maven-deploy-plugin:3.1.1:deploy-file -Durl=https://mvn.mchv.eu/repository/mchv \
-DrepositoryId=mchv-release-distribution \
-Dfile=natives/target-$TYPE/tdlight-natives-$REVISION-$TYPE.jar \
-Dpackaging=pom \
-DgroupId=it.tdlight \
-DartifactId=tdlight-natives \
-Dversion=$REVISION \
-Drevision=$REVISION \
-Dclassifier=$TYPE \
-Dnative.type.classifier="$TYPE"
if [[ "$TYPE" == "linux_amd64_gnu_ssl1" ]]; then
mvn -B org.apache.maven.plugins:maven-deploy-plugin:3.1.1:deploy-file -Durl=https://mvn.mchv.eu/repository/mchv \
-DrepositoryId=mchv-release-distribution \
-Dfile=natives/.ci-friendly-pom.xml \
-Dpackaging=pom \
-DgroupId=it.tdlight \
-DartifactId=tdlight-natives \
-Dversion=$REVISION \
-Drevision=$REVISION \
-Dnative.type.classifier="$TYPE"
fi
echo "Done."
exit 0
env:
MAVEN_USERNAME: ${{ secrets.MCHV_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MCHV_TOKEN }}