Skip to content

Commit

Permalink
Fix action workflow and Dockerfile (vesoft-inc#114)
Browse files Browse the repository at this point in the history
* Fix pull request

* Fix dockerfile

* improve defaults

* Improve diff files

* Remove common package
  • Loading branch information
yixinglu authored Aug 18, 2020
1 parent 0913c46 commit aac2da3
Show file tree
Hide file tree
Showing 12 changed files with 45 additions and 83 deletions.
3 changes: 3 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@ install_manifest.txt

# ccls
.ccls
.ccls-cache
compile_commands.json

.ccache

src/common/base/Base.h.gch
gen-*

Expand Down
28 changes: 12 additions & 16 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,39 +7,38 @@ on:
- master
- 'v[0-9]+.*'

defaults:
run:
shell: bash

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 }}
has_source_files: ${{ steps.filter-source-files.outputs.has_source_files }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 2
- uses: jitterbit/get-changed-files@v1
id: diff
- 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)
.linters/cpp/pre-commit.sh ${{ steps.diff.outputs.all }}
- 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}"
source_files=$(echo ${{ steps.diff.outputs.all }} | sed 's/ /\n/g' | grep '^src\|^CMakeLists.txt\|^cmake\|^.github/workflows' || true)
echo "::set-output name=has_source_files::$([[ "$source_files" == "" ]] && echo 0 || echo 1)"
build:
name: build
needs: lint
if: ${{ needs.lint.outputs.num_source_files != 0 }}
if: ${{ needs.lint.outputs.has_source_files != 0 }}
runs-on: self-hosted
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
Expand All @@ -60,7 +59,6 @@ jobs:
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
Expand All @@ -70,12 +68,11 @@ jobs:
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 }}
token: ${{ github.token }}
path: modules/common
- name: CMake
run: |
Expand Down Expand Up @@ -123,7 +120,6 @@ jobs:
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/
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ add_definitions(-DNEBULA_HOME=${CMAKE_SOURCE_DIR})

# Submodules
if("${NEBULA_COMMON_REPO_URL}" STREQUAL "")
SET(NEBULA_COMMON_REPO_URL "git@github.com:vesoft-inc-private/nebula-common.git")
SET(NEBULA_COMMON_REPO_URL "https://github.com/vesoft-inc/nebula-common.git")
endif()

if("${NEBULA_COMMON_REPO_TAG}" STREQUAL "")
Expand Down
18 changes: 0 additions & 18 deletions docker/Dockerfile.console

This file was deleted.

23 changes: 0 additions & 23 deletions docker/Dockerfile.graph

This file was deleted.

3 changes: 1 addition & 2 deletions docker/Dockerfile.metad
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ RUN cd /home/nebula/BUILD/package \

FROM centos:7

COPY --from=builder /home/nebula/BUILD/build/nebula-graph-*-Linux-common.rpm /usr/local/nebula/nebula-common.rpm
COPY --from=builder /home/nebula/BUILD/build/nebula-graph-*-Linux-meta.rpm /usr/local/nebula/nebula-metad.rpm
COPY --from=builder /home/nebula/BUILD/build/cpack_output/nebula-storage-*.el7.x86-meta.rpm /usr/local/nebula/nebula-metad.rpm

WORKDIR /usr/local/nebula

Expand Down
3 changes: 1 addition & 2 deletions docker/Dockerfile.storaged
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ RUN cd /home/nebula/BUILD/package \

FROM centos:7

COPY --from=builder /home/nebula/BUILD/build/nebula-graph-*-Linux-common.rpm /usr/local/nebula/nebula-common.rpm
COPY --from=builder /home/nebula/BUILD/build/nebula-graph-*-Linux-storage.rpm /usr/local/nebula/nebula-storaged.rpm
COPY --from=builder /home/nebula/BUILD/build/cpack_output/nebula-storage-*.el7.x86-storage.rpm /usr/local/nebula/nebula-storaged.rpm

WORKDIR /usr/local/nebula

Expand Down
4 changes: 0 additions & 4 deletions docker/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
# Docker Files for Nebula Graph Services

> **NOTE**: The `Dockerfile.graph` is used to build docker image only for **testing** in local machine since all of **Nebula Graph** services are installed in same image. This is not recommended practice for docker usage.
Following docker images will be ready in production.

- [vesoft/nebula-graphd](https://hub.docker.com/r/vesoft/nebula-graphd): nebula-graphd service built with `Dockerfile.graphd`
- [vesoft/nebula-metad](https://hub.docker.com/r/vesoft/nebula-metad): nebula-metad service built with `Dockerfile.metad`
- [vesoft/nebula-storaged](https://hub.docker.com/r/vesoft/nebula-storaged): nebula-storaged service built with `Dockerfile.storaged`
- [vesoft/nebula-console](https://hub.docker.com/r/vesoft/nebula-console): nebula console client built with `Dockerfile.console`
12 changes: 0 additions & 12 deletions docker/build-images.sh

This file was deleted.

20 changes: 17 additions & 3 deletions package/package.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
#!/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.

#
# Package nebula as deb/rpm package
#
Expand All @@ -10,13 +16,13 @@
# usage: ./package.sh -v <version> -n <ON/OFF> -s <TRUE/FALSE>
#

set -ex
set -e

version=""
package_one=ON
strip_enable="FALSE"
usage="Usage: ${0} -v <version> -n <ON/OFF> -s <TRUE/FALSE>"
PROJECT_DIR="$(cd "$(dirname "$0")" && pwd)"/../
PROJECT_DIR="$(cd "$(dirname "$0")" && pwd)/.."
enablesanitizer="OFF"
build_type="Release"

Expand Down Expand Up @@ -76,7 +82,15 @@ function build {

pushd ${build_dir}

cmake -DCMAKE_BUILD_TYPE=${build_type} -DNEBULA_BUILD_VERSION=${version} -DENABLE_ASAN=${san} --DENABLE_UBSAN=${san} -DCMAKE_INSTALL_PREFIX=/usr/local/nebula -DENABLE_TESTING=OFF -DENABLE_PACK_ONE=${package_one} $PROJECT_DIR
cmake \
-DCMAKE_BUILD_TYPE=${build_type} \
-DNEBULA_BUILD_VERSION=${version} \
-DENABLE_ASAN=${san} \
-DENABLE_UBSAN=${san} \
-DCMAKE_INSTALL_PREFIX=/usr/local/nebula \
-DENABLE_TESTING=OFF \
-DENABLE_PACK_ONE=${package_one} \
$PROJECT_DIR

if !( make -j$(nproc) ); then
echo ">>> build nebula failed <<<"
Expand Down
6 changes: 5 additions & 1 deletion package/postinst
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
#!/bin/bash
#
# Copyright (c) 2020 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.

install_dir=/usr/local/nebula
daemons=(metad storaged)
Expand All @@ -8,4 +13,3 @@ do
cp ${install_dir}/etc/nebula-${daemon}.conf.default ${install_dir}/etc/nebula-${daemon}.conf
fi
done

6 changes: 5 additions & 1 deletion package/rpm_postinst
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
#!/bin/bash
#
# Copyright (c) 2020 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.

daemons=(metad storaged)
for daemon in ${daemons[@]}
Expand All @@ -7,4 +12,3 @@ do
cp $RPM_INSTALL_PREFIX/etc/nebula-${daemon}.conf.default $RPM_INSTALL_PREFIX/etc/nebula-${daemon}.conf
fi
done

0 comments on commit aac2da3

Please sign in to comment.