main.yml 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592
  1. name: CI
  2. on: [push, pull_request]
  3. jobs:
  4. build-linux-ubuntu-x64-clang:
  5. if: github.ref_type != 'tag'
  6. runs-on: ubuntu-22.04
  7. steps:
  8. - name: Checkout
  9. uses: actions/checkout@v4
  10. with:
  11. fetch-depth: 10
  12. - name: Adjust snapshot build number
  13. uses: ./.github/actions/adjust-snapshot-buildno
  14. - name: Prepare
  15. run: |
  16. sudo apt-get install libtool-bin libtomcrypt1 libtomcrypt-dev libtommath1 libtommath-dev libicu-dev zlib1g-dev cmake
  17. - name: Build
  18. run: |
  19. CC=clang CXX=clang++ ./autogen.sh --enable-binreloc --prefix=/opt/firebird
  20. make -j4
  21. make tests -j4
  22. make run_tests
  23. make dist
  24. tar xzvf gen/Firebird-*-linux-x64.tar.gz
  25. (cd Firebird-*-linux-x64; sudo ./install.sh -silent)
  26. - name: Upload installer
  27. uses: actions/upload-artifact@v4
  28. with:
  29. name: firebird-ubuntu-20.04-clang-x64
  30. path: gen/Firebird-*-linux-x64.tar.gz
  31. build-linux-docker:
  32. name: build-linux-docker-${{ matrix.arch }}
  33. runs-on: ubuntu-22.04
  34. env:
  35. FB_DOCKER_PATH: ${{ (startsWith(matrix.arch, 'arm') && 'arm32-arm64') || 'x86-x64' }}
  36. strategy:
  37. fail-fast: false
  38. matrix:
  39. arch:
  40. - x86
  41. - x64
  42. - arm32
  43. - arm64
  44. steps:
  45. - name: Checkout
  46. uses: actions/checkout@v4
  47. with:
  48. fetch-depth: 10
  49. - name: Adjust snapshot build number
  50. uses: ./.github/actions/adjust-snapshot-buildno
  51. - name: Get Release Notes
  52. uses: ./.github/actions/get-release-notes
  53. - name: Set up QEMU
  54. uses: docker/setup-qemu-action@v3
  55. if: ${{ startsWith(matrix.arch, 'arm') }}
  56. - name: Build
  57. run: |
  58. cd builds/docker/linux/$FB_DOCKER_PATH
  59. ./run-${{ matrix.arch }}.sh
  60. - name: Upload installer
  61. uses: actions/upload-artifact@v4
  62. with:
  63. name: firebird-linux-${{ matrix.arch }}
  64. path: gen/Firebird-*-linux-${{ matrix.arch }}.tar.gz
  65. - name: Upload debug symbols
  66. uses: actions/upload-artifact@v4
  67. with:
  68. name: firebird-linux-${{ matrix.arch }}-debugSymbols
  69. path: gen/Firebird-*-linux-${{ matrix.arch }}-debugSymbols.tar.gz
  70. - name: Create release
  71. uses: ./.github/actions/create-release
  72. with:
  73. token: ${{ secrets.SNAPSHOT_RELEASE_TOKEN }}
  74. deletePatterns: Firebird-*-linux-${{ matrix.arch }}*.tar.gz
  75. uploadFiles: gen/Firebird-*-linux-${{ matrix.arch }}*.tar.gz
  76. build-src-bundle-docker:
  77. name: build-src-bundle-docker
  78. runs-on: ubuntu-22.04
  79. steps:
  80. - name: Checkout
  81. uses: actions/checkout@v4
  82. with:
  83. fetch-depth: 10
  84. - name: Adjust snapshot build number
  85. uses: ./.github/actions/adjust-snapshot-buildno
  86. - name: Get Release Notes
  87. uses: ./.github/actions/get-release-notes
  88. - name: Build
  89. run: |
  90. cd builds/docker/linux/x86-x64
  91. ./run-src-bundle.sh
  92. - name: Create release
  93. uses: ./.github/actions/create-release
  94. with:
  95. token: ${{ secrets.SNAPSHOT_RELEASE_TOKEN }}
  96. deletePatterns: Firebird-*-source.tar.xz
  97. uploadFiles: gen/Firebird-*-source.tar.xz
  98. build-alpine-x64:
  99. if: github.ref_type != 'tag'
  100. runs-on: ubuntu-22.04
  101. container: alpine:3.14
  102. steps:
  103. - name: Checkout
  104. uses: actions/checkout@v4
  105. with:
  106. fetch-depth: 10
  107. - name: Prepare
  108. 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 sed
  109. - name: Adjust snapshot build number
  110. uses: ./.github/actions/adjust-snapshot-buildno
  111. - name: Build
  112. run: |
  113. ./autogen.sh --enable-binreloc-threads --with-builtin-tommath --with-builtin-tomcrypt --prefix=/opt/firebird
  114. make -j4
  115. make tests -j4
  116. make run_tests
  117. make dist
  118. tar xzvf gen/Firebird-*-linux-x64.tar.gz
  119. - name: Upload installer
  120. uses: actions/upload-artifact@v4
  121. with:
  122. name: firebird-alpine-x64
  123. path: gen/Firebird-*-linux-x64.tar.gz
  124. build-windows:
  125. if: github.ref_type != 'tag'
  126. runs-on: ${{ matrix.os }}
  127. env:
  128. VS_VERSION: ${{ (matrix.os == 'windows-2019' && '2019' || (matrix.os == 'windows-2022' && '2022' || '')) }}
  129. strategy:
  130. fail-fast: false
  131. matrix:
  132. os:
  133. - windows-2022
  134. - windows-2019
  135. platform: [x64, x86]
  136. steps:
  137. - name: Checkout
  138. uses: actions/checkout@v4
  139. with:
  140. fetch-depth: 10
  141. - name: Adjust snapshot build number
  142. uses: ./.github/actions/adjust-snapshot-buildno
  143. - name: Prepare
  144. shell: cmd
  145. run: |
  146. for /r %%i in (*.bat) do unix2dos "%%i"
  147. choco uninstall --no-progress --yes innosetup
  148. choco install --no-progress --yes innosetup --version=6.1.2
  149. - name: Build
  150. shell: cmd
  151. env:
  152. PLATFORM: ${{ matrix.platform }}
  153. 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' }}
  154. run: |
  155. set SEVENZIP=C:\Program Files\7-Zip
  156. set INNO6_SETUP_PATH=C:\Program Files (x86)\Inno Setup 6
  157. if "%PLATFORM%" == "x64" set FB_VS_ARCH=amd64
  158. if "%PLATFORM%" == "x64" set FB_PROCESSOR_ARCHITECTURE=AMD64
  159. if "%PLATFORM%" == "x86" set FB_VS_ARCH=x86
  160. if "%PLATFORM%" == "x86" set FB_PROCESSOR_ARCHITECTURE=x86
  161. call "%VS_SCRIPT%" -arch=%FB_VS_ARCH%
  162. cd builds\win32
  163. call run_all.bat
  164. call run_tests.bat
  165. - name: Upload zip
  166. uses: actions/upload-artifact@v4
  167. with:
  168. name: firebird-windows-vs-${{ env.VS_VERSION }}-${{ matrix.platform }}-zip
  169. path: builds/install_images/Firebird-*-windows-${{ matrix.platform }}.zip
  170. - name: Upload installer
  171. uses: actions/upload-artifact@v4
  172. with:
  173. name: firebird-windows-vs-${{ env.VS_VERSION }}-${{ matrix.platform }}-installer
  174. path: builds/install_images/*-windows-${{ matrix.platform }}.exe
  175. build-windows-docker:
  176. runs-on: windows-2022
  177. strategy:
  178. fail-fast: false
  179. matrix:
  180. platform: [x64, x86]
  181. steps:
  182. - name: Checkout
  183. uses: actions/checkout@v4
  184. with:
  185. fetch-depth: 10
  186. - name: Adjust snapshot build number
  187. uses: ./.github/actions/adjust-snapshot-buildno
  188. - name: Get Release Notes
  189. uses: ./.github/actions/get-release-notes
  190. - name: Build x86 for client package in x64
  191. id: build-x86
  192. shell: cmd
  193. if: ${{ matrix.platform == 'x64' }}
  194. run: |
  195. mkdir builds\install_images
  196. cd builds\docker\windows
  197. call build.bat
  198. call run.bat C:\fbscripts\build-x86.bat
  199. - name: Build
  200. id: build
  201. shell: cmd
  202. env:
  203. PLATFORM: ${{ matrix.platform }}
  204. run: |
  205. mkdir builds\install_images
  206. cd builds\docker\windows
  207. call build.bat
  208. call run.bat C:\fbscripts\build-%PLATFORM%.bat
  209. - name: Upload zip
  210. uses: actions/upload-artifact@v4
  211. with:
  212. name: firebird-windows-${{ matrix.platform }}-zip
  213. path: builds/install_images/Firebird-*-windows-${{ matrix.platform }}.zip
  214. - name: Upload zip (withDebugSymbols)
  215. uses: actions/upload-artifact@v4
  216. with:
  217. name: firebird-windows-${{ matrix.platform }}-withDebugSymbols-zip
  218. path: builds/install_images/Firebird-*-windows-${{ matrix.platform }}-withDebugSymbols.zip
  219. - name: Upload installer
  220. uses: actions/upload-artifact@v4
  221. with:
  222. name: firebird-windows-${{ matrix.platform }}-installer
  223. path: builds/install_images/*-windows-${{ matrix.platform }}.exe
  224. - name: Upload installer (withDebugSymbols)
  225. uses: actions/upload-artifact@v4
  226. with:
  227. name: firebird-windows-${{ matrix.platform }}-withDebugSymbols-installer
  228. path: builds/install_images/*-windows-${{ matrix.platform }}-withDebugSymbols.exe
  229. - name: Create release
  230. uses: ./.github/actions/create-release
  231. with:
  232. token: ${{ secrets.SNAPSHOT_RELEASE_TOKEN }}
  233. deletePatterns: |
  234. Firebird-*-windows-${{ matrix.platform }}*.exe
  235. Firebird-*-windows-${{ matrix.platform }}*.zip
  236. uploadFiles: |
  237. builds/install_images/Firebird-*-windows-${{ matrix.platform }}*.exe
  238. builds/install_images/Firebird-*-windows-${{ matrix.platform }}*.zip
  239. build-macos:
  240. name: build-macos-${{ matrix.arch }}
  241. runs-on: ${{ (matrix.arch == 'arm64' && 'macos-14') || 'macos-12' }}
  242. strategy:
  243. fail-fast: false
  244. matrix:
  245. arch:
  246. - x64
  247. - arm64
  248. steps:
  249. - name: Checkout
  250. uses: actions/checkout@v4
  251. with:
  252. fetch-depth: 10
  253. submodules: 'true'
  254. - name: Adjust snapshot build number
  255. uses: ./.github/actions/adjust-snapshot-buildno
  256. - name: Prepare - Install tools
  257. run: |
  258. brew install automake autoconf-archive cmake libtool ninja
  259. # libcxx build is not working with python >= 3.12
  260. - name: Do not use preinstalled python >= 3.12
  261. run: |
  262. brew uninstall --ignore-dependencies [email protected]
  263. [ -e /Library/Frameworks/Python.framework ] && \
  264. sudo mv /Library/Frameworks/Python.framework /Library/Frameworks/Python.framework.dont-look-at-this
  265. brew install [email protected]
  266. ln -s "$(brew --prefix [email protected])/bin/python3" "$(brew --prefix [email protected])/bin/python"
  267. - name: Cache - vcpkg
  268. uses: actions/cache@v4
  269. with:
  270. key: ${{ runner.os }}-vcpkg-0
  271. path: |
  272. $HOME/.cache/vcpkg/archives
  273. - name: Build
  274. run: |
  275. export LIBTOOLIZE=glibtoolize
  276. export LIBTOOL=glibtool
  277. export PATH="$(brew --prefix [email protected])/bin:$PATH"
  278. ./autogen.sh --with-builtin-tommath --with-builtin-tomcrypt
  279. make -j4
  280. make tests -j4
  281. make run_tests
  282. make -C gen -B -f make.platform.postfix
  283. make -C gen -B -f Makefile.install
  284. # Rename directory to make sure the build is relocatable.
  285. mv gen gen2
  286. sudo installer -pkg gen2/Release/*.pkg -verbose -target /
  287. export FIREBIRD_LOCK=`pwd`/temp
  288. 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
  289. 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
  290. mv gen2 gen
  291. mkdir gen/artifacts
  292. mv gen/Release/*.pkg gen/artifacts
  293. - name: Upload installer
  294. uses: actions/upload-artifact@v4
  295. with:
  296. name: firebird-macos-${{ matrix.arch }}
  297. path: gen/artifacts
  298. - name: Create release
  299. uses: ./.github/actions/create-release
  300. with:
  301. token: ${{ secrets.SNAPSHOT_RELEASE_TOKEN }}
  302. deletePatterns: Firebird-*-macos-${{ matrix.arch }}*.pkg
  303. uploadFiles: gen/artifacts/Firebird-*-macos-${{ matrix.arch }}*.pkg
  304. build-android-initial:
  305. name: build-android-${{ matrix.arch }}-initial
  306. runs-on: ubuntu-22.04
  307. env:
  308. NDK: /home/runner/Android/Ndk
  309. ARCH: ${{ matrix.arch }}
  310. FB_PREFIX: ${{ (matrix.arch == 'arm32' && 'arme') || (matrix.arch == 'x64' && 'x86_64') || matrix.arch }}
  311. strategy:
  312. fail-fast: false
  313. matrix:
  314. arch:
  315. - arm32
  316. - arm64
  317. - x86
  318. - x64
  319. steps:
  320. - name: Checkout
  321. uses: actions/checkout@v4
  322. with:
  323. fetch-depth: 10
  324. - name: Adjust snapshot build number
  325. uses: ./.github/actions/adjust-snapshot-buildno
  326. - name: Prepare - install Linux tools
  327. run: |
  328. sudo apt-get install libtool-bin libtomcrypt1 libtomcrypt-dev libtommath1 libtommath-dev libicu-dev zlib1g-dev
  329. - name: Prepare - Download and install Android NDK
  330. run: |
  331. mkdir downloads
  332. pushd downloads
  333. curl -OL https://dl.google.com/android/repository/android-ndk-r25b-linux.zip
  334. mkdir -p $NDK
  335. unzip android-ndk-r25b-linux.zip -d $NDK && f=("$NDK"/*) && mv "$NDK"/*/* "$NDK" && rmdir "${f[@]}"
  336. - name: Build
  337. run: |
  338. ./autogen.sh --prefix=/opt/firebird --enable-binreloc --with-cross-build=android.$FB_PREFIX --without-editline
  339. make -j4
  340. make CROSS_OUT=Y tests -j4
  341. builds/install/arch-specific/android/BuildPackage.sh $ARCH
  342. - name: Upload initial build
  343. uses: actions/upload-artifact@v4
  344. with:
  345. name: firebird-android-initial-${{ matrix.arch }}
  346. path: |
  347. gen/Firebird-*-android-initial-${{ matrix.arch }}*.tar.gz
  348. gen/Make.Version
  349. build-android-final:
  350. name: build-android-${{ matrix.arch }}-final
  351. needs: build-android-initial
  352. runs-on: ubuntu-latest
  353. env:
  354. ARCH: ${{ matrix.arch }}
  355. strategy:
  356. fail-fast: false
  357. matrix:
  358. arch:
  359. - arm32
  360. - arm64
  361. - x86
  362. - x64
  363. steps:
  364. - name: Checkout
  365. uses: actions/checkout@v4
  366. with:
  367. fetch-depth: 10
  368. - name: Adjust snapshot build number
  369. uses: ./.github/actions/adjust-snapshot-buildno
  370. - name: Enable KVM
  371. run: |
  372. echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules
  373. sudo udevadm control --reload-rules
  374. sudo udevadm trigger --name-match=kvm
  375. - name: Download initial build
  376. uses: actions/download-artifact@v4
  377. with:
  378. name: firebird-android-initial-${{ matrix.arch }}
  379. path: gen
  380. - name: Cache - AVD
  381. uses: actions/cache@v4
  382. id: avd-cache
  383. with:
  384. path: |
  385. ~/.android/avd/*
  386. ~/.android/adb*
  387. key: avd-v7
  388. - name: Create AVD and generate snapshot for caching
  389. if: steps.avd-cache.outputs.cache-hit != 'true'
  390. uses: reactivecircus/android-emulator-runner@v2
  391. with:
  392. avd-name: firebird-builder
  393. arch: x86_64
  394. api-level: 30
  395. target: google_apis
  396. ndk: 25.1.8937393
  397. emulator-options: -no-window -noaudio -no-boot-anim -camera-back none -port 5554
  398. emulator-boot-timeout: 900
  399. script: |
  400. echo "Generated AVD snapshot for caching."
  401. - name: Create necessary files in Android emulator
  402. uses: reactivecircus/android-emulator-runner@v2
  403. with:
  404. avd-name: firebird-builder
  405. arch: x86_64
  406. api-level: 30
  407. target: google_apis
  408. ndk: 25.1.8937393
  409. emulator-options: -no-snapshot-save -no-window -noaudio -no-boot-anim -camera-back none -port 5554
  410. emulator-boot-timeout: 900
  411. script: |
  412. adb wait-for-device
  413. adb root
  414. NDK=/usr/local/lib/android/sdk/ndk/25.1.8937393 builds/install/arch-specific/android/BuildFinalPackage.sh $ARCH
  415. - name: Upload installer
  416. uses: actions/upload-artifact@v4
  417. with:
  418. name: firebird-android-${{ matrix.arch }}
  419. path: gen/Firebird-*-android-${{ matrix.arch }}.tar.gz
  420. - name: Upload installer (withDebugSymbols)
  421. uses: actions/upload-artifact@v4
  422. with:
  423. name: firebird-android-${{ matrix.arch }}-withDebugSymbols
  424. path: gen/Firebird-*-android-${{ matrix.arch }}-withDebugSymbols.tar.gz
  425. - name: Delete initial build
  426. uses: geekyeggo/delete-artifact@v5
  427. with:
  428. name: firebird-android-initial-${{ matrix.arch }}
  429. - name: Create release
  430. uses: ./.github/actions/create-release
  431. with:
  432. token: ${{ secrets.SNAPSHOT_RELEASE_TOKEN }}
  433. deletePatterns: Firebird-*-android-${{ matrix.arch }}*.tar.gz
  434. uploadFiles: gen/Firebird-*-android-${{ matrix.arch }}*.tar.gz
  435. build-android-aar:
  436. needs: build-android-final
  437. runs-on: ubuntu-22.04
  438. steps:
  439. - name: Checkout
  440. uses: actions/checkout@v4
  441. with:
  442. fetch-depth: 10
  443. - name: Adjust snapshot build number
  444. uses: ./.github/actions/adjust-snapshot-buildno
  445. - name: Download final build (x86)
  446. uses: actions/download-artifact@v4
  447. with:
  448. name: firebird-android-x86
  449. path: android/temp
  450. - name: Download final build (x64)
  451. uses: actions/download-artifact@v4
  452. with:
  453. name: firebird-android-x64
  454. path: android/temp
  455. - name: Download final build (arm32)
  456. uses: actions/download-artifact@v4
  457. with:
  458. name: firebird-android-arm32
  459. path: android/temp
  460. - name: Download final build (arm64)
  461. uses: actions/download-artifact@v4
  462. with:
  463. name: firebird-android-arm64
  464. path: android/temp
  465. - name: Extract final builds
  466. working-directory: android
  467. run: |
  468. mkdir -p embedded/src/main/jniLibs/{x86,x86_64,armeabi-v7a,arm64-v8a}
  469. tar xzvf temp/Firebird-*-android-x86.tar.gz -C embedded/src/main/jniLibs/x86 --strip-components=1
  470. tar xzvf temp/Firebird-*-android-x64.tar.gz -C embedded/src/main/jniLibs/x86_64 --strip-components=1
  471. tar xzvf temp/Firebird-*-android-arm32.tar.gz -C embedded/src/main/jniLibs/armeabi-v7a --strip-components=1
  472. tar xzvf temp/Firebird-*-android-arm64.tar.gz -C embedded/src/main/jniLibs/arm64-v8a --strip-components=1
  473. mkdir -p embedded/src/main/assets/firebird
  474. mv embedded/src/main/jniLibs/x86/{*.conf,*.msg,*.dat,*.res} embedded/src/main/assets/firebird/
  475. find embedded/src/main/jniLibs -type f ! -iname "*.so" -delete
  476. - name: Assemble AAR
  477. working-directory: android
  478. run: |
  479. ./gradlew assembleRelease
  480. FB_VERSION=`cd ../src/misc/ && . writeBuildNum.sh && echo $PRODUCT_VER_STRING-$FIREBIRD_PACKAGE_VERSION`
  481. mv embedded/build/outputs/aar/firebird-embedded-release.aar \
  482. embedded/build/outputs/aar/Firebird-$FB_VERSION-android-embedded.aar
  483. - name: Upload installer
  484. uses: actions/upload-artifact@v4
  485. with:
  486. name: firebird-android-aar
  487. path: android/embedded/build/outputs/aar/Firebird-*-android-embedded.aar
  488. - name: Create release
  489. uses: ./.github/actions/create-release
  490. with:
  491. token: ${{ secrets.SNAPSHOT_RELEASE_TOKEN }}
  492. deletePatterns: Firebird-*-android-embedded.aar
  493. uploadFiles: android/embedded/build/outputs/aar/Firebird-*-android-embedded.aar