Skip to content

Commit 60a8f9f

Browse files
authored
Add GitHub Actions build (#492)
travis-ci.org builds have ceased, so this patch adds a GitHub Actions workflow to build and test the extension, as well as a Dependabot configuration file to keep the referenced actions up to date. I've opted to slightly simplify the workflow compared to the Travis build script. For one, I have not included libmemcached protocol support, as most distros do not supply a libmemcached compiled with server protocol support, and previous discussion suggests its usefulness in the context of this extension may be limited.[1] I've also opted to remove multiversion libmemcached testing in favor of using the system libmemcached, as the referenced other versions seem to be old enough for this to hopefully not be a problem. These could conceivably be reintroduced if needed. --- [1] #418 (comment)
1 parent 9cd4a01 commit 60a8f9f

File tree

4 files changed

+90
-309
lines changed

4 files changed

+90
-309
lines changed

.github/dependabot.yml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: "github-actions"
4+
directory: "/"
5+
schedule:
6+
interval: "daily"

.github/workflows/build-and-test.yml

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
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

.travis.yml

-39
This file was deleted.

0 commit comments

Comments
 (0)