memcached.yml 3.8 KB

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