2019-10-20 03:04:25 -04:00
|
|
|
name: CI
|
|
|
|
|
|
|
|
on: [push, pull_request]
|
|
|
|
|
|
|
|
jobs:
|
2020-05-24 01:00:12 -04:00
|
|
|
|
2020-02-25 06:01:52 -05:00
|
|
|
test-ubuntu-latest:
|
|
|
|
runs-on: ubuntu-latest
|
2019-10-20 03:04:25 -04:00
|
|
|
steps:
|
2022-03-30 09:18:03 -04:00
|
|
|
- uses: actions/checkout@v3
|
2019-10-20 03:04:25 -04:00
|
|
|
- name: make
|
2020-10-19 20:26:57 -04:00
|
|
|
# Fail build if there are warnings
|
|
|
|
# build with TLS just for compilation coverage
|
|
|
|
run: make REDIS_CFLAGS='-Werror' BUILD_TLS=yes
|
2019-10-20 03:04:25 -04:00
|
|
|
- name: test
|
|
|
|
run: |
|
2021-04-25 06:08:46 -04:00
|
|
|
sudo apt-get install tcl8.6 tclx
|
2021-11-18 09:04:01 -05:00
|
|
|
./runtest --verbose --tags -slow --dump-logs
|
2020-02-23 09:51:27 -05:00
|
|
|
- name: module api test
|
2021-11-18 09:04:01 -05:00
|
|
|
run: ./runtest-moduleapi --verbose --dump-logs
|
2021-11-11 06:51:33 -05:00
|
|
|
|
|
|
|
test-sanitizer-address:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2022-03-30 09:18:03 -04:00
|
|
|
- uses: actions/checkout@v3
|
2021-11-11 06:51:33 -05:00
|
|
|
- name: make
|
Build TLS as a loadable module
* Support BUILD_TLS=module to be loaded as a module via config file or
command line. e.g. redis-server --loadmodule redis-tls.so
* Updates to redismodule.h to allow it to be used side by side with
server.h by defining REDISMODULE_CORE_MODULE
* Changes to server.h, redismodule.h and module.c to avoid repeated
type declarations (gcc 4.8 doesn't like these)
* Add a mechanism for non-ABI neutral modules (ones who include
server.h) to refuse loading if they detect not being built together with
redis (release.c)
* Fix wrong signature of RedisModuleDefragFunc, this could break
compilation of a module, but not the ABI
* Move initialization of listeners in server.c to be after loading
the modules
* Config TLS after initialization of listeners
* Init cluster after initialization of listeners
* Add TLS module to CI
* Fix a test suite race conditions:
Now that the listeners are initialized later, it's not sufficient to
wait for the PID message in the log, we need to wait for the "Server
Initialized" message.
* Fix issues with moduleconfigs test as a result from start_server
waiting for "Server Initialized"
* Fix issues with modules/infra test as a result of an additional module
present
Notes about Sentinel:
Sentinel can't really rely on the tls module, since it uses hiredis to
initiate connections and depends on OpenSSL (won't be able to use any
other connection modules for that), so it was decided that when TLS is
built as a module, sentinel does not support TLS at all.
This means that it keeps using redis_tls_ctx and redis_tls_client_ctx directly.
Example code of config in redis-tls.so(may be use in the future):
RedisModuleString *tls_cfg = NULL;
void tlsInfo(RedisModuleInfoCtx *ctx, int for_crash_report) {
UNUSED(for_crash_report);
RedisModule_InfoAddSection(ctx, "");
RedisModule_InfoAddFieldLongLong(ctx, "var", 42);
}
int tlsCommand(RedisModuleCtx *ctx, RedisModuleString **argv, int argc)
{
if (argc != 2) return RedisModule_WrongArity(ctx);
return RedisModule_ReplyWithString(ctx, argv[1]);
}
RedisModuleString *getStringConfigCommand(const char *name, void *privdata) {
REDISMODULE_NOT_USED(name);
REDISMODULE_NOT_USED(privdata);
return tls_cfg;
}
int setStringConfigCommand(const char *name, RedisModuleString *new, void *privdata, RedisModuleString **err) {
REDISMODULE_NOT_USED(name);
REDISMODULE_NOT_USED(err);
REDISMODULE_NOT_USED(privdata);
if (tls_cfg) RedisModule_FreeString(NULL, tls_cfg);
RedisModule_RetainString(NULL, new);
tls_cfg = new;
return REDISMODULE_OK;
}
int RedisModule_OnLoad(void *ctx, RedisModuleString **argv, int argc)
{
....
if (RedisModule_CreateCommand(ctx,"tls",tlsCommand,"",0,0,0) == REDISMODULE_ERR)
return REDISMODULE_ERR;
if (RedisModule_RegisterStringConfig(ctx, "cfg", "", REDISMODULE_CONFIG_DEFAULT, getStringConfigCommand, setStringConfigCommand, NULL, NULL) == REDISMODULE_ERR)
return REDISMODULE_ERR;
if (RedisModule_LoadConfigs(ctx) == REDISMODULE_ERR) {
if (tls_cfg) {
RedisModule_FreeString(ctx, tls_cfg);
tls_cfg = NULL;
}
return REDISMODULE_ERR;
}
...
}
Co-authored-by: zhenwei pi <pizhenwei@bytedance.com>
Signed-off-by: zhenwei pi <pizhenwei@bytedance.com>
2022-08-22 03:53:56 -04:00
|
|
|
# build with TLS module just for compilation coverage
|
|
|
|
run: make SANITIZER=address REDIS_CFLAGS='-Werror' BUILD_TLS=module
|
2021-11-11 06:51:33 -05:00
|
|
|
- name: testprep
|
|
|
|
run: sudo apt-get install tcl8.6 tclx -y
|
|
|
|
- name: test
|
2021-11-18 09:04:01 -05:00
|
|
|
run: ./runtest --verbose --tags -slow --dump-logs
|
2021-11-11 06:51:33 -05:00
|
|
|
- name: module api test
|
2021-11-18 09:04:01 -05:00
|
|
|
run: ./runtest-moduleapi --verbose --dump-logs
|
2020-02-25 06:01:52 -05:00
|
|
|
|
2021-08-11 09:19:54 -04:00
|
|
|
build-debian-old:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
container: debian:oldoldstable
|
2020-02-25 06:01:52 -05:00
|
|
|
steps:
|
2022-03-30 09:18:03 -04:00
|
|
|
- uses: actions/checkout@v3
|
2020-02-25 06:01:52 -05:00
|
|
|
- name: make
|
2021-08-11 09:19:54 -04:00
|
|
|
run: |
|
|
|
|
apt-get update && apt-get install -y build-essential
|
|
|
|
make REDIS_CFLAGS='-Werror'
|
2019-10-20 03:04:25 -04:00
|
|
|
|
|
|
|
build-macos-latest:
|
2020-02-25 06:01:52 -05:00
|
|
|
runs-on: macos-latest
|
2019-10-20 03:04:25 -04:00
|
|
|
steps:
|
2022-03-30 09:18:03 -04:00
|
|
|
- uses: actions/checkout@v3
|
2019-10-20 03:04:25 -04:00
|
|
|
- name: make
|
2020-10-19 20:26:57 -04:00
|
|
|
run: make REDIS_CFLAGS='-Werror'
|
2020-05-24 01:00:12 -04:00
|
|
|
|
2020-07-10 09:05:29 -04:00
|
|
|
build-32bit:
|
2020-05-24 01:00:12 -04:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2022-03-30 09:18:03 -04:00
|
|
|
- uses: actions/checkout@v3
|
2020-05-24 01:00:12 -04:00
|
|
|
- name: make
|
|
|
|
run: |
|
|
|
|
sudo apt-get update && sudo apt-get install libc6-dev-i386
|
2020-10-19 20:26:57 -04:00
|
|
|
make REDIS_CFLAGS='-Werror' 32bit
|
2020-05-24 01:00:12 -04:00
|
|
|
|
|
|
|
build-libc-malloc:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
2022-03-30 09:18:03 -04:00
|
|
|
- uses: actions/checkout@v3
|
2020-05-24 01:00:12 -04:00
|
|
|
- name: make
|
2020-10-19 20:26:57 -04:00
|
|
|
run: make REDIS_CFLAGS='-Werror' MALLOC=libc
|
2020-05-24 01:00:12 -04:00
|
|
|
|
Implement redisAtomic to replace _Atomic C11 builtin (#7707)
Redis 6.0 introduces I/O threads, it is so cool and efficient, we use C11
_Atomic to establish inter-thread synchronization without mutex. But the
compiler that must supports C11 _Atomic can compile redis code, that brings a
lot of inconvenience since some common platforms can't support by default such
as CentOS7, so we want to implement redis atomic type to make it more portable.
We have implemented our atomic variable for redis that only has 'relaxed'
operations in src/atomicvar.h, so we implement some operations with
'sequentially-consistent', just like the default behavior of C11 _Atomic that
can establish inter-thread synchronization. And we replace all uses of C11
_Atomic with redis atomic variable.
Our implementation of redis atomic variable uses C11 _Atomic, __atomic or
__sync macros if available, it supports most common platforms, and we will
detect automatically which feature we use. In Makefile we use a dummy file to
detect if the compiler supports C11 _Atomic. Now for gcc, we can compile redis
code theoretically if your gcc version is not less than 4.1.2(starts to support
__sync_xxx operations). Otherwise, we remove use mutex fallback to implement
redis atomic variable for performance and test. You will get compiling errors
if your compiler doesn't support all features of above.
For cover redis atomic variable tests, we add other CI jobs that build redis on
CentOS6 and CentOS7 and workflow daily jobs that run the tests on them.
For them, we just install gcc by default in order to cover different compiler
versions, gcc is 4.4.7 by default installation on CentOS6 and 4.8.5 on CentOS7.
We restore the feature that we can test redis with Helgrind to find data race
errors. But you need install Valgrind in the default path configuration firstly
before running your tests, since we use macros in helgrind.h to tell Helgrind
inter-thread happens-before relationship explicitly for avoiding false positives.
Please open an issue on github if you find data race errors relate to this commit.
Unrelated:
- Fix redefinition of typedef 'RedisModuleUserChangedFunc'
For some old version compilers, they will report errors or warnings, if we
re-define function type.
2020-09-17 09:01:45 -04:00
|
|
|
build-centos7-jemalloc:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
container: centos:7
|
|
|
|
steps:
|
2022-03-30 09:18:03 -04:00
|
|
|
- uses: actions/checkout@v3
|
Implement redisAtomic to replace _Atomic C11 builtin (#7707)
Redis 6.0 introduces I/O threads, it is so cool and efficient, we use C11
_Atomic to establish inter-thread synchronization without mutex. But the
compiler that must supports C11 _Atomic can compile redis code, that brings a
lot of inconvenience since some common platforms can't support by default such
as CentOS7, so we want to implement redis atomic type to make it more portable.
We have implemented our atomic variable for redis that only has 'relaxed'
operations in src/atomicvar.h, so we implement some operations with
'sequentially-consistent', just like the default behavior of C11 _Atomic that
can establish inter-thread synchronization. And we replace all uses of C11
_Atomic with redis atomic variable.
Our implementation of redis atomic variable uses C11 _Atomic, __atomic or
__sync macros if available, it supports most common platforms, and we will
detect automatically which feature we use. In Makefile we use a dummy file to
detect if the compiler supports C11 _Atomic. Now for gcc, we can compile redis
code theoretically if your gcc version is not less than 4.1.2(starts to support
__sync_xxx operations). Otherwise, we remove use mutex fallback to implement
redis atomic variable for performance and test. You will get compiling errors
if your compiler doesn't support all features of above.
For cover redis atomic variable tests, we add other CI jobs that build redis on
CentOS6 and CentOS7 and workflow daily jobs that run the tests on them.
For them, we just install gcc by default in order to cover different compiler
versions, gcc is 4.4.7 by default installation on CentOS6 and 4.8.5 on CentOS7.
We restore the feature that we can test redis with Helgrind to find data race
errors. But you need install Valgrind in the default path configuration firstly
before running your tests, since we use macros in helgrind.h to tell Helgrind
inter-thread happens-before relationship explicitly for avoiding false positives.
Please open an issue on github if you find data race errors relate to this commit.
Unrelated:
- Fix redefinition of typedef 'RedisModuleUserChangedFunc'
For some old version compilers, they will report errors or warnings, if we
re-define function type.
2020-09-17 09:01:45 -04:00
|
|
|
- name: make
|
|
|
|
run: |
|
|
|
|
yum -y install gcc make
|
2020-10-19 20:26:57 -04:00
|
|
|
make REDIS_CFLAGS='-Werror'
|