From fe96c30dae84d74e65bb10cc903628386760f673 Mon Sep 17 00:00:00 2001
From: yixinglu <2520865+yixinglu@users.noreply.github.com>
Date: Wed, 25 Dec 2019 00:46:36 +0800
Subject: [PATCH] Enable ccache for building and fix dockerfile for gflags
Update docker hub url
Use tmpfs for ccache
Limit 1G tmpfs size
Use container env to simplify steps environment variables
Add centos6 job
Fix ccache dir in centos6
Specify CC/CXX environment variables to fix node error
Fix env var
Try to fix cmake error
Add centos cache job again
Fix cache key and restore keys
Fix echo string error
Update ccache directory
Remove write ccache conf cmd
Format
Use common job env
Fix centos6 job
Use LD_LIBRARY_PATH to fix centos 6 dep error of node 12
Setup node version
Test customed actions
Fix no cache for apk installation
Try to fix entrypoint
Fix entrypoint
Use docker container to cache
Use docker to run build and test
Use sudo to mount tmpfs
Fix tty error
Fix tmpfs mount point
Fix mount error
Delete cache actions
---
.github/workflows/build.yaml | 107 +++++++----------------------
.gitignore | 4 +-
README.md | 2 +-
ci/scripts/build-and-test-clang.sh | 17 +++++
ci/scripts/build-and-test-gcc.sh | 17 +++++
docker/Dockerfile.graphd | 6 +-
docker/Dockerfile.metad | 6 +-
docker/Dockerfile.storaged | 6 +-
8 files changed, 65 insertions(+), 100 deletions(-)
create mode 100755 ci/scripts/build-and-test-clang.sh
create mode 100755 ci/scripts/build-and-test-gcc.sh
diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
index 2f2f67495ff..e5e5e4441fa 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -8,8 +8,8 @@ on:
- 'docs/**'
jobs:
- build-gcc:
- name: build-gcc
+ build:
+ name: build
runs-on: ubuntu-latest
strategy:
matrix:
@@ -18,90 +18,31 @@ jobs:
- centos7
- ubuntu1604
- ubuntu1804
- container:
- image: vesoft/nebula-dev:${{ matrix.tag }}
+ compiler: [gcc, clang]
+ exclude:
+ - tag: centos6
+ compiler: clang
+ - tag: centos7
+ compiler: clang
steps:
- uses: actions/checkout@v1
with:
fetch-depth: 1
- - name: cmake
- env:
- NEBULA_DEP_BIN: /opt/nebula/third-party/bin
- LIBRARY_PATH: /usr/lib/x86_64-linux-gnu:/lib/x86_64-linux-gnu:${LIBRARY_PATH}
+ - name: Mount tmpfs
run: |
- mkdir _build && cd _build
- ${NEBULA_DEP_BIN}/cmake -DCMAKE_C_COMPILER=${NEBULA_DEP_BIN}/gcc -DCMAKE_CXX_COMPILER=${NEBULA_DEP_BIN}/g++ -DCMAKE_BUILD_TYPE=Release ..
- shell: bash
- - name: make
- env:
- LIBRARY_PATH: /usr/lib/x86_64-linux-gnu:/lib/x86_64-linux-gnu:${LIBRARY_PATH}
- run: |
- cd _build && make -j $(nproc)
- shell: bash
- - name: test in multithreads
- timeout-minutes: 20
- env:
- NEBULA_DEP_BIN: /opt/nebula/third-party/bin
- LIBRARY_PATH: /usr/lib/x86_64-linux-gnu:/lib/x86_64-linux-gnu:${LIBRARY_PATH}
- run: |
- cd _build
- ${NEBULA_DEP_BIN}/ctest -j $(nproc) --output-on-failure
- shell: bash
- - name: test in singlethread
- if: failure()
- timeout-minutes: 40
- env:
- NEBULA_DEP_BIN: /opt/nebula/third-party/bin
- LIBRARY_PATH: /usr/lib/x86_64-linux-gnu:/lib/x86_64-linux-gnu:${LIBRARY_PATH}
- run: |
- cd _build
- ${NEBULA_DEP_BIN}/ctest --output-on-failure
- shell: bash
- build-clang:
- name: build-clang
- runs-on: ubuntu-latest
- strategy:
- matrix:
- tag:
- - ubuntu1604
- - ubuntu1804
- container:
- image: vesoft/nebula-dev:${{ matrix.tag }}
- steps:
- - uses: actions/checkout@v1
+ mkdir -p ${{ github.workspace }}/.cache
+ sudo mount -t tmpfs -o size=1G tmpfs ${{ github.workspace }}/.cache
+ - uses: actions/cache@v1
with:
- fetch-depth: 1
- - name: cmake
- env:
- NEBULA_DEP_BIN: /opt/nebula/third-party/bin
- LIBRARY_PATH: /usr/lib/x86_64-linux-gnu:/lib/x86_64-linux-gnu:${LIBRARY_PATH}
- run: |
- mkdir _build && cd _build
- ${NEBULA_DEP_BIN}/cmake -DCMAKE_CXX_COMPILER=clang++-8 -DCMAKE_C_COMPILER=clang-8 -DENABLE_ASAN=on -DENABLE_UBSAN=on ..
- shell: bash
- - name: make
- env:
- LIBRARY_PATH: /usr/lib/x86_64-linux-gnu:/lib/x86_64-linux-gnu:${LIBRARY_PATH}
- run: |
- cd _build && make -j $(nproc)
- shell: bash
- - name: test in multithreads
- timeout-minutes: 20
- env:
- NEBULA_DEP_BIN: /opt/nebula/third-party/bin
- LIBRARY_PATH: /usr/lib/x86_64-linux-gnu:/lib/x86_64-linux-gnu:${LIBRARY_PATH}
- run: |
- cd _build
- ${NEBULA_DEP_BIN}/ctest -j $(nproc) --output-on-failure
- shell: bash
- - name: test in singlethread
- if: failure()
- timeout-minutes: 40
- env:
- NEBULA_DEP_BIN: /opt/nebula/third-party/bin
- LIBRARY_PATH: /usr/lib/x86_64-linux-gnu:/lib/x86_64-linux-gnu:${LIBRARY_PATH}
- run: |
- cd _build
- ${NEBULA_DEP_BIN}/ctest --output-on-failure
- shell: bash
-
+ path: ${{ github.workspace }}/.cache/ccache
+ key: ${{ matrix.tag }}-${{ matrix.compiler }}-${{ hashFiles('**/CMakeLists.txt') }}
+ restore-keys: |
+ ${{ matrix.tag }}-${{ matrix.compiler }}-
+ - name: Build and test
+ timeout-minutes: 80
+ run: |
+ docker run --rm \
+ -v ${{ github.workspace }}:/home/nebula \
+ -e CCACHE_DIR=/home/nebula/.cache/ccache \
+ --entrypoint ./ci/scripts/build-and-test-${{ matrix.compiler }}.sh \
+ vesoft/nebula-dev:${{ matrix.tag }}
diff --git a/.gitignore b/.gitignore
index e33d1fc205a..5019ebaace5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,8 +9,9 @@ _build.log
_install
install_manifest.txt
-# ccls
+# lsp
.ccls
+.ccls-cache
compile_commands.json
src/common/base/Base.h.gch
@@ -37,3 +38,4 @@ pids/
cmake-build-debug/
cmake-build-release/
.vscode/
+.ccache/
diff --git a/README.md b/README.md
index 6893a6eaa00..f9f650beb71 100644
--- a/README.md
+++ b/README.md
@@ -7,7 +7,7 @@
-
+
diff --git a/ci/scripts/build-and-test-clang.sh b/ci/scripts/build-and-test-clang.sh
new file mode 100755
index 00000000000..6bef8d4d373
--- /dev/null
+++ b/ci/scripts/build-and-test-clang.sh
@@ -0,0 +1,17 @@
+#!/usr/bin/env bash
+#
+# Copyright (c) 2019 vesoft inc. All rights reserved.
+#
+# This source code is licensed under Apache 2.0 License,
+# attached with Common Clause Condition 1.0, found in the LICENSES directory.
+
+set -ex
+
+export NEBULA_DEP_BIN=/opt/nebula/third-party/bin
+export LIBRARY_PATH=/usr/lib/x86_64-linux-gnu:/lib/x86_64-linux-gnu:${LIBRARY_PATH}
+
+mkdir -p build && cd build
+
+${NEBULA_DEP_BIN}/cmake -DCMAKE_CXX_COMPILER=clang++-8 -DCMAKE_C_COMPILER=clang-8 -DENABLE_ASAN=on -DENABLE_UBSAN=on ..
+make -j $(nproc)
+${NEBULA_DEP_BIN}/ctest -j $(nproc) --output-on-failure
diff --git a/ci/scripts/build-and-test-gcc.sh b/ci/scripts/build-and-test-gcc.sh
new file mode 100755
index 00000000000..a4f73f5b2e2
--- /dev/null
+++ b/ci/scripts/build-and-test-gcc.sh
@@ -0,0 +1,17 @@
+#!/usr/bin/env bash
+#
+# Copyright (c) 2019 vesoft inc. All rights reserved.
+#
+# This source code is licensed under Apache 2.0 License,
+# attached with Common Clause Condition 1.0, found in the LICENSES directory.
+
+set -ex
+
+export NEBULA_DEP_BIN=/opt/nebula/third-party/bin
+export LIBRARY_PATH=/usr/lib/x86_64-linux-gnu:/lib/x86_64-linux-gnu:${LIBRARY_PATH}
+
+mkdir -p build && cd build
+
+${NEBULA_DEP_BIN}/cmake -DCMAKE_C_COMPILER=${NEBULA_DEP_BIN}/gcc -DCMAKE_CXX_COMPILER=${NEBULA_DEP_BIN}/g++ -DCMAKE_BUILD_TYPE=Release ..
+make -j $(nproc)
+${NEBULA_DEP_BIN}/ctest -j $(nproc) --output-on-failure
diff --git a/docker/Dockerfile.graphd b/docker/Dockerfile.graphd
index eadfb6dcae1..6e73b53f451 100644
--- a/docker/Dockerfile.graphd
+++ b/docker/Dockerfile.graphd
@@ -19,8 +19,4 @@ RUN rpm -ivh *.rpm \
EXPOSE 3699 13000 13002
-ENTRYPOINT ["./bin/nebula-graphd", \
- "--flagfile=./etc/nebula-graphd.conf", \
- "--daemonize=false", \
- "--v=0", \
- "--minloglevel=2"]
+ENTRYPOINT ["./bin/nebula-graphd", "--flagfile=./etc/nebula-graphd.conf", "--daemonize=false"]
diff --git a/docker/Dockerfile.metad b/docker/Dockerfile.metad
index 8d8f644dc16..43e7f69d973 100644
--- a/docker/Dockerfile.metad
+++ b/docker/Dockerfile.metad
@@ -19,8 +19,4 @@ RUN rpm -ivh *.rpm \
EXPOSE 45500 45501 11000 11002
-ENTRYPOINT ["./bin/nebula-metad", \
- "--flagfile=./etc/nebula-metad.conf", \
- "--daemonize=false", \
- "--v=0", \
- "--minloglevel=2"]
+ENTRYPOINT ["./bin/nebula-metad", "--flagfile=./etc/nebula-metad.conf", "--daemonize=false"]
diff --git a/docker/Dockerfile.storaged b/docker/Dockerfile.storaged
index e651904abb9..56b86355aab 100644
--- a/docker/Dockerfile.storaged
+++ b/docker/Dockerfile.storaged
@@ -19,8 +19,4 @@ RUN rpm -ivh *.rpm \
EXPOSE 44500 44501 12000 12002
-ENTRYPOINT ["./bin/nebula-storaged", \
- "--flagfile=./etc/nebula-storaged.conf", \
- "--daemonize=false", \
- "--v=0", \
- "--minloglevel=2"]
+ENTRYPOINT ["./bin/nebula-storaged", "--flagfile=./etc/nebula-storaged.conf", "--daemonize=false"]