forked from vesoft-inc/nebula-storage
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replace drone ci with github action (vesoft-inc#105)
* Replace drone ci with github action * Fix source files filter step * Fix common checkout
- Loading branch information
Showing
2 changed files
with
135 additions
and
43 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
name: pull_request | ||
|
||
on: | ||
pull_request: | ||
types: [synchronize, reopened, labeled] | ||
branches: | ||
- master | ||
- 'v[0-9]+.*' | ||
|
||
jobs: | ||
lint: | ||
name: lint | ||
if: ${{ contains(github.event.pull_request.labels.*.name, 'ready-for-testing') }} | ||
runs-on: ubuntu-latest | ||
defaults: | ||
run: | ||
shell: bash | ||
outputs: | ||
num_source_files: ${{ steps.filter-source-files.outputs.num_source_files }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 2 | ||
- name: Cpplint | ||
run: | | ||
ln -snf $PWD/.linters/cpp/hooks/pre-commit.sh $PWD/.linters/cpp/pre-commit.sh | ||
.linters/cpp/pre-commit.sh $(git --no-pager diff --diff-filter=d --name-only HEAD^ HEAD) | ||
- name: Filter source files | ||
id: filter-source-files | ||
run: | | ||
diff_commits=$(git log --oneline -n 1 | cut -d' ' -f1,5) | ||
num_source_files=$(git --no-pager diff --name-only $diff_commits | grep '^src\|^CMakeLists.txt\|^cmake\|^.github/workflows' | wc -l) | ||
echo "::set-output name=num_source_files::${num_source_files}" | ||
build: | ||
name: build | ||
needs: lint | ||
if: ${{ needs.lint.outputs.num_source_files != 0 }} | ||
runs-on: self-hosted | ||
defaults: | ||
run: | ||
shell: bash | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: | ||
- centos7 | ||
- ubuntu1804 | ||
compiler: | ||
- gcc-9.2 | ||
- clang-9 | ||
exclude: | ||
- os: centos7 | ||
compiler: clang-9 | ||
container: | ||
image: vesoft/nebula-dev:${{ matrix.os }} | ||
env: | ||
TOOLSET_DIR: /opt/vesoft/toolset/clang/9.0.0 | ||
CCACHE_DIR: /tmp/ccache/nebula-storage/${{ matrix.os }}-${{ matrix.compiler }} | ||
CCACHE_MAXSIZE: 1G | ||
volumes: | ||
- /tmp/ccache/nebula-storage/${{ matrix.os }}-${{ matrix.compiler }}:/tmp/ccache/nebula-storage/${{ matrix.os }}-${{ matrix.compiler }} | ||
- /run/secrets/GITHUB_PAT:/run/secrets/GITHUB_PAT | ||
options: --mount type=tmpfs,destination=/tmp/ccache/nebula-storage,tmpfs-size=1073741824 --cap-add=SYS_PTRACE | ||
steps: | ||
- uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 1 | ||
- name: Prepare environment | ||
id: prepare | ||
run: | | ||
[ -d build/ ] && rm -rf build/* || mkdir -p build | ||
echo "::set-output name=pat::$(cat /run/secrets/GITHUB_PAT)" | ||
- name: Checkout common | ||
uses: actions/checkout@v2 | ||
with: | ||
repository: ${{ github.repository_owner }}/nebula-common | ||
token: ${{ steps.prepare.outputs.pat }} | ||
path: modules/common | ||
- name: CMake | ||
run: | | ||
case ${{ matrix.compiler }} in | ||
gcc-*) | ||
case ${{ matrix.os }} in | ||
centos7) | ||
# build with Release type | ||
cmake \ | ||
-DCMAKE_CXX_COMPILER=$TOOLSET_DIR/bin/g++ \ | ||
-DCMAKE_C_COMPILER=$TOOLSET_DIR/bin/gcc \ | ||
-DCMAKE_BUILD_TYPE=Release \ | ||
-DENABLE_TESTING=on \ | ||
-DCMAKE_PREFIX_PATH=modules/common \ | ||
-DNEBULA_THIRDPARTY_ROOT=/opt/vesoft/third-party/ \ | ||
-B build | ||
;; | ||
ubuntu1804) | ||
# build with Debug type | ||
cmake \ | ||
-DCMAKE_CXX_COMPILER=$TOOLSET_DIR/bin/g++ \ | ||
-DCMAKE_C_COMPILER=$TOOLSET_DIR/bin/gcc \ | ||
-DCMAKE_BUILD_TYPE=Debug \ | ||
-DENABLE_TESTING=on \ | ||
-DCMAKE_PREFIX_PATH=modules/common \ | ||
-DNEBULA_THIRDPARTY_ROOT=/opt/vesoft/third-party/ \ | ||
-B build | ||
;; | ||
esac | ||
;; | ||
clang-*) | ||
# build with Sanitizer | ||
cmake \ | ||
-DCMAKE_CXX_COMPILER=$TOOLSET_DIR/bin/clang++ \ | ||
-DCMAKE_C_COMPILER=$TOOLSET_DIR/bin/clang \ | ||
-DCMAKE_BUILD_TYPE=Debug \ | ||
-DENABLE_ASAN=on \ | ||
-DENABLE_TESTING=on \ | ||
-DCMAKE_PREFIX_PATH=modules/common \ | ||
-DNEBULA_THIRDPARTY_ROOT=/opt/vesoft/third-party \ | ||
-B build | ||
;; | ||
esac | ||
- name: Make common | ||
run: cmake --build modules/common/ -j $(nproc) | ||
- name: Make storage | ||
run: cmake --build build/ -j $(nproc) | ||
- name: CTest | ||
env: | ||
ASAN_SYMBOLIZER_PATH: $TOOLSET_DIR/bin/llvm-symbolizer | ||
ASAN_OPTIONS: fast_unwind_on_malloc=1 | ||
run: ctest -j $(($(nproc)/2+1)) --timeout 400 --output-on-failure | ||
working-directory: build/ | ||
timeout-minutes: 15 | ||
- name: Cleanup | ||
if: ${{ always() }} | ||
run: rm -rf build modules/common |