memcached.yml 3.4 KB

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