ci.yml 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. name: GitHub Actions CI
  2. on:
  3. push:
  4. branches: [ master ]
  5. pull_request:
  6. branches: [ master ]
  7. jobs:
  8. build:
  9. name: ${{ matrix.config.name }}
  10. runs-on: ${{ matrix.config.os }}
  11. container: ${{ matrix.config.container }}
  12. strategy:
  13. fail-fast: false
  14. matrix:
  15. config:
  16. # - {name: 'ubuntu-14.04 gcc-4.8', os: ubuntu-latest, container: 'ubuntu:14.04', cc: 'gcc-4.8', cxx: 'g++-4.8', tag: '4.8', toolchain: 'ppa:ubuntu-toolchain-r/test'}
  17. # - {name: 'ubuntu-14.04 gcc-4.9', os: ubuntu-latest, container: 'ubuntu:14.04', cc: 'gcc-4.9', cxx: 'g++-4.9', tag: '4.9', toolchain: 'ppa:ubuntu-toolchain-r/test'}
  18. # - {name: 'ubuntu-18.04 gcc-5', os: ubuntu-latest, container: 'ubuntu:18.04', cc: 'gcc-5', cxx: 'g++-5', tag: '5'}
  19. # - {name: 'ubuntu-18.04 gcc-6', os: ubuntu-latest, container: 'ubuntu:18.04', cc: 'gcc-6', cxx: 'g++-6', tag: '6'}
  20. # - {name: 'ubuntu-18.04 gcc-7', os: ubuntu-latest, container: 'ubuntu:18.04', cc: 'gcc-7', cxx: 'g++-7', tag: '7'}
  21. # - {name: 'ubuntu-18.04 gcc-8', os: ubuntu-latest, container: 'ubuntu:18.04', cc: 'gcc-8', cxx: 'g++-8', tag: '8'}
  22. - {name: 'ubuntu-20.04 gcc-9', os: ubuntu-20.04, cc: 'gcc-9', cxx: 'g++-9', tag: '9'}
  23. - {name: 'ubuntu-20.04 gcc-10', os: ubuntu-20.04, cc: 'gcc-10', cxx: 'g++-10', tag: '10'}
  24. - {name: 'ubuntu-20.04 gcc-11', os: ubuntu-20.04, cc: 'gcc-11', cxx: 'g++-11', tag: '11', toolchain: 'ppa:ubuntu-toolchain-r/test'}
  25. - {name: 'ubuntu-22.04 gcc-12', os: ubuntu-22.04, cc: 'gcc-12', cxx: 'g++-12', tag: '12'}
  26. - {name: 'ubuntu-24.04 gcc-13', os: ubuntu-24.04, cc: 'gcc-13', cxx: 'g++-13', tag: '13'}
  27. - {name: 'ubuntu-24.04 gcc-14', os: ubuntu-24.04, cc: 'gcc-14', cxx: 'g++-14', tag: '14'}
  28. - {name: 'ubuntu-25.04 gcc-15', os: ubuntu-24.04, container: 'ubuntu:25.04', cc: 'gcc-15', cxx: 'g++-15', tag: '15', toolchain: 'ppa:ubuntu-toolchain-r/test'}
  29. - {name: 'alpine-3.18 gcc-12', os: ubuntu-latest, container: 'alpine:3.18', cc: 'gcc', cxx: 'g++', tag: '12'}
  30. - {name: 'alpine-3.19 gcc-13', os: ubuntu-latest, container: 'alpine:3.19', cc: 'gcc', cxx: 'g++', tag: '13'}
  31. - {name: 'alpine-3.20 gcc-13', os: ubuntu-latest, container: 'alpine:3.20', cc: 'gcc', cxx: 'g++', tag: '13'}
  32. - {name: 'alpine-3.21 gcc-14', os: ubuntu-latest, container: 'alpine:3.21', cc: 'gcc', cxx: 'g++', tag: '14'}
  33. env:
  34. CC: ${{ matrix.config.cc }}
  35. CXX: ${{ matrix.config.cxx }}
  36. CCVERSION: ${{ matrix.config.tag }}
  37. GHA_CONTAINER: ${{ matrix.config.container }}
  38. GHA_CONFIG_NAME: ${{ matrix.config.name }}
  39. ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true
  40. steps:
  41. - name: if running in a container, update and install sudo, git, and other basics
  42. if: matrix.config.container != ''
  43. run: |
  44. case "${GHA_CONTAINER}" in
  45. ubuntu*)
  46. apt-get -o Acquire::Retries=3 update && DEBIAN_FRONTEND=noninteractive apt-get -o Acquire::Retries=3 -y install tzdata sudo apt-transport-https make apt-file software-properties-common libssl-dev build-essential autotools-dev autoconf automake pkgconf iproute2
  47. sudo apt-add-repository ppa:git-core/ppa
  48. sudo apt-get -o Acquire::Retries=3 update && apt-get -o Acquire::Retries=3 -y install git
  49. ;;
  50. alpine*)
  51. apk add --no-cache make gcc g++ autoconf automake m4 bash git libtool file py3-sphinx util-linux-dev libuuid libevent-dev gperf boost-dev openssl-dev
  52. ;;
  53. *)
  54. ;;
  55. esac
  56. - name: override DNS to fix IP address for hostname in some Docker containers
  57. if: matrix.config.container != ''
  58. run: |
  59. case "${GHA_CONTAINER}" in
  60. ubuntu*)
  61. echo "==="
  62. echo "Before: /etc/hosts"
  63. cat /etc/hosts
  64. echo "==="
  65. echo "Removing localhost name from ::1 entry in /etc/hosts..."
  66. sed 's/^::1\s\s*localhost\s\(.*\)/::1 \1/' /etc/hosts > /tmp/hosts.temp
  67. cp /tmp/hosts.temp /etc/hosts
  68. rm /tmp/hosts.temp
  69. echo "After: /etc/hosts"
  70. cat /etc/hosts
  71. echo "==="
  72. ip addr
  73. echo "==="
  74. echo "'hostname -i' shows '$(hostname -i)'"
  75. echo "'hostname -s' shows '$(hostname -s)'"
  76. echo "'hostname -f' shows '$(hostname -f)'"
  77. ;;
  78. alpine*)
  79. echo "==="
  80. echo "Before: /etc/hosts"
  81. cat /etc/hosts
  82. echo "==="
  83. echo "Removing ::1 entry from /etc/hosts using vi (the only way that works)..."
  84. echo $'0/::1\nddZZ' | vi /etc/hosts > /dev/null
  85. echo "After: /etc/hosts"
  86. cat /etc/hosts
  87. echo "==="
  88. ip addr
  89. echo "==="
  90. echo "'hostname -i' shows '$(hostname -i)'"
  91. echo "'hostname -s' shows '$(hostname -s)'"
  92. echo "'hostname -f' shows '$(hostname -f)'"
  93. ;;
  94. *)
  95. ;;
  96. esac
  97. - name: configure toolchain (optional)
  98. if: matrix.config.toolchain != ''
  99. run: |
  100. sudo apt-add-repository ${{ matrix.config.toolchain }}
  101. sudo apt-get update
  102. sudo apt-get -y install libtool
  103. - uses: actions/checkout@v4
  104. - name: set ownership of git repository in Docker containers
  105. if: matrix.config.container != ''
  106. run: |
  107. chown -R $(id -u):$(id -g) .
  108. - name: tweak multi_client_test.cc for container usage
  109. if: matrix.config.container != ''
  110. run: |
  111. case "${GHA_CONTAINER}" in
  112. ubuntu*)
  113. echo "==="
  114. echo "Before multi_client_test.cc:"
  115. grep push_port tests/libgearman-1.0/multi_client_test.cc
  116. echo "Changing multi_client_test.cc..."
  117. sed -i -e '0,/test->push_port.*libtest/ s/\(test.*push_port(\).*libtest.*\();\)/\1 19298 \2/' tests/libgearman-1.0/multi_client_test.cc
  118. sed -i -e '0,/test->push_port.*libtest/ s/\(test.*push_port(\).*libtest.*\();\)/\1 19300 \2/' tests/libgearman-1.0/multi_client_test.cc
  119. echo "After multi_client_test.cc:"
  120. grep push_port tests/libgearman-1.0/multi_client_test.cc
  121. echo "==="
  122. ;;
  123. *)
  124. ;;
  125. esac
  126. - name: install dependencies
  127. run: |
  128. case "${GHA_CONFIG_NAME}" in
  129. ubuntu*)
  130. sudo apt-get update && sudo apt-get -o Acquire::Retries=3 install -y libboost-all-dev gperf libevent-dev uuid-dev sphinx-doc sphinx-common libhiredis-dev ${{ matrix.config.cc }} ${{ matrix.config.cxx }}
  131. ;;
  132. *)
  133. ;;
  134. esac
  135. - name: bootstrap
  136. run: |
  137. if [ -n "$GHA_CONTAINER" ]; then
  138. echo "container: $GHA_CONTAINER"
  139. fi
  140. if [ -f "/etc/lsb-release" ]; then
  141. cat /etc/lsb-release
  142. fi
  143. ./bootstrap.sh -a
  144. - name: configure
  145. run: |
  146. if [[ "${CC}" == gcc* ]] && [ "${CCVERSION}" -ge 9 ]; then
  147. CXXFLAGS="-Wp,-D_GLIBCXX_ASSERTIONS"
  148. export CXXFLAGS
  149. echo "CXXFLAGS: $CXXFLAGS"
  150. fi
  151. ./configure --enable-ssl
  152. shell: bash
  153. - name: make
  154. run: |
  155. if [[ "${CC}" == gcc* ]] && [ "${CCVERSION}" -ge 9 ]; then
  156. CXXFLAGS="-Wp,-D_GLIBCXX_ASSERTIONS"
  157. export CXXFLAGS
  158. echo "CXXFLAGS: $CXXFLAGS"
  159. fi
  160. ${CC} --version && make
  161. shell: bash
  162. - name: make test
  163. run: ${CC} --version && make test
  164. - name: check test-suite.log
  165. if: success() || failure()
  166. run: |
  167. if [ -f "./test-suite.log" ]; then
  168. cat ./test-suite.log
  169. else
  170. echo "No test-suite.log file found."
  171. fi