Skip to content

Commit 1eb5efd

Browse files
authored
Use ubuntu-latest for tests (#1033)
* Use ubuntu-latest for tests Avoids brownouts on deprecated ubuntu-20 and matches everything else * be strict in script * Fix CI labels * Manually patch memcached 1.5 so it compiles on Ubuntu 24
1 parent 8015e0a commit 1eb5efd

3 files changed

Lines changed: 58 additions & 2 deletions

File tree

.github/workflows/tests.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on: [push, pull_request]
44

55
jobs:
66
test:
7-
runs-on: ubuntu-20.04
7+
runs-on: ubuntu-latest
88

99
strategy:
1010
fail-fast: false
@@ -22,6 +22,7 @@ jobs:
2222
- jruby-9.4
2323
memcached-version: ['1.5.22', '1.6.34']
2424

25+
name: "Ruby ${{ matrix.ruby-version }} / Memcached ${{ matrix.memcached-version }}"
2526
steps:
2627
- uses: actions/checkout@v4
2728
- name: Install Memcached ${{ matrix.memcached-version }}

scripts/install_memcached.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
#!/bin/bash
22

3-
version=$MEMCACHED_VERSION
3+
set -euo pipefail
44

5+
version=$MEMCACHED_VERSION
56

67
sudo apt-get -y remove memcached
78
sudo apt-get install libevent-dev libsasl2-dev sasl2-bin
@@ -12,6 +13,12 @@ echo Installing Memcached version ${version}
1213
wget https://memcached.org/files/memcached-${version}.tar.gz
1314
tar -zxvf memcached-${version}.tar.gz
1415
cd memcached-${version}
16+
17+
# Manual patch so 1.5 will compile
18+
if [[ -f "../memcached_${version}.patch" ]]; then
19+
patch -p1 < "../memcached_${version}.patch"
20+
fi
21+
1522
./configure --enable-sasl --enable-tls
1623
make
1724
sudo mv memcached /usr/local/bin/

scripts/memcached_1.5.22.patch

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
diff --git a/hash.c b/hash.c
2+
index a0c3036..b5ff28a 100644
3+
--- a/hash.c
4+
+++ b/hash.c
5+
@@ -4,6 +4,8 @@
6+
#include "jenkins_hash.h"
7+
#include "murmur3_hash.h"
8+
9+
+hash_func hash;
10+
+
11+
int hash_init(enum hashfunc_type type) {
12+
switch(type) {
13+
case JENKINS_HASH:
14+
diff --git a/hash.h b/hash.h
15+
index 059d1e2..3b2a984 100644
16+
--- a/hash.h
17+
+++ b/hash.h
18+
@@ -2,7 +2,7 @@
19+
#define HASH_H
20+
21+
typedef uint32_t (*hash_func)(const void *key, size_t length);
22+
-hash_func hash;
23+
+extern hash_func hash;
24+
25+
enum hashfunc_type {
26+
JENKINS_HASH=0, MURMUR3_HASH
27+
diff --git a/memcached.c b/memcached.c
28+
index 3010236..0916f94 100644
29+
--- a/memcached.c
30+
+++ b/memcached.c
31+
@@ -9528,7 +9528,7 @@ int main (int argc, char **argv) {
32+
/* daemonize if requested */
33+
/* if we want to ensure our ability to dump core, don't chdir to / */
34+
if (do_daemonize) {
35+
- if (sigignore(SIGHUP) == -1) {
36+
+ if (signal(SIGHUP, SIG_IGN) == SIG_ERR) {
37+
perror("Failed to ignore SIGHUP");
38+
}
39+
if (daemonize(maxcore, settings.verbose) == -1) {
40+
@@ -9677,7 +9677,7 @@ int main (int argc, char **argv) {
41+
* ignore SIGPIPE signals; we can use errno == EPIPE if we
42+
* need that information
43+
*/
44+
- if (sigignore(SIGPIPE) == -1) {
45+
+ if (signal(SIGPIPE, SIG_IGN) == SIG_ERR) {
46+
perror("failed to ignore SIGPIPE; sigaction");
47+
exit(EX_OSERR);
48+
}

0 commit comments

Comments
 (0)