memcached.yml 3.9 KB

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