main.yml 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672
  1. name: CI
  2. on: [push, pull_request]
  3. jobs:
  4. build-linux-ubuntu-x64-clang:
  5. runs-on: ubuntu-20.04
  6. steps:
  7. - name: Checkout
  8. uses: actions/checkout@v3
  9. with:
  10. fetch-depth: 10
  11. - name: Prepare
  12. run: |
  13. sudo apt-get install libtool-bin libtomcrypt1 libtomcrypt-dev libtommath1 libtommath-dev libicu-dev zlib1g-dev cmake
  14. - name: Build
  15. run: |
  16. CC=clang CXX=clang++ ./autogen.sh --enable-binreloc --prefix=/opt/firebird
  17. make -j4
  18. make tests -j4
  19. make run_tests
  20. make dist
  21. tar xzvf gen/Firebird-*-linux-x64.tar.gz
  22. (cd Firebird-*-linux-x64; sudo ./install.sh -silent)
  23. - name: Upload installer
  24. uses: actions/upload-artifact@main
  25. with:
  26. name: firebird-ubuntu-20.04-clang-x64
  27. path: gen/Firebird-*-linux-x64.tar.gz
  28. build-linux-docker:
  29. name: build-linux-docker-${{ matrix.arch }}
  30. runs-on: ubuntu-22.04
  31. env:
  32. FB_DOCKER_PATH: ${{ (startsWith(matrix.arch, 'arm') && 'arm32-arm64') || 'x86-x64' }}
  33. strategy:
  34. fail-fast: false
  35. matrix:
  36. arch:
  37. - x86
  38. - x64
  39. - arm32
  40. - arm64
  41. steps:
  42. - name: Checkout
  43. uses: actions/checkout@v3
  44. with:
  45. fetch-depth: 10
  46. - name: Set up QEMU
  47. uses: docker/setup-qemu-action@v2
  48. if: ${{ startsWith(matrix.arch, 'arm') }}
  49. - name: Build
  50. run: |
  51. cd builds/docker/linux/$FB_DOCKER_PATH
  52. ./run-${{ matrix.arch }}.sh
  53. - name: Upload installer
  54. uses: actions/upload-artifact@main
  55. with:
  56. name: firebird-linux-${{ matrix.arch }}
  57. path: gen/Firebird-*-linux-${{ matrix.arch }}.tar.gz
  58. - name: Upload debug symbols
  59. uses: actions/upload-artifact@main
  60. with:
  61. name: firebird-linux-${{ matrix.arch }}-debugSymbols
  62. path: gen/Firebird-*-linux-${{ matrix.arch }}-debugSymbols.tar.gz
  63. - name: Snapshot - prepare
  64. id: snapshot_prepare
  65. if: |
  66. github.repository == 'FirebirdSQL/firebird' &&
  67. github.event.head_commit.message == 'increment build number' &&
  68. github.ref_name == 'master'
  69. run: |
  70. echo "snapshot_name=${{ github.ref_name }}" >> $GITHUB_OUTPUT
  71. - name: Snapshot - delete old assets
  72. uses: mknejp/delete-release-assets@v1
  73. if: steps.snapshot_prepare.outputs.snapshot_name
  74. with:
  75. repository: FirebirdSQL/snapshots
  76. token: ${{ secrets.SNAPSHOT_RELEASE_TOKEN }}
  77. tag: snapshot-${{ steps.snapshot_prepare.outputs.snapshot_name }}
  78. fail-if-no-release: false
  79. fail-if-no-assets: false
  80. assets: |
  81. Firebird-*-linux-${{ matrix.arch }}*.tar.gz
  82. - name: Snapshot - release
  83. id: snapshot_release_try1
  84. uses: softprops/action-gh-release@v1
  85. if: steps.snapshot_prepare.outputs.snapshot_name
  86. continue-on-error: true
  87. with:
  88. repository: FirebirdSQL/snapshots
  89. name: Latest snapshots for ${{ steps.snapshot_prepare.outputs.snapshot_name }}
  90. tag_name: snapshot-${{ steps.snapshot_prepare.outputs.snapshot_name }}
  91. prerelease: true
  92. token: ${{ secrets.SNAPSHOT_RELEASE_TOKEN }}
  93. files: |
  94. gen/Firebird-*-linux-${{ matrix.arch }}*.tar.gz
  95. - name: Snapshot - release (retry)
  96. uses: softprops/action-gh-release@v1
  97. if: |
  98. steps.snapshot_prepare.outputs.snapshot_name &&
  99. steps.snapshot_release_try1.outcome == 'failure'
  100. with:
  101. repository: FirebirdSQL/snapshots
  102. name: Latest snapshots for ${{ steps.snapshot_prepare.outputs.snapshot_name }}
  103. tag_name: snapshot-${{ steps.snapshot_prepare.outputs.snapshot_name }}
  104. prerelease: true
  105. token: ${{ secrets.SNAPSHOT_RELEASE_TOKEN }}
  106. files: |
  107. gen/Firebird-*-linux-${{ matrix.arch }}*.tar.gz
  108. build-alpine-x64:
  109. runs-on: ubuntu-20.04
  110. container: alpine:3.14
  111. steps:
  112. - name: Checkout
  113. uses: actions/checkout@v3
  114. with:
  115. fetch-depth: 10
  116. - name: Prepare
  117. run: apk update && apk --no-cache --update add build-base libtool git autoconf automake cmake zlib-dev icu-dev ncurses-dev libedit-dev linux-headers tar
  118. - name: Build
  119. run: |
  120. ./autogen.sh --enable-binreloc-threads --with-builtin-tommath --with-builtin-tomcrypt --prefix=/opt/firebird
  121. make -j4
  122. make tests -j4
  123. make run_tests
  124. make dist
  125. tar xzvf gen/Firebird-*-linux-x64.tar.gz
  126. - name: Upload installer
  127. uses: actions/upload-artifact@main
  128. with:
  129. name: firebird-alpine-x64
  130. path: gen/Firebird-*-linux-x64.tar.gz
  131. build-windows:
  132. runs-on: ${{ matrix.os }}
  133. env:
  134. VS_VERSION: ${{ (matrix.os == 'windows-2019' && '2019' || (matrix.os == 'windows-2022' && '2022' || '')) }}
  135. strategy:
  136. fail-fast: false
  137. matrix:
  138. os:
  139. - windows-2022
  140. - windows-2019
  141. platform: [x64, x86]
  142. steps:
  143. - name: Checkout
  144. uses: actions/checkout@v3
  145. with:
  146. fetch-depth: 10
  147. - name: Prepare
  148. shell: cmd
  149. run: |
  150. for /r %%i in (*.bat) do unix2dos "%%i"
  151. choco uninstall --no-progress --yes innosetup
  152. choco install --no-progress --yes innosetup --version=6.1.2
  153. - name: Build
  154. shell: cmd
  155. env:
  156. PLATFORM: ${{ matrix.platform }}
  157. VS_SCRIPT: ${{ matrix.os == 'windows-2022' && 'C:\Program Files\Microsoft Visual Studio\%VS_VERSION%\Enterprise\Common7\Tools\VsDevCmd.bat' || 'C:\Program Files (x86)\Microsoft Visual Studio\%VS_VERSION%\Enterprise\Common7\Tools\VsDevCmd.bat' }}
  158. run: |
  159. set SEVENZIP=C:\Program Files\7-Zip
  160. set INNO6_SETUP_PATH=C:\Program Files (x86)\Inno Setup 6
  161. if "%PLATFORM%" == "x64" set FB_VS_ARCH=amd64
  162. if "%PLATFORM%" == "x64" set FB_PROCESSOR_ARCHITECTURE=AMD64
  163. if "%PLATFORM%" == "x86" set FB_VS_ARCH=x86
  164. if "%PLATFORM%" == "x86" set FB_PROCESSOR_ARCHITECTURE=x86
  165. call "%VS_SCRIPT%" -arch=%FB_VS_ARCH%
  166. cd builds\win32
  167. call run_all.bat
  168. call run_tests.bat
  169. - name: Upload zip
  170. uses: actions/upload-artifact@main
  171. with:
  172. name: firebird-windows-vs-${{ env.VS_VERSION }}-${{ matrix.platform }}-zip
  173. path: builds/install_images/Firebird-*-windows-${{ matrix.platform }}.zip
  174. - name: Upload installer
  175. uses: actions/upload-artifact@main
  176. with:
  177. name: firebird-windows-vs-${{ env.VS_VERSION }}-${{ matrix.platform }}-installer
  178. path: builds/install_images/*-windows-${{ matrix.platform }}.exe
  179. build-windows-docker:
  180. runs-on: windows-2022
  181. env:
  182. VS_VERSION: ${{ (matrix.os == 'windows-2019' && '2019' || (matrix.os == 'windows-2022' && '2022' || '')) }}
  183. strategy:
  184. fail-fast: false
  185. matrix:
  186. platform: [x64, x86]
  187. steps:
  188. - name: Checkout
  189. uses: actions/checkout@v3
  190. with:
  191. fetch-depth: 10
  192. - name: Build
  193. id: build
  194. shell: cmd
  195. env:
  196. PLATFORM: ${{ matrix.platform }}
  197. run: |
  198. echo arch_suffix=%PLATFORM%>> %GITHUB_OUTPUT%
  199. mkdir builds\install_images
  200. cd builds\docker\windows
  201. call build.bat
  202. call run.bat C:\fbscripts\build-%PLATFORM%.bat
  203. - name: Upload zip
  204. uses: actions/upload-artifact@main
  205. with:
  206. name: firebird-windows-${{ matrix.platform }}-zip
  207. path: builds/install_images/Firebird-*-windows-${{ matrix.platform }}.zip
  208. - name: Upload zip (withDebugSymbols)
  209. uses: actions/upload-artifact@main
  210. with:
  211. name: firebird-windows-${{ matrix.platform }}-withDebugSymbols-zip
  212. path: builds/install_images/Firebird-*-windows-${{ matrix.platform }}-withDebugSymbols.zip
  213. - name: Upload installer
  214. uses: actions/upload-artifact@main
  215. with:
  216. name: firebird-windows-${{ matrix.platform }}-installer
  217. path: builds/install_images/*-windows-${{ matrix.platform }}.exe
  218. - name: Upload installer (withDebugSymbols)
  219. uses: actions/upload-artifact@main
  220. with:
  221. name: firebird-windows-${{ matrix.platform }}-withDebugSymbols-installer
  222. path: builds/install_images/*-windows-${{ matrix.platform }}-withDebugSymbols.exe
  223. - name: Snapshot - prepare
  224. id: snapshot_prepare
  225. if: |
  226. github.repository == 'FirebirdSQL/firebird' &&
  227. github.event.head_commit.message == 'increment build number' &&
  228. github.ref_name == 'master'
  229. shell: cmd
  230. run: |
  231. echo snapshot_name=${{ github.ref_name }}>> %GITHUB_OUTPUT%
  232. - name: Snapshot - delete old assets
  233. uses: mknejp/delete-release-assets@v1
  234. if: steps.snapshot_prepare.outputs.snapshot_name
  235. with:
  236. repository: FirebirdSQL/snapshots
  237. token: ${{ secrets.SNAPSHOT_RELEASE_TOKEN }}
  238. tag: snapshot-${{ steps.snapshot_prepare.outputs.snapshot_name }}
  239. fail-if-no-release: false
  240. fail-if-no-assets: false
  241. assets: |
  242. Firebird-*-windows-${{ steps.build.outputs.arch_suffix }}*.exe
  243. Firebird-*-windows-${{ steps.build.outputs.arch_suffix }}*.zip
  244. - name: Snapshot - release
  245. id: snapshot_release_try1
  246. uses: softprops/action-gh-release@v1
  247. if: steps.snapshot_prepare.outputs.snapshot_name
  248. continue-on-error: true
  249. with:
  250. repository: FirebirdSQL/snapshots
  251. name: Latest snapshots for ${{ steps.snapshot_prepare.outputs.snapshot_name }}
  252. tag_name: snapshot-${{ steps.snapshot_prepare.outputs.snapshot_name }}
  253. prerelease: true
  254. token: ${{ secrets.SNAPSHOT_RELEASE_TOKEN }}
  255. files: |
  256. builds/install_images/Firebird-*-windows-*.exe
  257. builds/install_images/Firebird-*-windows-*.zip
  258. - name: Snapshot - release (retry)
  259. uses: softprops/action-gh-release@v1
  260. if: |
  261. steps.snapshot_prepare.outputs.snapshot_name &&
  262. steps.snapshot_release_try1.outcome == 'failure'
  263. with:
  264. repository: FirebirdSQL/snapshots
  265. name: Latest snapshots for ${{ steps.snapshot_prepare.outputs.snapshot_name }}
  266. tag_name: snapshot-${{ steps.snapshot_prepare.outputs.snapshot_name }}
  267. prerelease: true
  268. token: ${{ secrets.SNAPSHOT_RELEASE_TOKEN }}
  269. files: |
  270. builds/install_images/Firebird-*windows-*.exe
  271. builds/install_images/Firebird-*windows-*.zip
  272. build-macos:
  273. runs-on: macos-latest
  274. steps:
  275. - name: Checkout
  276. uses: actions/checkout@v3
  277. with:
  278. fetch-depth: 10
  279. - name: Prepare - Install tools
  280. run: |
  281. brew install automake cmake libtool ninja
  282. - name: Cache - libc++ install
  283. id: cache-libcxx-install-macos
  284. uses: actions/cache@v3
  285. with:
  286. key: ${{ runner.os }}-libcxx-install-13.0.1
  287. path: |
  288. extern/libcxx-macos-install
  289. - name: Download libc++ sources
  290. if: steps.cache-libcxx-install-macos.outputs.cache-hit != 'true'
  291. run: |
  292. mkdir extern/libcxx-macos
  293. pushd extern/libcxx-macos
  294. curl -OL https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0.1/llvm-project-13.0.1.src.tar.xz
  295. tar xJf llvm-project-13.0.1.src.tar.xz
  296. popd
  297. - name: Build libc++
  298. if: steps.cache-libcxx-install-macos.outputs.cache-hit != 'true'
  299. run: |
  300. LIBCXX_BUILD_PATH=`pwd`/extern/libcxx-macos-build
  301. LIBCXX_INSTALL_PATH=`pwd`/extern/libcxx-macos-install
  302. mkdir $LIBCXX_BUILD_PATH
  303. pushd extern/libcxx-macos/llvm-project-13.0.1.src
  304. export MACOSX_DEPLOYMENT_TARGET=10.9
  305. cmake -G Ninja -S llvm -B $LIBCXX_BUILD_PATH \
  306. -DLLVM_ENABLE_PROJECTS="libcxx;libcxxabi" \
  307. -DCMAKE_INSTALL_PREFIX=$LIBCXX_INSTALL_PATH \
  308. -DCMAKE_BUILD_TYPE=Release \
  309. -DLIBCXX_ENABLE_SHARED=false \
  310. -DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=true
  311. ninja -C $LIBCXX_BUILD_PATH cxx cxxabi
  312. ninja -C $LIBCXX_BUILD_PATH install-cxx install-cxxabi
  313. popd
  314. - name: Cache - libicu install
  315. id: cache-libicu-install-macos
  316. uses: actions/cache@v3
  317. with:
  318. key: ${{ runner.os }}-libicu-install-63.2
  319. path: |
  320. extern/libicu-macos-install
  321. - name: Download and patch libicu sources
  322. if: steps.cache-libicu-install-macos.outputs.cache-hit != 'true'
  323. run: |
  324. mkdir extern/libicu-macos
  325. pushd extern/libicu-macos
  326. curl -OL https://github.com/unicode-org/icu/releases/download/release-63-2/icu4c-63_2-src.tgz
  327. curl -OL https://github.com/unicode-org/icu/commit/24aeb9a5a5874f4ce5db912e30670ac3ae236971.patch
  328. tar xzf icu4c-63_2-src.tgz
  329. cd icu/source
  330. patch -p3 < ../../24aeb9a5a5874f4ce5db912e30670ac3ae236971.patch
  331. popd
  332. - name: Build libicu
  333. if: steps.cache-libicu-install-macos.outputs.cache-hit != 'true'
  334. run: |
  335. export LIBTOOLIZE=glibtoolize
  336. export LIBTOOL=glibtool
  337. LIBICU_INSTALL_PATH=`pwd`/extern/libicu-macos-install
  338. pushd extern/libicu-macos/icu/source
  339. ./runConfigureICU MacOSX --prefix=$LIBICU_INSTALL_PATH
  340. make -j4
  341. make install
  342. install_name_tool -id @rpath/lib/libicuuc.dylib $LIBICU_INSTALL_PATH/lib/libicuuc.dylib
  343. install_name_tool -id @rpath/lib/libicui18n.dylib $LIBICU_INSTALL_PATH/lib/libicui18n.dylib
  344. install_name_tool -id @rpath/lib/libicudata.dylib $LIBICU_INSTALL_PATH/lib/libicudata.dylib
  345. install_name_tool -change libicudata.63.dylib @loader_path/libicudata.63.dylib $LIBICU_INSTALL_PATH/lib/libicuuc.63.dylib
  346. install_name_tool -change libicudata.63.dylib @loader_path/libicudata.63.dylib $LIBICU_INSTALL_PATH/lib/libicui18n.63.dylib
  347. install_name_tool -change libicuuc.63.dylib @loader_path/libicuuc.63.dylib $LIBICU_INSTALL_PATH/lib/libicui18n.63.dylib
  348. popd
  349. - name: Build
  350. run: |
  351. export LIBTOOLIZE=glibtoolize
  352. export LIBTOOL=glibtool
  353. LIBCXX_INSTALL_PATH=`pwd`/extern/libcxx-macos-install
  354. LIBICU_INSTALL_PATH=`pwd`/extern/libicu-macos-install
  355. mkdir -p gen/Release/firebird/lib
  356. cp -R $LIBICU_INSTALL_PATH/lib/libicu{data,i18n,uc}.*dylib gen/Release/firebird/lib/
  357. export C_INCLUDE_PATH="$LIBICU_INSTALL_PATH/include:`xcrun --show-sdk-path`/usr/include"
  358. export CPLUS_INCLUDE_PATH="$LIBCXX_INSTALL_PATH/include/c++/v1:$LIBICU_INSTALL_PATH/include:`xcrun --show-sdk-path`/usr/include"
  359. export LIBRARY_PATH="$LIBCXX_INSTALL_PATH/lib:$LIBICU_INSTALL_PATH/lib:$LIBRARY_PATH"
  360. ./autogen.sh --with-builtin-tommath --with-builtin-tomcrypt
  361. make -j4
  362. make tests -j4
  363. make run_tests
  364. (cd gen; make -B -f make.platform.postfix ICU_LOC="$LIBICU_INSTALL_PATH/lib/")
  365. (cd gen; make -B -f Makefile.install)
  366. # Rename directory to make sure the build is relocatable.
  367. mv gen gen2
  368. sudo installer -pkg gen2/Release/*.pkg -verbose -target /
  369. export FIREBIRD_LOCK=`pwd`/temp
  370. echo "create database 't.fdb'; select '1' from rdb\$database; select _win1252 '2' from rdb\$database; select _utf8 '3' collate unicode from rdb\$database;" | /Library/Frameworks/Firebird.framework/Resources/bin/isql
  371. echo "create database 'localhost:/tmp/t.fdb' user sysdba password 'masterkey'; select '11' from rdb\$database; select _win1252 '22' from rdb\$database; select _utf8 '33' collate unicode from rdb\$database;" | /Library/Frameworks/Firebird.framework/Resources/bin/isql
  372. mv gen2 gen
  373. mkdir gen/artifacts
  374. mv gen/Release/*.pkg gen/artifacts
  375. - name: Upload installer
  376. uses: actions/upload-artifact@main
  377. with:
  378. name: firebird-macos
  379. path: gen/artifacts
  380. - name: Snapshot - prepare
  381. id: snapshot_prepare
  382. if: |
  383. github.repository == 'FirebirdSQL/firebird' &&
  384. github.event.head_commit.message == 'increment build number' &&
  385. github.ref_name == 'master'
  386. run: |
  387. echo "snapshot_name=${{ github.ref_name }}" >> $GITHUB_OUTPUT
  388. - name: Snapshot - delete old assets
  389. uses: mknejp/delete-release-assets@v1
  390. if: steps.snapshot_prepare.outputs.snapshot_name
  391. with:
  392. repository: FirebirdSQL/snapshots
  393. token: ${{ secrets.SNAPSHOT_RELEASE_TOKEN }}
  394. tag: snapshot-${{ steps.snapshot_prepare.outputs.snapshot_name }}
  395. fail-if-no-release: false
  396. fail-if-no-assets: false
  397. assets: |
  398. Firebird-*-macos-x64*.pkg
  399. - name: Snapshot - release
  400. id: snapshot_release_try1
  401. uses: softprops/action-gh-release@v1
  402. if: steps.snapshot_prepare.outputs.snapshot_name
  403. continue-on-error: true
  404. with:
  405. repository: FirebirdSQL/snapshots
  406. name: Latest snapshots for ${{ steps.snapshot_prepare.outputs.snapshot_name }}
  407. tag_name: snapshot-${{ steps.snapshot_prepare.outputs.snapshot_name }}
  408. prerelease: true
  409. token: ${{ secrets.SNAPSHOT_RELEASE_TOKEN }}
  410. files: |
  411. gen/artifacts/Firebird-*-macos-x64*.pkg
  412. - name: Snapshot - release (retry)
  413. uses: softprops/action-gh-release@v1
  414. if: |
  415. steps.snapshot_prepare.outputs.snapshot_name &&
  416. steps.snapshot_release_try1.outcome == 'failure'
  417. with:
  418. repository: FirebirdSQL/snapshots
  419. name: Latest snapshots for ${{ steps.snapshot_prepare.outputs.snapshot_name }}
  420. tag_name: snapshot-${{ steps.snapshot_prepare.outputs.snapshot_name }}
  421. prerelease: true
  422. token: ${{ secrets.SNAPSHOT_RELEASE_TOKEN }}
  423. files: |
  424. gen/artifacts/Firebird-*-macos-x64*.pkg
  425. build-android-initial:
  426. name: build-android-${{ matrix.arch }}-initial
  427. runs-on: ubuntu-22.04
  428. env:
  429. NDK: /home/runner/Android/Ndk
  430. ARCH: ${{ matrix.arch }}
  431. FB_PREFIX: ${{ (matrix.arch == 'arm32' && 'arme') || (matrix.arch == 'x64' && 'x86_64') || matrix.arch }}
  432. strategy:
  433. fail-fast: false
  434. matrix:
  435. arch:
  436. - arm32
  437. - arm64
  438. - x86
  439. - x64
  440. steps:
  441. - name: Checkout
  442. uses: actions/checkout@v3
  443. with:
  444. fetch-depth: 10
  445. - name: Prepare - install Linux tools
  446. run: |
  447. sudo apt-get install libtool-bin libtomcrypt1 libtomcrypt-dev libtommath1 libtommath-dev libicu-dev zlib1g-dev
  448. - name: Prepare - Download and install Android NDK
  449. run: |
  450. mkdir downloads
  451. pushd downloads
  452. curl -OL https://dl.google.com/android/repository/android-ndk-r25b-linux.zip
  453. mkdir -p $NDK
  454. unzip android-ndk-r25b-linux.zip -d $NDK && f=("$NDK"/*) && mv "$NDK"/*/* "$NDK" && rmdir "${f[@]}"
  455. - name: Build
  456. run: |
  457. ./autogen.sh --prefix=/opt/firebird --enable-binreloc --with-cross-build=android.$FB_PREFIX --without-editline
  458. make -j4
  459. make CROSS_OUT=Y tests -j4
  460. builds/install/arch-specific/android/BuildPackage.sh $ARCH
  461. - name: Upload initial build
  462. uses: actions/upload-artifact@v3
  463. with:
  464. name: firebird-android-initial-${{ matrix.arch }}
  465. path: |
  466. gen/Firebird-*-android-initial-${{ matrix.arch }}*.tar.gz
  467. gen/Make.Version
  468. build-android-final:
  469. name: build-android-${{ matrix.arch }}-final
  470. needs: build-android-initial
  471. runs-on: macos-latest
  472. env:
  473. ARCH: ${{ matrix.arch }}
  474. strategy:
  475. fail-fast: false
  476. matrix:
  477. arch:
  478. - arm32
  479. - arm64
  480. - x86
  481. - x64
  482. steps:
  483. - name: Checkout
  484. uses: actions/checkout@v3
  485. with:
  486. fetch-depth: 10
  487. - name: Download initial build
  488. uses: actions/download-artifact@v3
  489. with:
  490. name: firebird-android-initial-${{ matrix.arch }}
  491. path: gen
  492. - name: Cache - AVD
  493. uses: actions/cache@v3
  494. id: avd-cache
  495. with:
  496. path: |
  497. ~/.android/avd/*
  498. ~/.android/adb*
  499. key: avd-v3
  500. - name: Create AVD and generate snapshot for caching
  501. if: steps.avd-cache.outputs.cache-hit != 'true'
  502. uses: reactivecircus/android-emulator-runner@v2
  503. with:
  504. avd-name: firebird-builder
  505. arch: x86_64
  506. api-level: 30
  507. target: google_apis
  508. ndk: 25.1.8937393
  509. emulator-options: -no-window -noaudio -no-boot-anim -camera-back none -port 5554
  510. script: |
  511. echo "Generated AVD snapshot for caching."
  512. - name: Create necessary files in Android emulator
  513. uses: reactivecircus/android-emulator-runner@v2
  514. with:
  515. avd-name: firebird-builder
  516. arch: x86_64
  517. api-level: 30
  518. target: google_apis
  519. ndk: 25.1.8937393
  520. emulator-options: -no-snapshot-save -no-window -noaudio -no-boot-anim -camera-back none -port 5554
  521. script: |
  522. sleep 20
  523. adb wait-for-device
  524. adb root
  525. NDK=/Users/runner/Library/Android/sdk/ndk/25.1.8937393 builds/install/arch-specific/android/BuildFinalPackage.sh $ARCH
  526. - name: Upload installer
  527. uses: actions/upload-artifact@v3
  528. with:
  529. name: firebird-android-${{ matrix.arch }}
  530. path: gen/Firebird-*-android-${{ matrix.arch }}.tar.gz
  531. - name: Upload installer (withDebugSymbols)
  532. uses: actions/upload-artifact@v3
  533. with:
  534. name: firebird-android-${{ matrix.arch }}-withDebugSymbols
  535. path: gen/Firebird-*-android-${{ matrix.arch }}-withDebugSymbols.tar.gz
  536. - name: Delete initial build
  537. uses: geekyeggo/delete-artifact@v1
  538. with:
  539. name: firebird-android-initial-${{ matrix.arch }}
  540. - name: Snapshot - prepare
  541. id: snapshot_prepare
  542. if: |
  543. github.repository == 'FirebirdSQL/firebird' &&
  544. github.event.head_commit.message == 'increment build number' &&
  545. github.ref_name == 'master'
  546. run: |
  547. echo "snapshot_name=${{ github.ref_name }}" >> $GITHUB_OUTPUT
  548. - name: Snapshot - delete old assets
  549. uses: mknejp/delete-release-assets@v1
  550. if: steps.snapshot_prepare.outputs.snapshot_name
  551. with:
  552. repository: FirebirdSQL/snapshots
  553. token: ${{ secrets.SNAPSHOT_RELEASE_TOKEN }}
  554. tag: snapshot-${{ steps.snapshot_prepare.outputs.snapshot_name }}
  555. fail-if-no-release: false
  556. fail-if-no-assets: false
  557. assets: |
  558. Firebird-*-android-${{ matrix.arch }}*.tar.gz
  559. - name: Snapshot - release
  560. id: snapshot_release_try1
  561. uses: softprops/action-gh-release@v1
  562. if: steps.snapshot_prepare.outputs.snapshot_name
  563. continue-on-error: true
  564. with:
  565. repository: FirebirdSQL/snapshots
  566. name: Latest snapshots for ${{ steps.snapshot_prepare.outputs.snapshot_name }}
  567. tag_name: snapshot-${{ steps.snapshot_prepare.outputs.snapshot_name }}
  568. prerelease: true
  569. token: ${{ secrets.SNAPSHOT_RELEASE_TOKEN }}
  570. files: |
  571. gen/Firebird-*-android-${{ matrix.arch }}*.tar.gz
  572. - name: Snapshot - release (retry)
  573. uses: softprops/action-gh-release@v1
  574. if: |
  575. steps.snapshot_prepare.outputs.snapshot_name &&
  576. steps.snapshot_release_try1.outcome == 'failure'
  577. with:
  578. repository: FirebirdSQL/snapshots
  579. name: Latest snapshots for ${{ steps.snapshot_prepare.outputs.snapshot_name }}
  580. tag_name: snapshot-${{ steps.snapshot_prepare.outputs.snapshot_name }}
  581. prerelease: true
  582. token: ${{ secrets.SNAPSHOT_RELEASE_TOKEN }}
  583. files: |
  584. gen/Firebird-*-android-${{ matrix.arch }}*.tar.gz