build.yml 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. name: build
  2. on:
  3. push:
  4. pull_request:
  5. schedule:
  6. - cron: '0 0 1 * *'
  7. jobs:
  8. build-linux-ubuntu:
  9. runs-on: ubuntu-latest
  10. steps:
  11. - name: install dependencies
  12. run: |
  13. sudo apt-get update
  14. pip install cython
  15. - name: prepare environment
  16. run: |
  17. echo "target_triplet=`gcc -dumpmachine`" >> $GITHUB_ENV
  18. - uses: actions/checkout@v4
  19. with:
  20. fetch-depth: 0
  21. - name: autogen
  22. run: |
  23. export PYTHON=python3
  24. export LDFLAGS="-Wl,-rpath=/usr/local/lib"
  25. ./autogen.sh --enable-debug
  26. - name: make
  27. run: make
  28. - name: make check
  29. run: make check
  30. - name: make install
  31. run: sudo make install
  32. - name: prepare artifact
  33. run: |
  34. mkdir -p dest
  35. DESTDIR=`pwd`/dest make install
  36. tar -C dest -cf libplist.tar usr
  37. - name: publish artifact
  38. uses: actions/upload-artifact@v4
  39. with:
  40. name: libplist-latest_${{env.target_triplet}}
  41. path: libplist.tar
  42. build-macOS:
  43. runs-on: macOS-latest
  44. steps:
  45. - name: install dependencies
  46. run: |
  47. if test -x "`which port`"; then
  48. sudo port install libtool autoconf automake
  49. else
  50. brew install libtool autoconf automake
  51. fi
  52. pip3 install --break-system-packages cython
  53. shell: bash
  54. - uses: actions/checkout@v4
  55. with:
  56. fetch-depth: 0
  57. - name: autogen
  58. run: |
  59. SDKDIR=`xcrun --sdk macosx --show-sdk-path`
  60. TESTARCHS="arm64 x86_64"
  61. USEARCHS=
  62. for ARCH in $TESTARCHS; do
  63. if echo "int main(int argc, char **argv) { return 0; }" |clang -arch $ARCH -o /dev/null -isysroot $SDKDIR -x c - 2>/dev/null; then
  64. USEARCHS="$USEARCHS -arch $ARCH"
  65. fi
  66. done
  67. export CFLAGS="$USEARCHS -isysroot $SDKDIR"
  68. echo "Using CFLAGS: $CFLAGS"
  69. PYTHON3_BIN=`xcrun -f python3`
  70. if test -x $PYTHON3_BIN; then
  71. export PYTHON=$PYTHON3_BIN
  72. PYTHON_VER=`$PYTHON3_BIN -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('VERSION'))"`
  73. PYTHON_EXEC_PREFIX=`$PYTHON3_BIN -c "import distutils.sysconfig; print(distutils.sysconfig.get_config_var('exec_prefix'))"`
  74. PYTHON_LIBS_PATH=$PYTHON_EXEC_PREFIX/lib
  75. PYTHON_FRAMEWORK_PATH=$PYTHON_EXEC_PREFIX/Python3
  76. export PYTHON_CPPFLAGS="-I$PYTHON_EXEC_PREFIX/Headers"
  77. export PYTHON_LIBS="-L$PYTHON_LIBS_PATH -lpython$PYTHON_VER"
  78. export PYTHON_EXTRA_LDFLAGS="-Wl,-stack_size,1000000 -framework CoreFoundation $PYTHON_FRAMEWORK_PATH"
  79. fi
  80. ./autogen.sh --enable-debug
  81. - name: make
  82. run: make
  83. - name: make check
  84. run: make check
  85. - name: make install
  86. run: sudo make install
  87. - name: prepare artifact
  88. run: |
  89. mkdir -p dest
  90. DESTDIR=`pwd`/dest make install
  91. tar -C dest -cf libplist.tar usr
  92. - name: publish artifact
  93. uses: actions/upload-artifact@v4
  94. with:
  95. name: libplist-latest_macOS
  96. path: libplist.tar
  97. build-windows:
  98. runs-on: windows-2019
  99. defaults:
  100. run:
  101. shell: msys2 {0}
  102. strategy:
  103. fail-fast: false
  104. matrix:
  105. include: [
  106. { msystem: MINGW64, arch: x86_64 },
  107. { msystem: MINGW32, arch: i686 }
  108. ]
  109. steps:
  110. - uses: msys2/setup-msys2@v2
  111. with:
  112. msystem: ${{ matrix.msystem }}
  113. release: false
  114. update: false
  115. install: >-
  116. base-devel
  117. git
  118. mingw-w64-${{ matrix.arch }}-gcc
  119. make
  120. libtool
  121. autoconf
  122. automake-wrapper
  123. cython
  124. - name: prepare environment
  125. run: |
  126. dest=`echo ${{ matrix.msystem }} |tr [:upper:] [:lower:]`
  127. echo "dest=$dest" >> $GITHUB_ENV
  128. echo "target_triplet=`gcc -dumpmachine`" >> $GITHUB_ENV
  129. git config --global core.autocrlf false
  130. - uses: actions/checkout@v4
  131. with:
  132. fetch-depth: 0
  133. - name: autogen
  134. run: ./autogen.sh CC=gcc CXX=g++ --enable-debug
  135. - name: make
  136. run: make
  137. - name: make check
  138. run: make check
  139. - name: print test logs
  140. run: |
  141. for I in test/*.trs; do
  142. RES=`grep ":test-result" $I |cut -d ":" -f 3`
  143. if test $RES != PASS; then
  144. TESTNAME=`basename $I .trs`
  145. echo $TESTNAME:
  146. cat test/$TESTNAME.log
  147. echo
  148. fi
  149. done
  150. shell: bash
  151. - name: make install
  152. run: make install
  153. - name: prepare artifact
  154. run: |
  155. mkdir -p dest
  156. DESTDIR=`pwd`/dest make install
  157. tar -C dest -cf libplist.tar ${{ env.dest }}
  158. - name: publish artifact
  159. uses: actions/upload-artifact@v4
  160. with:
  161. name: libplist-latest_${{ matrix.arch }}-${{ env.dest }}
  162. path: libplist.tar