7
7
- master
8
8
- ' v[0-9]+.*'
9
9
10
+ defaults :
11
+ run :
12
+ shell : bash
13
+
10
14
jobs :
11
15
lint :
12
16
name : cpplint
13
- if : contains(join(toJson( github.event.pull_request.labels.*.name)) , 'ready-for-testing')
17
+ if : ${{ contains(github.event.pull_request.labels.*.name, 'ready-for-testing') }}
14
18
runs-on : ubuntu-latest
15
19
steps :
16
20
- uses : actions/checkout@v2
17
21
with :
18
- fetch-depth : 2
22
+ fetch-depth : 1
23
+ - uses : jitterbit/get-changed-files@v1
24
+ id : diff
19
25
- name : Cpplint
20
26
run : |
21
- cd .linters/cpp && ln -snf hooks /pre-commit.sh
22
- ./ pre-commit.sh $(git --no-pager diff --name-only $(git log --oneline -n 1 | cut -d ' ' -f 1,5) | sed -E 's/(.*)/..\/..\/\1/g')
27
+ ln -snf $PWD/ .linters/cpp/hooks/pre-commit.sh $PWD/.linters/cpp /pre-commit.sh
28
+ .linters/cpp/ pre-commit.sh ${{ steps. diff.outputs.all }}
23
29
24
30
build :
25
31
name : build
@@ -40,62 +46,58 @@ jobs:
40
46
container :
41
47
image : vesoft/nebula-dev:${{ matrix.os }}
42
48
env :
43
- CCACHE_DIR : /tmp/ccache/${{ matrix.os }}-${{ matrix.compiler }}
44
- options : --mount type=tmpfs,destination=/tmp/ccache,tmpfs-size=1073741824 -v /tmp/ccache/${{ matrix.os }}-${{ matrix.compiler }}:/tmp/ccache/${{ matrix.os }}-${{ matrix.compiler }} -v /etc/action/secrets/codecov:/etc/action/secrets/codecov
49
+ CCACHE_DIR : /tmp/ccache/nebula/${{ matrix.os }}-${{ matrix.compiler }}
50
+ CCACHE_MAXSIZE : 1G
51
+ volumes :
52
+ - /tmp/ccache/nebula/${{ matrix.os }}-${{ matrix.compiler }}:/tmp/ccache/nebula/${{ matrix.os }}-${{ matrix.compiler }}
53
+ options : --mount type=tmpfs,destination=/tmp/ccache/nebula,tmpfs-size=1073741824 --cap-add=SYS_PTRACE
45
54
steps :
46
55
- uses : actions/checkout@v2
47
56
with :
48
- fetch-depth : 2
49
- - name : Ignore only documents changes
50
- id : ignore_docs
51
- run : |
52
- num_source_files=$(git --no-pager diff --name-only $(git log --oneline -n 1 | cut -d' ' -f1,5) | grep '^src\|^CMakeLists.txt\|^cmake\|^.github/workflows' | wc -l)
53
- echo "::set-output name=num_source_files::${num_source_files}"
57
+ fetch-depth : 1
54
58
- name : Prepare environment
55
59
run : |
56
- [ -f "$CCACHE_DIR/ccache.conf" ] || cp ci/ccache.conf "$CCACHE_DIR"
57
60
[ -d build/ ] && rm -rf build/* || mkdir -p build
58
- shell : bash
59
- - name : CMake with gcc-9.2
60
- if : matrix.compiler == 'gcc-9.2' && matrix.os != 'centos7' && steps.ignore_docs.outputs.num_source_files != 0
61
- run : |
62
- cmake -DCMAKE_BUILD_TYPE=Release -B build/
63
- - name : CMake with Coverage
64
- if : matrix.compiler == 'gcc-9.2' && matrix.os == 'centos7' && steps.ignore_docs.outputs.num_source_files != 0
61
+ - name : CMake
65
62
run : |
66
- cmake -DENABLE_COVERAGE=ON -B build/
67
- - name : CMake with clang-9
68
- if : matrix.compiler == 'clang-9' && steps.ignore_docs.outputs.num_source_files != 0
69
- run : |
70
- cmake \
71
- -DCMAKE_CXX_COMPILER=clang++ \
72
- -DCMAKE_C_COMPILER=clang \
73
- -DENABLE_ASAN=on \
74
- -B build/
63
+ case ${{ matrix.os }} in
64
+ centos7)
65
+ # build with coverage
66
+ cmake -DENABLE_COVERAGE=ON -B build/
67
+ ;;
68
+ ubuntu1804)
69
+ case ${{ matrix.compiler }} in
70
+ gcc*)
71
+ # build with release type
72
+ cmake -DCMAKE_BUILD_TYPE=Release -B build/
73
+ ;;
74
+ clang*)
75
+ cmake \
76
+ -DCMAKE_CXX_COMPILER=clang++ \
77
+ -DCMAKE_C_COMPILER=clang \
78
+ -DENABLE_ASAN=on \
79
+ -B build/
80
+ ;;
81
+ esac
82
+ ;;
83
+ esac
75
84
- name : Make
76
- if : steps.ignore_docs.outputs.num_source_files != 0
77
- run : |
78
- cmake --build build/ -j $(nproc)
85
+ run : cmake --build build/ -j $(($(nproc)/2+1))
79
86
- name : CTest with multiple threads
80
- if : steps.ignore_docs.outputs.num_source_files != 0
81
87
timeout-minutes : 15
82
- continue-on-error : false
83
88
working-directory : build
84
89
env :
85
- ASAN_SYMBOLIZER_PATH : /opt/vesoft/toolset/clang/9.0.0/bin/llvm-symbolizer
86
90
ASAN_OPTIONS : fast_unwind_on_malloc=1
87
91
run : |
88
92
ctest \
89
- -j $(($(nproc)/2)) \
93
+ -j $(($(nproc)/2+1 )) \
90
94
--timeout 400 \
91
95
--output-on-failure
92
- shell : bash
93
96
- name : CTest with single thread
94
- if : failure() && steps.ignore_docs.outputs.num_source_files != 0
97
+ if : failure()
95
98
timeout-minutes : 30
96
99
working-directory : build
97
100
env :
98
- ASAN_SYMBOLIZER_PATH : /opt/vesoft/toolset/clang/9.0.0/bin/llvm-symbolizer
99
101
ASAN_OPTIONS : fast_unwind_on_malloc=0
100
102
run : |
101
103
ctest \
@@ -104,13 +106,12 @@ jobs:
104
106
--rerun-failed
105
107
- name : Testing Coverage Report
106
108
working-directory : build
107
- if : success() && matrix.compiler == 'gcc-9.2' && matrix.os == 'centos7' && steps.ignore_docs.outputs.num_source_files != 0
109
+ if : success() && matrix.compiler == 'gcc-9.2' && matrix.os == 'centos7'
108
110
run : |
109
111
set -e
110
112
fastcov -o coverage.info -l --exclude=scanner.lex
111
113
lcov --remove coverage.info '*/opt/vesoft/*' -o clean.info
112
- bash <(curl -s https://codecov.io/bash) -Z -t $(cat /etc/action/secrets/codecov) -f clean.info
113
- shell : bash
114
+ bash <(curl -s https://codecov.io/bash) -Z -f clean.info
114
115
- name : Cleanup
115
116
if : always()
116
117
run : rm -rf build
0 commit comments