From 18572a240a6fe6fad968234a758662ccf855a7b7 Mon Sep 17 00:00:00 2001 From: Xinglu Yee <2520865+yixinglu@users.noreply.github.com> Date: Fri, 17 Jan 2020 21:15:36 +0800 Subject: [PATCH] Add version info to action job and build docker images for release branches (#1654) * Add compiler version for job name * Run docker and package workflow for release branchs * Build release type for PR workflow Co-authored-by: dutor <440396+dutor@users.noreply.github.com> --- .github/workflows/build.yaml | 39 +++++++++++++++++-------- .github/workflows/docker.yaml | 16 ++++++++-- .github/workflows/package.yaml | 19 +++++++++--- .github/workflows/pull_request.yaml | 45 ++++++++++++++++++++++------- 4 files changed, 90 insertions(+), 29 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 4c9ea0406a0..7d6401e149f 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -20,15 +20,15 @@ jobs: - ubuntu1604 - ubuntu1804 compiler: - - gcc - - clang + - gcc-7.5 + - clang-8 exclude: - tag: centos6 - compiler: clang + compiler: clang-8 - tag: centos7 - compiler: clang + compiler: clang-8 - tag: ubuntu1604 - compiler: clang + compiler: clang-8 container: image: vesoft/nebula-dev:${{ matrix.tag }} steps: @@ -37,14 +37,29 @@ jobs: fetch-depth: 1 - name: Prepare environment run: mkdir -p build - - name: CMake with gcc - if: matrix.compiler == 'gcc' - run: cd build && cmake .. - - name: CMake with clang - if: matrix.compiler == 'clang' - run: cd build && cmake -DCMAKE_CXX_COMPILER=clang++-8 -DCMAKE_C_COMPILER=clang-8 -DENABLE_ASAN=on -DNEBULA_CLANG_USE_GCC_TOOLCHAIN=/opt/vesoft/toolset/gcc/7.5.0 .. + - name: CMake with gcc-7.5 + if: matrix.compiler == 'gcc-7.5' + run: | + cd build + cmake -DCMAKE_BUILD_TYPE=Release .. + - name: CMake with clang-8 + if: matrix.compiler == 'clang-8' + run: | + cd build + cmake \ + -DCMAKE_CXX_COMPILER=clang++-8 \ + -DCMAKE_C_COMPILER=clang-8 \ + -DENABLE_ASAN=on \ + -DNEBULA_CLANG_USE_GCC_TOOLCHAIN=/opt/vesoft/toolset/gcc/7.5.0 \ + .. - name: Make run: cd build && make -j $(nproc) - name: CTest with single thread timeout-minutes: 40 - run: cd build && ASAN_SYMBOLIZER_PATH=/usr/bin/llvm-symbolizer ASAN_OPTIONS=fast_unwind_on_malloc=0 ctest --timeout 300 --output-on-failure + run: | + cd build + ASAN_SYMBOLIZER_PATH=/usr/bin/llvm-symbolizer \ + ASAN_OPTIONS=fast_unwind_on_malloc=0 \ + ctest \ + --timeout 300 \ + --output-on-failure diff --git a/.github/workflows/docker.yaml b/.github/workflows/docker.yaml index 3afd2fbb2bd..513a43cf13a 100644 --- a/.github/workflows/docker.yaml +++ b/.github/workflows/docker.yaml @@ -3,6 +3,12 @@ name: docker on: schedule: - cron: '0 18 * * *' + push: + branches: + - 'v[0-9]+*' + paths-ignore: + - 'docs/**' + - '**.md' jobs: docker: @@ -24,9 +30,15 @@ jobs: - uses: actions/checkout@v1 with: fetch-depth: 1 - - name: build nightly image + - name: Compute tag + id: tag + run: | + [[ "${{ github.event_name }}" == "push" ]] && \ + echo "::set-output name=tag::${{ github.ref }}" || \ + echo "::set-output name=tag::nightly" + - name: Build image env: - IMAGE_NAME: ${{ secrets.DOCKER_USERNAME }}/nebula-${{ matrix.service }}:nightly + IMAGE_NAME: ${{ secrets.DOCKER_USERNAME }}/nebula-${{ matrix.service }}:${{ steps.tag.outputs.tag }} run: | docker build -t ${IMAGE_NAME} -f docker/Dockerfile.${{ matrix.service }} . docker push ${IMAGE_NAME} diff --git a/.github/workflows/package.yaml b/.github/workflows/package.yaml index 5aa69b03179..8bb44252c0f 100644 --- a/.github/workflows/package.yaml +++ b/.github/workflows/package.yaml @@ -3,6 +3,12 @@ name: package on: schedule: - cron: '0 18 * * *' + push: + branches: + - 'v[0-9]+*' + paths-ignore: + - 'docs/**' + - '**.md' jobs: package: @@ -19,11 +25,16 @@ jobs: image: vesoft/nebula-dev:${{ matrix.os }} steps: - uses: actions/checkout@v1 - - name: package + - name: Package run: ./package/package.sh shell: bash - - name: Upload nightly artifacts - uses: actions/upload-artifact@v1 + - name: Compute version + id: version + run: | + [[ "${{ github.event_name }}" == "push" ]] && \ + echo "::set-output name=version::${{ github.ref }}" || \ + echo "::set-output name=version::nightly" + - uses: actions/upload-artifact@v1 with: - name: ${{ matrix.os }}-nightly + name: ${{ matrix.os }}-${{ steps.version.outputs.version }} path: build/cpack_output diff --git a/.github/workflows/pull_request.yaml b/.github/workflows/pull_request.yaml index d363b02d3e9..998e93975d0 100644 --- a/.github/workflows/pull_request.yaml +++ b/.github/workflows/pull_request.yaml @@ -5,6 +5,7 @@ on: types: [synchronize, reopened, labeled] branches: - master + - 'v[0-9]+*' jobs: lint: @@ -30,11 +31,11 @@ jobs: - centos7 - ubuntu1804 compiler: - - gcc - - clang + - gcc-7.5 + - clang-8 exclude: - tag: centos7 - compiler: clang + compiler: clang-8 container: image: vesoft/nebula-dev:${{ matrix.tag }} env: @@ -53,23 +54,45 @@ jobs: run: | [ -f "$CCACHE_DIR/ccache.conf" ] || cp ci/ccache.conf "$CCACHE_DIR" [ -d build/ ] && rm -rf build/* || mkdir -p build - - name: CMake with gcc - if: matrix.compiler == 'gcc' && steps.ignore_docs.outputs.num_source_files != 0 - run: cd build && cmake .. - - name: CMake with clang - if: matrix.compiler == 'clang' && steps.ignore_docs.outputs.num_source_files != 0 - run: cd build && cmake -DCMAKE_CXX_COMPILER=clang++-8 -DCMAKE_C_COMPILER=clang-8 -DENABLE_ASAN=on -DNEBULA_CLANG_USE_GCC_TOOLCHAIN=/opt/vesoft/toolset/gcc/7.5.0 .. + - name: CMake with gcc-7.5 + if: matrix.compiler == 'gcc-7.5' && steps.ignore_docs.outputs.num_source_files != 0 + run: | + cd build + cmake -DCMAKE_BUILD_TYPE=Release .. + - name: CMake with clang-8 + if: matrix.compiler == 'clang-8' && steps.ignore_docs.outputs.num_source_files != 0 + run: | + cd build + cmake \ + -DCMAKE_CXX_COMPILER=clang++-8 \ + -DCMAKE_C_COMPILER=clang-8 \ + -DENABLE_ASAN=on \ + -DNEBULA_CLANG_USE_GCC_TOOLCHAIN=/opt/vesoft/toolset/gcc/7.5.0 \ + .. - name: Make if: steps.ignore_docs.outputs.num_source_files != 0 run: cd build && make -j $(nproc) - name: CTest with multiple threads if: steps.ignore_docs.outputs.num_source_files != 0 timeout-minutes: 15 - run: cd build && ctest -j 6 --timeout 300 --output-on-failure --rerun-failed + run: | + cd build + ctest \ + -j 6 \ + --timeout 300 \ + --output-on-failure \ + --rerun-failed - name: CTest with single thread if: failure() && steps.ignore_docs.outputs.num_source_files != 0 timeout-minutes: 30 - run: cd build && ASAN_SYMBOLIZER_PATH=/usr/bin/llvm-symbolizer ASAN_OPTIONS=fast_unwind_on_malloc=0 ctest --timeout 300 --output-on-failure --rerun-failed + run: | + cd build + ASAN_SYMBOLIZER_PATH=/usr/bin/llvm-symbolizer \ + ASAN_OPTIONS=fast_unwind_on_malloc=0 \ + ctest \ + --timeout 300 \ + --output-on-failure \ + --rerun-failed - name: Cleanup if: always() run: rm -rf build