main.yml 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370
  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
  14. - name: Build
  15. run: |
  16. CC=clang CXX=clang++ ./autogen.sh --enable-binreloc --prefix=/opt/firebird
  17. make -j4
  18. make dist
  19. tar xzvf gen/Firebird-[0-9]*.tar.gz
  20. (cd Firebird-[0-9]*; sudo ./install.sh -silent)
  21. - name: Upload installer
  22. uses: actions/upload-artifact@main
  23. with:
  24. name: firebird-ubuntu-20.04-clang-x64
  25. path: gen/Firebird-[0-9]*.tar.gz
  26. build-linux-chroot:
  27. name: build-linux-chroot-${{ matrix.arch }}
  28. runs-on: ubuntu-22.04
  29. env:
  30. ARCH_SUFFIX: ${{ (matrix.arch == 'x64' && 'amd64' || (matrix.arch == 'x86' && 'i686' || '')) }}
  31. ARCH_BITS: ${{ (matrix.arch == 'x64' && '64' || (matrix.arch == 'x86' && '32' || '')) }}
  32. strategy:
  33. fail-fast: false
  34. matrix:
  35. arch:
  36. - x64
  37. - x86
  38. steps:
  39. - name: Checkout
  40. uses: actions/checkout@v3
  41. with:
  42. fetch-depth: 10
  43. - name: Download and extract chroot environment
  44. run: |
  45. wget --no-verbose -O - https://github.com/FirebirdSQL/snapshots/releases/download/tools/chroot-${ARCH_BITS}-gcc.6.4.tar.xz | sudo tar -xJ
  46. - name: Build
  47. run: |
  48. sudo mkdir -p ${ARCH_BITS}-gcc.6.4/firebird
  49. sudo ./start_chroot.sh <<"EOF"
  50. cd /firebird
  51. ./autogen.sh --prefix=/opt/firebird --enable-binreloc --with-builtin-tomcrypt --with-termlib=:libncurses.a
  52. make -j4
  53. make dist
  54. EOF
  55. - name: Upload installer
  56. uses: actions/upload-artifact@main
  57. with:
  58. name: firebird-linux-${{ matrix.arch }}
  59. path: gen/Firebird-[0-9]*.${{ env.ARCH_SUFFIX }}.tar.gz
  60. - name: Snapshot - prepare
  61. id: snapshot_prepare
  62. if: |
  63. github.repository == 'FirebirdSQL/firebird' &&
  64. github.event.head_commit.message == 'increment build number' &&
  65. github.ref_name == 'v4.0-release'
  66. run: |
  67. echo "snapshot_name=v4.0" >> $GITHUB_OUTPUT
  68. - name: Snapshot - delete old assets
  69. uses: mknejp/delete-release-assets@v1
  70. if: steps.snapshot_prepare.outputs.snapshot_name
  71. with:
  72. repository: FirebirdSQL/snapshots
  73. token: ${{ secrets.SNAPSHOT_RELEASE_TOKEN }}
  74. tag: snapshot-${{ steps.snapshot_prepare.outputs.snapshot_name }}
  75. fail-if-no-release: false
  76. fail-if-no-assets: false
  77. assets: |
  78. Firebird-*.${{ env.ARCH_SUFFIX }}.tar.gz
  79. - name: Snapshot - release
  80. id: snapshot_release_try1
  81. uses: softprops/action-gh-release@v1
  82. if: steps.snapshot_prepare.outputs.snapshot_name
  83. continue-on-error: true
  84. with:
  85. repository: FirebirdSQL/snapshots
  86. name: Latest snapshots for ${{ steps.snapshot_prepare.outputs.snapshot_name }}
  87. tag_name: snapshot-${{ steps.snapshot_prepare.outputs.snapshot_name }}
  88. prerelease: true
  89. token: ${{ secrets.SNAPSHOT_RELEASE_TOKEN }}
  90. files: |
  91. gen/Firebird-*.${{ env.ARCH_SUFFIX }}.tar.gz
  92. - name: Snapshot - release (retry)
  93. uses: softprops/action-gh-release@v1
  94. if: |
  95. steps.snapshot_prepare.outputs.snapshot_name &&
  96. steps.snapshot_release_try1.outcome == 'failure'
  97. with:
  98. repository: FirebirdSQL/snapshots
  99. name: Latest snapshots for ${{ steps.snapshot_prepare.outputs.snapshot_name }}
  100. tag_name: snapshot-${{ steps.snapshot_prepare.outputs.snapshot_name }}
  101. prerelease: true
  102. token: ${{ secrets.SNAPSHOT_RELEASE_TOKEN }}
  103. files: |
  104. gen/Firebird-*.${{ env.ARCH_SUFFIX }}.tar.gz
  105. build-alpine-x64:
  106. runs-on: ubuntu-20.04
  107. container: alpine:3.14
  108. steps:
  109. - name: Checkout
  110. uses: actions/checkout@v3
  111. with:
  112. fetch-depth: 10
  113. - name: Prepare
  114. run: apk update && apk --no-cache --update add build-base libtool git autoconf automake zlib-dev icu-dev ncurses-dev libedit-dev linux-headers tar
  115. - name: Build
  116. run: |
  117. ./autogen.sh --enable-binreloc-threads --with-builtin-tommath --with-builtin-tomcrypt --prefix=/opt/firebird
  118. make -j4
  119. make dist
  120. tar xzvf gen/Firebird-[0-9]*.tar.gz
  121. - name: Upload installer
  122. uses: actions/upload-artifact@main
  123. with:
  124. name: firebird-alpine-x64
  125. path: gen/Firebird-[0-9]*.tar.gz
  126. build-windows:
  127. runs-on: ${{ matrix.os }}
  128. env:
  129. VS_VERSION: ${{ (matrix.os == 'windows-2019' && '2019' || (matrix.os == 'windows-2022' && '2022' || '')) }}
  130. strategy:
  131. fail-fast: false
  132. matrix:
  133. os:
  134. - windows-2022
  135. - windows-2019
  136. platform: [x64, x86]
  137. steps:
  138. - name: Checkout
  139. uses: actions/checkout@v3
  140. with:
  141. fetch-depth: 10
  142. - name: Prepare
  143. shell: cmd
  144. run: |
  145. for /r %%i in (*.bat) do unix2dos "%%i"
  146. - name: Build
  147. shell: cmd
  148. env:
  149. PLATFORM: ${{ matrix.platform }}
  150. 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' }}
  151. run: |
  152. if "%PLATFORM%" == "x64" set FB_VS_ARCH=amd64
  153. if "%PLATFORM%" == "x64" set FB_PROCESSOR_ARCHITECTURE=AMD64
  154. if "%PLATFORM%" == "x64" set FB_ARTIFACTS_DIR=output_x64
  155. if "%PLATFORM%" == "x86" set FB_VS_ARCH=x86
  156. if "%PLATFORM%" == "x86" set FB_PROCESSOR_ARCHITECTURE=x86
  157. if "%PLATFORM%" == "x86" set FB_ARTIFACTS_DIR=output_win32
  158. echo FB_ARTIFACTS_DIR=%FB_ARTIFACTS_DIR% >> %GITHUB_ENV%
  159. call "%VS_SCRIPT%" -arch=%FB_VS_ARCH%
  160. cd builds\win32
  161. call run_all.bat JUSTBUILD
  162. - name: Upload zip
  163. uses: actions/upload-artifact@main
  164. with:
  165. name: firebird-windows-${{ matrix.platform }}-vs-${{ env.VS_VERSION }}
  166. path: ${{ env.FB_ARTIFACTS_DIR }}
  167. build-macos:
  168. runs-on: macos-latest
  169. steps:
  170. - name: Checkout
  171. uses: actions/checkout@v3
  172. with:
  173. fetch-depth: 10
  174. - name: Prepare - Install tools
  175. run: |
  176. brew install automake libtool ninja
  177. - name: Cache - libc++ install
  178. id: cache-libcxx-install-macos
  179. uses: actions/cache@v3
  180. with:
  181. key: ${{ runner.os }}-libcxx-install-13.0.1
  182. path: |
  183. extern/libcxx-macos-install
  184. - name: Download libc++ sources
  185. if: steps.cache-libcxx-install-macos.outputs.cache-hit != 'true'
  186. run: |
  187. mkdir extern/libcxx-macos
  188. pushd extern/libcxx-macos
  189. curl -OL https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0.1/llvm-project-13.0.1.src.tar.xz
  190. tar xJf llvm-project-13.0.1.src.tar.xz
  191. popd
  192. - name: Build libc++
  193. if: steps.cache-libcxx-install-macos.outputs.cache-hit != 'true'
  194. run: |
  195. LIBCXX_BUILD_PATH=`pwd`/extern/libcxx-macos-build
  196. LIBCXX_INSTALL_PATH=`pwd`/extern/libcxx-macos-install
  197. mkdir $LIBCXX_BUILD_PATH
  198. pushd extern/libcxx-macos/llvm-project-13.0.1.src
  199. export MACOSX_DEPLOYMENT_TARGET=10.9
  200. cmake -G Ninja -S llvm -B $LIBCXX_BUILD_PATH \
  201. -DLLVM_ENABLE_PROJECTS="libcxx;libcxxabi" \
  202. -DCMAKE_INSTALL_PREFIX=$LIBCXX_INSTALL_PATH \
  203. -DCMAKE_BUILD_TYPE=Release \
  204. -DLIBCXX_ENABLE_SHARED=false \
  205. -DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=true
  206. ninja -C $LIBCXX_BUILD_PATH cxx cxxabi
  207. ninja -C $LIBCXX_BUILD_PATH install-cxx install-cxxabi
  208. popd
  209. - name: Cache - libicu install
  210. id: cache-libicu-install-macos
  211. uses: actions/cache@v3
  212. with:
  213. key: ${{ runner.os }}-libicu-install-63.2
  214. path: |
  215. extern/libicu-macos-install
  216. - name: Download and patch libicu sources
  217. if: steps.cache-libicu-install-macos.outputs.cache-hit != 'true'
  218. run: |
  219. mkdir extern/libicu-macos
  220. pushd extern/libicu-macos
  221. curl -OL https://github.com/unicode-org/icu/releases/download/release-63-2/icu4c-63_2-src.tgz
  222. curl -OL https://github.com/unicode-org/icu/commit/24aeb9a5a5874f4ce5db912e30670ac3ae236971.patch
  223. tar xzf icu4c-63_2-src.tgz
  224. cd icu/source
  225. patch -p3 < ../../24aeb9a5a5874f4ce5db912e30670ac3ae236971.patch
  226. popd
  227. - name: Build libicu
  228. if: steps.cache-libicu-install-macos.outputs.cache-hit != 'true'
  229. run: |
  230. export LIBTOOLIZE=glibtoolize
  231. export LIBTOOL=glibtool
  232. LIBICU_INSTALL_PATH=`pwd`/extern/libicu-macos-install
  233. pushd extern/libicu-macos/icu/source
  234. ./runConfigureICU MacOSX --prefix=$LIBICU_INSTALL_PATH
  235. make -j4
  236. make install
  237. install_name_tool -id @rpath/lib/libicuuc.dylib $LIBICU_INSTALL_PATH/lib/libicuuc.dylib
  238. install_name_tool -id @rpath/lib/libicui18n.dylib $LIBICU_INSTALL_PATH/lib/libicui18n.dylib
  239. install_name_tool -id @rpath/lib/libicudata.dylib $LIBICU_INSTALL_PATH/lib/libicudata.dylib
  240. install_name_tool -change libicudata.63.dylib @loader_path/libicudata.63.dylib $LIBICU_INSTALL_PATH/lib/libicuuc.63.dylib
  241. install_name_tool -change libicudata.63.dylib @loader_path/libicudata.63.dylib $LIBICU_INSTALL_PATH/lib/libicui18n.63.dylib
  242. install_name_tool -change libicuuc.63.dylib @loader_path/libicuuc.63.dylib $LIBICU_INSTALL_PATH/lib/libicui18n.63.dylib
  243. popd
  244. - name: Build
  245. run: |
  246. export LIBTOOLIZE=glibtoolize
  247. export LIBTOOL=glibtool
  248. LIBCXX_INSTALL_PATH=`pwd`/extern/libcxx-macos-install
  249. LIBICU_INSTALL_PATH=`pwd`/extern/libicu-macos-install
  250. mkdir -p gen/Release/firebird/lib
  251. cp -R $LIBICU_INSTALL_PATH/lib/libicu{data,i18n,uc}.*dylib gen/Release/firebird/lib/
  252. export C_INCLUDE_PATH="$LIBICU_INSTALL_PATH/include:`xcrun --show-sdk-path`/usr/include"
  253. export CPLUS_INCLUDE_PATH="$LIBCXX_INSTALL_PATH/include/c++/v1:$LIBICU_INSTALL_PATH/include:`xcrun --show-sdk-path`/usr/include"
  254. export LIBRARY_PATH="$LIBCXX_INSTALL_PATH/lib:$LIBICU_INSTALL_PATH/lib:$LIBRARY_PATH"
  255. ./autogen.sh --with-builtin-tommath --with-builtin-tomcrypt
  256. make -j4
  257. (cd gen; make -B -f make.platform.postfix ICU_LOC="$LIBICU_INSTALL_PATH/lib/")
  258. (cd gen; make -B -f Makefile.install)
  259. # Rename directory to make sure the build is relocatable.
  260. mv gen gen2
  261. sudo installer -pkg gen2/Release/*.pkg -verbose -target /
  262. export FIREBIRD_LOCK=`pwd`/temp
  263. 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
  264. 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
  265. mv gen2 gen
  266. mkdir gen/artifacts
  267. mv gen/Release/*.pkg gen/artifacts
  268. - name: Upload installer
  269. uses: actions/upload-artifact@main
  270. with:
  271. name: firebird-macos
  272. path: gen/artifacts
  273. - name: Snapshot - prepare
  274. id: snapshot_prepare
  275. if: |
  276. github.repository == 'FirebirdSQL/firebird' &&
  277. github.event.head_commit.message == 'increment build number' &&
  278. github.ref_name == 'v4.0-release'
  279. run: |
  280. echo "snapshot_name=v4.0" >> $GITHUB_OUTPUT
  281. - name: Snapshot - delete old assets
  282. uses: mknejp/delete-release-assets@v1
  283. if: steps.snapshot_prepare.outputs.snapshot_name
  284. with:
  285. repository: FirebirdSQL/snapshots
  286. token: ${{ secrets.SNAPSHOT_RELEASE_TOKEN }}
  287. tag: snapshot-${{ steps.snapshot_prepare.outputs.snapshot_name }}
  288. fail-if-no-release: false
  289. fail-if-no-assets: false
  290. assets: |
  291. Firebird-[0-9]*-x86_64.pkg
  292. - name: Snapshot - release
  293. id: snapshot_release_try1
  294. uses: softprops/action-gh-release@v1
  295. if: steps.snapshot_prepare.outputs.snapshot_name
  296. continue-on-error: true
  297. with:
  298. repository: FirebirdSQL/snapshots
  299. name: Latest snapshots for ${{ steps.snapshot_prepare.outputs.snapshot_name }}
  300. tag_name: snapshot-${{ steps.snapshot_prepare.outputs.snapshot_name }}
  301. prerelease: true
  302. token: ${{ secrets.SNAPSHOT_RELEASE_TOKEN }}
  303. files: |
  304. gen/artifacts/Firebird-[0-9]*-x86_64.pkg
  305. - name: Snapshot - release (retry)
  306. uses: softprops/action-gh-release@v1
  307. if: |
  308. steps.snapshot_prepare.outputs.snapshot_name &&
  309. steps.snapshot_release_try1.outcome == 'failure'
  310. with:
  311. repository: FirebirdSQL/snapshots
  312. name: Latest snapshots for ${{ steps.snapshot_prepare.outputs.snapshot_name }}
  313. tag_name: snapshot-${{ steps.snapshot_prepare.outputs.snapshot_name }}
  314. prerelease: true
  315. token: ${{ secrets.SNAPSHOT_RELEASE_TOKEN }}
  316. files: |
  317. gen/artifacts/Firebird-[0-9]*-x86_64.pkg