|
| 1 | +on: [push, pull_request] |
| 2 | + |
| 3 | +jobs: |
| 4 | + build: |
| 5 | + runs-on: ubuntu-latest |
| 6 | + continue-on-error: ${{ matrix.experimental }} |
| 7 | + strategy: |
| 8 | + fail-fast: false |
| 9 | + matrix: |
| 10 | + php: ['7.0', '7.1', '7.2', '7.3', '7.4', '8.0'] |
| 11 | + experimental: [false] |
| 12 | + include: |
| 13 | + - php: '8.1' |
| 14 | + experimental: true |
| 15 | + steps: |
| 16 | + - name: Checkout |
| 17 | + uses: actions/checkout@v2 |
| 18 | + with: |
| 19 | + submodules: true |
| 20 | + - name: Install PHP ${{ matrix.php }} |
| 21 | + uses: shivammathur/setup-php@v2 |
| 22 | + with: |
| 23 | + php-version: ${{ matrix.php }} |
| 24 | + extensions: none, json, igbinary, msgpack |
| 25 | + - name: Install dependencies |
| 26 | + run: | |
| 27 | + sudo apt-get update |
| 28 | + sudo apt-get install libmemcached-dev memcached libsasl2-dev sasl2-bin zlib1g-dev |
| 29 | + - name: Start memcached daemons |
| 30 | + run: | |
| 31 | + export SASL_CONF_PATH="/tmp/sasl2" |
| 32 | + mkdir "${SASL_CONF_PATH}" |
| 33 | + export MEMCACHED_SASL_PWDB="${SASL_CONF_PATH}/sasldb2" |
| 34 | +
|
| 35 | + # Create configuration |
| 36 | + cat<<EOF > "${SASL_CONF_PATH}/memcached.conf" |
| 37 | + mech_list: PLAIN |
| 38 | + plainlog_level: 5 |
| 39 | + sasldb_path: ${MEMCACHED_SASL_PWDB} |
| 40 | + EOF |
| 41 | +
|
| 42 | + echo "test" | /usr/sbin/saslpasswd2 -c memcached -a memcached -f "${MEMCACHED_SASL_PWDB}" |
| 43 | +
|
| 44 | + # Run normal memcached |
| 45 | + memcached -d -p 11211 |
| 46 | +
|
| 47 | + # Run memcached on port 11212 with SASL support |
| 48 | + memcached -S -d -p 11212 |
| 49 | + - name: Build extension |
| 50 | + run: | |
| 51 | + phpize |
| 52 | + ./configure \ |
| 53 | + --enable-memcached-protocol=no \ |
| 54 | + --enable-memcached-sasl \ |
| 55 | + --enable-memcached-json \ |
| 56 | + --enable-memcached-msgpack \ |
| 57 | + --enable-memcached-igbinary |
| 58 | + make |
| 59 | + sudo make install |
| 60 | + - name: Create test configuration |
| 61 | + run: | |
| 62 | + cat<<EOF > tests/config.inc.local |
| 63 | + <?php |
| 64 | + define ("MEMC_SERVER_HOST", "127.0.0.1"); |
| 65 | + define ("MEMC_SERVER_PORT", 11211); |
| 66 | +
|
| 67 | + define ("MEMC_SASL_SERVER_HOST", "127.0.0.1"); |
| 68 | + define ("MEMC_SASL_SERVER_PORT", 11212); |
| 69 | + |
| 70 | + define ('MEMC_SASL_USER', 'memcached'); |
| 71 | + define ('MEMC_SASL_PASS', 'test'); |
| 72 | + EOF |
| 73 | + - name: Run tests |
| 74 | + run: | |
| 75 | + export NO_INTERACTION=1 |
| 76 | + export REPORT_EXIT_STATUS=1 |
| 77 | + export TEST_PHP_EXECUTABLE=$(which php) |
| 78 | +
|
| 79 | + # We have one xfail test, we run it separately |
| 80 | + php run-tests.php --show-diff -d extension=modules/memcached.so ./tests/expire.phpt |
| 81 | + rm ./tests/expire.phpt |
| 82 | +
|
| 83 | + # Run normal tests |
| 84 | + php run-tests.php --show-diff -d extension=modules/memcached.so ./tests/*.phpt |
0 commit comments