Skip to content

Commit

Permalink
Merge branch 'clang-format' of https://github.com/PingXie/valkey into…
Browse files Browse the repository at this point in the history
… clang-format
  • Loading branch information
PingXie committed May 27, 2024
2 parents 9da162f + 96745c2 commit 11eee55
Show file tree
Hide file tree
Showing 165 changed files with 25,348 additions and 28,782 deletions.
32 changes: 32 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
BasedOnStyle: LLVM
IndentWidth: 4
TabWidth: 4
UseTab: Never
ColumnLimit: 120
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 100
PenaltyExcessCharacter: 100
MaxEmptyLinesToKeep: 2
BreakBeforeBraces: Attach
AllowShortCaseLabelsOnASingleLine: true
AllowShortIfStatementsOnASingleLine: WithoutElse
AllowShortLoopsOnASingleLine: true
AllowShortFunctionsOnASingleLine: false
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignTrailingComments: true
PointerAlignment: Right
KeepEmptyLinesAtTheStartOfBlocks: false
SpaceBeforeParens: ControlStatements
SpacesInParentheses: false
SpacesInAngles: false
SpacesInCStyleCastParentheses: false
SpaceAfterCStyleCast: false
SpacesInSquareBrackets: false
ReflowComments: true
CommentPragmas: '^\\s*\\*'
SortIncludes: false
AllowAllParametersOfDeclarationOnNextLine: false
BinPackParameters: false
AlignAfterOpenBracket: Align
34 changes: 23 additions & 11 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,23 @@ permissions:

jobs:

checkers:
name: Run static checkers
runs-on: ubuntu-latest
strategy:
matrix:
path:
- check: 'src'
exclude: 'src/(lzf.*|crccombine.*|crc16.c|crc16_slottable.h|crc64.c|crcspeed.*|fmtargs.h|mt19937-64.*|pqsort.*|setcpuaffinity.c|setproctitle.c|sha1.*|sha256.*|siphash.c|strl.c|unit/test_files.h)'
steps:
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5
- name: Run clang-format style check (.c and .h)
uses: jidicula/clang-format-action@f62da5e3d3a2d88ff364771d9d938773a618ab5e # v4.11.0
with:
clang-format-version: '13'
check-path: ${{ matrix.path['check'] }}
exclude-regex: ${{ matrix.path['exclude'] }}

test-ubuntu-latest:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -39,10 +56,7 @@ jobs:
# build with TLS module just for compilation coverage
run: make SANITIZER=address SERVER_CFLAGS='-Werror -DDEBUG_ASSERTIONS' BUILD_TLS=module
- name: testprep
# Work around ASAN issue, see https://github.com/google/sanitizers/issues/1716
run: |
sudo apt-get install tcl8.6 tclx -y
sudo sysctl vm.mmap_rnd_bits=28
run: sudo apt-get install tcl8.6 tclx -y
- name: test
run: ./runtest --verbose --tags -slow --dump-logs
- name: module api test
Expand Down Expand Up @@ -81,16 +95,14 @@ jobs:
- name: make
run: make SERVER_CFLAGS='-Werror' MALLOC=libc

build-centos7-jemalloc:
build-almalinux8-jemalloc:
runs-on: ubuntu-latest
container: centos:7
container: almalinux:8
steps:
# on centos7, actions/checkout@v4 does not work, so we use v3
# ref. https://github.com/actions/checkout/issues/1487
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: make
run: |
yum -y install gcc make
make SERVER_CFLAGS='-Werror'
dnf -y install epel-release gcc make procps-ng which
make -j SERVER_CFLAGS='-Werror'
142 changes: 102 additions & 40 deletions .github/workflows/daily.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
inputs:
skipjobs:
description: 'jobs to skip (delete the ones you wanna keep, do not leave empty)'
default: 'valgrind,sanitizer,tls,freebsd,macos,alpine,32bit,iothreads,ubuntu,centos,malloc,specific,fortify,reply-schema'
default: 'valgrind,sanitizer,tls,freebsd,macos,alpine,32bit,iothreads,ubuntu,rpm-distros,malloc,specific,fortify,reply-schema'
skiptests:
description: 'tests to skip (delete the ones you wanna keep, do not leave empty)'
default: 'valkey,modules,sentinel,cluster,unittest'
Expand Down Expand Up @@ -600,11 +600,9 @@ jobs:
- name: make
run: make all-with-unit-tests OPT=-O3 SANITIZER=address SERVER_CFLAGS='-DSERVER_TEST -Werror -DDEBUG_ASSERTIONS'
- name: testprep
# Work around ASAN issue, see https://github.com/google/sanitizers/issues/1716
run: |
sudo apt-get update
sudo apt-get install tcl8.6 tclx -y
sudo sysctl vm.mmap_rnd_bits=28
- name: test
if: true && !contains(github.event.inputs.skiptests, 'valkey')
run: ./runtest --accurate --verbose --dump-logs ${{github.event.inputs.test_args}}
Expand Down Expand Up @@ -674,13 +672,34 @@ jobs:
if: true && !contains(github.event.inputs.skiptests, 'unittest')
run: ./src/valkey-unit-tests --accurate

test-centos7-jemalloc:
runs-on: ubuntu-latest
test-rpm-distros-jemalloc:
if: |
(github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'valkey-io/valkey')) &&
!contains(github.event.inputs.skipjobs, 'centos')
container: centos:7
(github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'valkey-io/valkey')) &&
!contains(github.event.inputs.skipjobs, 'rpm-distros')
strategy:
fail-fast: false
matrix:
include:
- name: test-almalinux8-jemalloc
container: almalinux:8
install_epel: true
- name: test-almalinux9-jemalloc
container: almalinux:8
install_epel: true
- name: test-centosstream9-jemalloc
container: quay.io/centos/centos:stream9
install_epel: true
- name: test-fedoralatest-jemalloc
container: fedora:latest
- name: test-fedorarawhide-jemalloc
container: fedora:rawhide

name: ${{ matrix.name }}
runs-on: ubuntu-latest

container: ${{ matrix.container }}
timeout-minutes: 14400

steps:
- name: prep
if: github.event_name == 'workflow_dispatch'
Expand All @@ -691,18 +710,19 @@ jobs:
echo "skiptests: ${{github.event.inputs.skiptests}}"
echo "test_args: ${{github.event.inputs.test_args}}"
echo "cluster_test_args: ${{github.event.inputs.cluster_test_args}}"
# On centos7 actions/checkout@v4 does not work, so we use v3
# ref. https://github.com/actions/checkout/issues/1487
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
repository: ${{ env.GITHUB_REPOSITORY }}
ref: ${{ env.GITHUB_HEAD_REF }}
- name: Install EPEL
if: matrix.install_epel
run: dnf -y install epel-release
- name: make
run: |
yum -y install gcc make
make SERVER_CFLAGS='-Werror'
dnf -y install gcc make procps-ng which /usr/bin/kill
make -j SERVER_CFLAGS='-Werror'
- name: testprep
run: yum -y install which tcl tclx
run: dnf -y install tcl tcltls
- name: test
if: true && !contains(github.event.inputs.skiptests, 'valkey')
run: ./runtest --accurate --verbose --dump-logs ${{github.event.inputs.test_args}}
Expand All @@ -716,13 +736,34 @@ jobs:
if: true && !contains(github.event.inputs.skiptests, 'cluster')
run: ./runtest-cluster ${{github.event.inputs.cluster_test_args}}

test-centos7-tls-module:
runs-on: ubuntu-latest
test-rpm-distros-tls-module:
if: |
(github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'valkey-io/valkey')) &&
!contains(github.event.inputs.skipjobs, 'tls')
container: centos:7
(github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'valkey-io/valkey')) &&
!contains(github.event.inputs.skipjobs, 'tls')
strategy:
fail-fast: false
matrix:
include:
- name: test-almalinux8-tls-module
container: almalinux:8
install_epel: true
- name: test-almalinux9-tls-module
container: almalinux:8
install_epel: true
- name: test-centosstream9-tls-module
container: quay.io/centos/centos:stream9
install_epel: true
- name: test-fedoralatest-tls-module
container: fedora:latest
- name: test-fedorarawhide-tls-module
container: fedora:rawhide

name: ${{ matrix.name }}
runs-on: ubuntu-latest

container: ${{ matrix.container }}
timeout-minutes: 14400

steps:
- name: prep
if: github.event_name == 'workflow_dispatch'
Expand All @@ -733,20 +774,20 @@ jobs:
echo "skiptests: ${{github.event.inputs.skiptests}}"
echo "test_args: ${{github.event.inputs.test_args}}"
echo "cluster_test_args: ${{github.event.inputs.cluster_test_args}}"
# On centos7 actions/checkout@v4 does not work, so we use v3
# ref. https://github.com/actions/checkout/issues/1487
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
repository: ${{ env.GITHUB_REPOSITORY }}
ref: ${{ env.GITHUB_HEAD_REF }}
- name: Install EPEL
if: matrix.install_epel
run: dnf -y install epel-release
- name: make
run: |
yum -y install centos-release-scl epel-release
yum -y install devtoolset-7 openssl-devel openssl
scl enable devtoolset-7 "make BUILD_TLS=module SERVER_CFLAGS='-Werror'"
dnf -y install make gcc openssl-devel openssl procps-ng which /usr/bin/kill
make -j BUILD_TLS=module SERVER_CFLAGS='-Werror'
- name: testprep
run: |
yum -y install tcl tcltls tclx
dnf -y install tcl tcltls
./utils/gen-test-certs.sh
- name: test
if: true && !contains(github.event.inputs.skiptests, 'valkey')
Expand All @@ -765,13 +806,34 @@ jobs:
run: |
./runtest-cluster --tls-module ${{github.event.inputs.cluster_test_args}}
test-centos7-tls-module-no-tls:
runs-on: ubuntu-latest
test-rpm-distros-tls-module-no-tls:
if: |
(github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'valkey-io/valkey')) &&
!contains(github.event.inputs.skipjobs, 'tls')
container: centos:7
(github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'valkey-io/valkey')) &&
!contains(github.event.inputs.skipjobs, 'tls')
strategy:
fail-fast: false
matrix:
include:
- name: test-almalinux8-tls-module-no-tls
container: almalinux:8
install_epel: true
- name: test-almalinux9-tls-module-no-tls
container: almalinux:8
install_epel: true
- name: test-centosstream9-tls-module-no-tls
container: quay.io/centos/centos:stream9
install_epel: true
- name: test-fedoralatest-tls-module-no-tls
container: fedora:latest
- name: test-fedorarawhide-tls-module-no-tls
container: fedora:rawhide

name: ${{ matrix.name }}
runs-on: ubuntu-latest

container: ${{ matrix.container }}
timeout-minutes: 14400

steps:
- name: prep
if: github.event_name == 'workflow_dispatch'
Expand All @@ -782,20 +844,20 @@ jobs:
echo "skiptests: ${{github.event.inputs.skiptests}}"
echo "test_args: ${{github.event.inputs.test_args}}"
echo "cluster_test_args: ${{github.event.inputs.cluster_test_args}}"
# On centos7 actions/checkout@v4 does not work, so we use v3
# ref. https://github.com/actions/checkout/issues/1487
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
with:
repository: ${{ env.GITHUB_REPOSITORY }}
ref: ${{ env.GITHUB_HEAD_REF }}
- name: Install EPEL
if: matrix.install_epel
run: dnf -y install epel-release
- name: make
run: |
yum -y install centos-release-scl epel-release
yum -y install devtoolset-7 openssl-devel openssl
scl enable devtoolset-7 "make BUILD_TLS=module SERVER_CFLAGS='-Werror'"
dnf -y install make gcc openssl-devel openssl procps-ng which /usr/bin/kill
make -j BUILD_TLS=module SERVER_CFLAGS='-Werror'
- name: testprep
run: |
yum -y install tcl tcltls tclx
dnf -y install tcl tcltls
./utils/gen-test-certs.sh
- name: test
if: true && !contains(github.event.inputs.skiptests, 'valkey')
Expand Down Expand Up @@ -898,7 +960,7 @@ jobs:
build-macos:
strategy:
matrix:
os: [macos-11, macos-13]
os: [macos-12, macos-14]
runs-on: ${{ matrix.os }}
if: |
(github.event_name == 'workflow_dispatch' || (github.event_name != 'workflow_dispatch' && github.repository == 'valkey-io/valkey')) &&
Expand Down Expand Up @@ -1076,7 +1138,7 @@ jobs:
notify-about-job-results:
runs-on: ubuntu-latest
if: always() && github.event_name != 'workflow_dispatch' && github.repository == 'valkey-io/valkey'
needs: [test-ubuntu-jemalloc, test-ubuntu-jemalloc-fortify, test-ubuntu-libc-malloc, test-ubuntu-no-malloc-usable-size, test-ubuntu-32bit, test-ubuntu-tls, test-ubuntu-tls-no-tls, test-ubuntu-io-threads, test-ubuntu-reclaim-cache, test-valgrind-test, test-valgrind-misc, test-valgrind-no-malloc-usable-size-test, test-valgrind-no-malloc-usable-size-misc, test-sanitizer-address, test-sanitizer-undefined, test-centos7-jemalloc, test-centos7-tls-module, test-centos7-tls-module-no-tls, test-macos-latest, test-macos-latest-sentinel, test-macos-latest-cluster, build-macos, test-freebsd, test-alpine-jemalloc, test-alpine-libc-malloc, reply-schemas-validator]
needs: [test-ubuntu-jemalloc, test-ubuntu-jemalloc-fortify, test-ubuntu-libc-malloc, test-ubuntu-no-malloc-usable-size, test-ubuntu-32bit, test-ubuntu-tls, test-ubuntu-tls-no-tls, test-ubuntu-io-threads, test-ubuntu-reclaim-cache, test-valgrind-test, test-valgrind-misc, test-valgrind-no-malloc-usable-size-test, test-valgrind-no-malloc-usable-size-misc, test-sanitizer-address, test-sanitizer-undefined, test-rpm-distros-jemalloc, test-rpm-distros-tls-module, test-rpm-distros-tls-module-no-tls, test-macos-latest, test-macos-latest-sentinel, test-macos-latest-cluster, build-macos, test-freebsd, test-alpine-jemalloc, test-alpine-libc-malloc, reply-schemas-validator]
steps:
- name: Collect job status
run: |
Expand Down
1 change: 1 addition & 0 deletions src/.clang-format-ignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ sha1.*
sha256.*
siphash.c
strl.c
unit/test_files.h
Loading

0 comments on commit 11eee55

Please sign in to comment.