Skip to content

Commit

Permalink
Replace drone ci with github action (vesoft-inc#105)
Browse files Browse the repository at this point in the history
* Replace drone ci with github action

* Fix source files filter step

* Fix common checkout
  • Loading branch information
yixinglu authored Aug 7, 2020
1 parent 382b3b5 commit d41e7fc
Show file tree
Hide file tree
Showing 2 changed files with 135 additions and 43 deletions.
43 changes: 0 additions & 43 deletions .drone.yml

This file was deleted.

135 changes: 135 additions & 0 deletions .github/workflows/pull_request.yml
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

0 comments on commit d41e7fc

Please sign in to comment.