memcached.yml 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. name: memcached Tests
  2. # START OF COMMON SECTION
  3. on:
  4. push:
  5. branches: [ 'master', 'main', 'release/**' ]
  6. pull_request:
  7. branches: [ '*' ]
  8. concurrency:
  9. group: ${{ github.workflow }}-${{ github.ref }}
  10. cancel-in-progress: true
  11. # END OF COMMON SECTION
  12. jobs:
  13. build_wolfssl:
  14. name: Build wolfSSL
  15. # Just to keep it the same as the testing target
  16. runs-on: ubuntu-latest
  17. steps:
  18. - name: Build wolfSSL
  19. uses: wolfSSL/actions-build-autotools-project@v1
  20. with:
  21. path: wolfssl
  22. configure: --enable-memcached
  23. install: true
  24. - name: Bundle Docker entry point
  25. run: cp wolfssl/.github/workflows/memcached.sh build-dir/bin
  26. - name: Upload built lib
  27. uses: actions/upload-artifact@v4
  28. with:
  29. name: wolf-install-memcached
  30. path: build-dir
  31. retention-days: 5
  32. memcached_check:
  33. strategy:
  34. fail-fast: false
  35. matrix:
  36. # List of releases to test
  37. include:
  38. - ref: 1.6.22
  39. name: ${{ matrix.ref }}
  40. runs-on: ubuntu-latest
  41. needs: build_wolfssl
  42. steps:
  43. - name: Download lib
  44. uses: actions/download-artifact@v4
  45. with:
  46. name: wolf-install-memcached
  47. path: build-dir
  48. - name: Checkout OSP
  49. uses: actions/checkout@v4
  50. with:
  51. repository: wolfssl/osp
  52. path: osp
  53. - name: Install dependencies
  54. run: |
  55. export DEBIAN_FRONTEND=noninteractive
  56. sudo apt-get update
  57. sudo apt-get install -y libevent-dev libevent-2.1-7 automake pkg-config make libio-socket-ssl-perl
  58. - name: Checkout memcached
  59. uses: actions/checkout@v4
  60. with:
  61. repository: memcached/memcached
  62. ref: 1.6.22
  63. path: memcached
  64. - name: Configure and build memcached
  65. run: |
  66. cd $GITHUB_WORKSPACE/memcached/
  67. patch -p1 < $GITHUB_WORKSPACE/osp/memcached/memcached_1.6.22.patch
  68. ./autogen.sh
  69. export LD_LIBRARY_PATH=$GITHUB_WORKSPACE/build-dir/lib:$LD_LIBRARY_PATH
  70. PKG_CONFIG_PATH=$GITHUB_WORKSPACE/build-dir/lib/pkgconfig ./configure --enable-wolfssl
  71. make -j$(nproc)
  72. - name: Confirm memcached built with wolfSSL
  73. working-directory: ./memcached
  74. run: |
  75. export LD_LIBRARY_PATH=$GITHUB_WORKSPACE/build-dir/lib:$LD_LIBRARY_PATH
  76. ldd memcached | grep wolfssl
  77. - name: Run memcached tests
  78. working-directory: ./memcached
  79. run: |
  80. # Retry up to three times
  81. # Using docker because interrupting the tests doesn't close running
  82. # background servers. They can become daemonized and then all re-runs
  83. # will always fail.
  84. chmod +x $GITHUB_WORKSPACE/build-dir/bin/memcached.sh
  85. for i in {1..3}; do
  86. echo "-------- RUNNING TESTS --------"
  87. MEMCACHED_RES=0 # Not set when command succeeds
  88. # Tests should usually take less than 4 minutes. If already taking
  89. # 5 minutes then they are probably stuck. Interrupt and re-run.
  90. time timeout -s SIGKILL 5m docker run -v /:/host \
  91. -v $GITHUB_WORKSPACE/build-dir/bin/memcached.sh:/memcached.sh \
  92. -e GITHUB_WORKSPACE=$GITHUB_WORKSPACE \
  93. -e HOST_ROOT=/host \
  94. -e LD_LIBRARY_PATH=$GITHUB_WORKSPACE/build-dir/lib:$LD_LIBRARY_PATH \
  95. alpine:latest /memcached.sh || MEMCACHED_RES=$?
  96. if [ "$MEMCACHED_RES" -eq "0" ]; then
  97. break
  98. fi
  99. done
  100. echo "test ran $i times"
  101. if [ "$MEMCACHED_RES" -ne "0" ]; then
  102. exit $MEMCACHED_RES
  103. fi