Skip to content

Commit

Permalink
chore(clang-format): unify rdsn and Pegasus clang-format (#1022)
Browse files Browse the repository at this point in the history
  • Loading branch information
acelyc111 authored Jul 7, 2022
1 parent 862c824 commit a4dd5d3
Show file tree
Hide file tree
Showing 15 changed files with 27 additions and 247 deletions.
16 changes: 16 additions & 0 deletions src/.clang-format → .clang-format
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
---
Language: Cpp
# BasedOnStyle: LLVM
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint_and_test_pegasus.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
fetch-depth: 1
submodules: true
- name: clang-format
run: ./rdsn/scripts/linux/run-clang-format.py --clang-format-executable clang-format-3.9 -e ./src/shell/linenoise -e ./src/shell/sds -e ./rdsn -r ./src
run: ./scripts/run-clang-format.py --clang-format-executable clang-format-3.9 -e ./src/shell/linenoise -e ./src/shell/sds -e ./rdsn/thirdparty -r .

test:
name: Test
Expand All @@ -74,7 +74,7 @@ jobs:
- name: Unpack prebuilt third-parties
run: unzip /root/thirdparties-bin.zip -d ./rdsn/thirdparty
- name: Compilation
run: ./run.sh build -c --skip_thirdparty
run: ./run.sh build -c -j $(($(nproc)/2+1))
- name: Packaging Server
run: ./run.sh pack_server
- name: Packaging Tools
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@
# it's recommended to create a PR against the ci-test branch to test if it works
# as expected.

name: rdsn Lint and Unit Test
name: rdsn Unit Test

on:
# run on each pull request
pull_request:
types: [ synchronize, opened, reopened ]
paths:
- .github/workflows/lint_and_test_rdsn.yaml
- .github/workflows/test_rdsn.yaml
- rdsn/CMakeLists.txt
- rdsn/bin/**
- rdsn/compile_thrift.py
Expand All @@ -51,22 +51,8 @@ defaults:
shell: bash

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
container:
image: apache/pegasus:clang-format-3.9
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 1
- name: clang-format
working-directory: rdsn
run: ./scripts/linux/run-clang-format.py --clang-format-executable=clang-format-3.9 -r src include

test:
name: Test
needs: lint
runs-on: ubuntu-latest
container:
image: apache/pegasus:thirdparties-bin-ubuntu1804
Expand Down Expand Up @@ -109,7 +95,6 @@ jobs:
test-with-sanitizer-address:
name: Test With Sanitizer Address
needs: lint
runs-on: ubuntu-latest
container:
image: apache/pegasus:thirdparties-bin-ubuntu1804
Expand Down Expand Up @@ -152,7 +137,6 @@ jobs:
test-with-sanitizer-leak:
name: Test With Sanitizer Leak
needs: lint
runs-on: ubuntu-latest
container:
image: apache/pegasus:thirdparties-bin-ubuntu1804
Expand Down Expand Up @@ -195,7 +179,6 @@ jobs:
test-with-sanitizer-undefined:
name: Test With Sanitizer Undefined
needs: lint
runs-on: ubuntu-latest
container:
image: apache/pegasus:thirdparties-bin-ubuntu1804
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
# 'always pass' action to resolve it, see more details:
# https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/troubleshooting-required-status-checks#handling-skipped-but-required-checks

name: rdsn Lint and Unit Test
name: rdsn Unit Test

on:
# run on each pull request
Expand All @@ -46,12 +46,6 @@ on:
workflow_dispatch:

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- run: 'echo "No build required" '

test:
name: Test
runs-on: ubuntu-latest
Expand Down
5 changes: 1 addition & 4 deletions .licenserc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ header:
- '.github/pull_request_template.md'
- '.rat-excludes'
- 'DISCLAIMER-WIP'
- 'src/.clang-format'
# TODO(yingchun): rrdb_types.* files can be automatic generated when build, we can remove them later.
- 'src/base/rrdb_types.cpp'
- 'src/include/rrdb/rrdb_types.h'
Expand Down Expand Up @@ -75,7 +74,7 @@ header:
- 'rdsn/bin/FindRT.cmake'
- 'rdsn/bin/FindDL.cmake'
# Copyright (c) 2017 Guillaume Papin
- 'rdsn/scripts/linux/run-clang-format.py'
- 'scripts/run-clang-format.py'
# need manual fix
- 'rdsn/src/failure_detector/test/gtest.filter'
- 'rdsn/src/meta/test/meta_state/gtest.filter'
Expand All @@ -90,7 +89,6 @@ header:
# should be empty, or ignore all comment lines
- 'rdsn/src/utils/test/config-empty.ini'
# The MIT License (MIT), Copyright (c) 2015 Microsoft Corporation
- 'rdsn/.clang-format'
- 'rdsn/.gitignore'
- 'rdsn/.licenserc.yaml'
- 'rdsn/README.md'
Expand Down Expand Up @@ -209,7 +207,6 @@ header:
- 'rdsn/scripts/linux/clear_zk.sh'
- 'rdsn/scripts/linux/install.sh'
- 'rdsn/scripts/linux/learn_stat.py'
- 'rdsn/scripts/linux/run-clang-format.sh'
- 'rdsn/scripts/linux/start_zk.sh'
- 'rdsn/scripts/linux/stop_zk.sh'
- 'rdsn/src/aio/aio_provider.cpp'
Expand Down
6 changes: 0 additions & 6 deletions .rat-excludes
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
.*ini
.*json
.*in
.*md
carrot
.clang-format
sds/*
linenoise/*
argh.h
Expand All @@ -12,8 +9,5 @@ ssh-no-interactive
scp-no-interactive
get_local_ip
DISCLAIMER-WIP
.travis.yml
.rat-excludes
.gitmodules
.gitignore
apache-rat-0.13.jar
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ RESULTING FROM THE USE OF THIS SOFTWARE.

--------------------------------------------------------------------------------

rdsn/scripts/linux/run-clang-format.py - MIT License
scripts/run-clang-format.py - MIT License

MIT License

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ under the License.

![pegasus-logo](https://github.com/apache/incubator-pegasus-website/blob/master/assets/images/pegasus-logo-inv.png)

[![Build Status](https://travis-ci.org/apache/incubator-pegasus.svg?branch=master)](https://travis-ci.org/apache/incubator-pegasus)
[![BuildPegasusRegularly - build pegasus and rdsn on different env every day](https://github.com/apache/incubator-pegasus/actions/workflows/pegasus-regular-build.yml/badge.svg)](https://github.com/apache/incubator-pegasus/actions/workflows/pegasus-regular-build.yml)
[![License](https://img.shields.io/badge/license-Apache%202-4EB1BA.svg)](https://www.apache.org/licenses/LICENSE-2.0.html)
[![Releases](https://img.shields.io/github/release/apache/incubator-pegasus.svg)][github-release]

Expand Down
119 changes: 0 additions & 119 deletions rdsn/.clang-format

This file was deleted.

2 changes: 1 addition & 1 deletion rdsn/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
~ THE SOFTWARE.
-->

[![rdsn Lint and Unit Test](https://github.com/apache/incubator-pegasus/actions/workflows/lint_and_test_rdsn.yaml/badge.svg)](https://github.com/apache/incubator-pegasus/actions/workflows/lint_and_test_rdsn.yaml)
[![rdsn Unit Test](https://github.com/apache/incubator-pegasus/actions/workflows/test_rdsn.yaml/badge.svg)](https://github.com/apache/incubator-pegasus/actions/workflows/test_rdsn.yaml)

All pull requests please now go to https://github.com/imzhenyu/rdsn for automatic integration with latest version. We will periodically update this repo. Thank you.

Expand Down
11 changes: 0 additions & 11 deletions rdsn/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.


os=linux
scripts_dir=`pwd`/scripts/$os

Expand Down Expand Up @@ -78,7 +77,6 @@ function usage_build()
echo " to enable valgrind memcheck, default no"
echo " --use_jemalloc build with jemalloc"
echo " --skip_thirdparty whether to skip building thirdparties, default no"
echo " --check whether to perform code check before building"
echo " --sanitizer <type> build with sanitizer to check potential problems,
type: address|leak|thread|undefined"
if [ "$ONLY_BUILD" == "NO" ]; then
Expand Down Expand Up @@ -107,7 +105,6 @@ function run_build()
DISABLE_GPERF=NO
USE_JEMALLOC=NO
SKIP_THIRDPARTY=NO
CHECK=NO
SANITIZER=""
TEST_MODULE=""
ROCKSDB_PORTABLE=OFF
Expand Down Expand Up @@ -163,9 +160,6 @@ function run_build()
--skip_thirdparty)
SKIP_THIRDPARTY=YES
;;
--check)
CHECK=YES
;;
--sanitizer)
IS_SANITIZERS=`echo ${SANITIZERS[@]} | grep -w $2`
if [[ -z ${IS_SANITIZERS} ]]; then
Expand Down Expand Up @@ -199,11 +193,6 @@ function run_build()
shift
done

if [[ ${CHECK} == "YES" ]]; then
${scripts_dir}/run-clang-format.sh
exit_if_fail $?
fi

if [ "$(uname)" == "Darwin" ]; then
MACOS_OPENSSL_ROOT_DIR="/usr/local/opt/openssl"
CMAKE_OPTIONS="-DMACOS_OPENSSL_ROOT_DIR=${MACOS_OPENSSL_ROOT_DIR}"
Expand Down
Loading

0 comments on commit a4dd5d3

Please sign in to comment.