Skip to content

Commit

Permalink
chore: ci optimize check coding format (OpenAtomFoundation#74)
Browse files Browse the repository at this point in the history
  • Loading branch information
baerwang authored Dec 7, 2023
1 parent d13e984 commit b4608ee
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 13 deletions.
28 changes: 15 additions & 13 deletions .github/workflows/pikiwidb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,29 @@ on:
branches: [ "unstable" ]

jobs:
build_on_macos:
runs-on: macos-latest
check_format:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Install Deps
run: |
brew install clang-format
- name: Build
run: |
sh build.sh
run: bash ci/build.sh

- name: Check Format
working-directory: ${{ github.workspace }}/build
run: make check-format

build_on_macos:
runs-on: macos-latest
needs: check_format

steps:
- uses: actions/checkout@v4

- name: Build
run: |
make check-format
sh build.sh
- name: GTest
working-directory: ${{ github.workspace }}/build
Expand All @@ -33,6 +38,7 @@ jobs:

build_on_ubuntu:
runs-on: ubuntu-latest
needs: check_format

steps:
- uses: actions/checkout@v4
Expand All @@ -41,10 +47,6 @@ jobs:
run: |
bash build.sh
- name: Check Format
working-directory: ${{ github.workspace }}/build
run: make check-format

- name: GTest
working-directory: ${{ github.workspace }}/build
# Execute tests defined by the CMake configuration.
Expand Down
27 changes: 27 additions & 0 deletions ci/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash

BUILD_TIME=$(git log -1 --format=%ai)
BUILD_TIME=${BUILD_TIME: 0: 10}

COMMIT_ID=$(git rev-parse HEAD)
SHORT_COMMIT_ID=${COMMIT_ID: 0: 8}

BUILD_TYPE=release
VERBOSE=0
CMAKE_FLAGS=""
MAKE_FLAGS=""
PREFIX="build"

if [ -z "$SHORT_COMMIT_ID" ]; then
echo "no git commit id"
SHORT_COMMIT_ID="pikiwidb"
fi

echo "BUILD_TIME:" $BUILD_TIME
echo "COMMIT_ID:" $SHORT_COMMIT_ID

echo "BUILD_TYPE:" $BUILD_TYPE
echo "CMAKE_FLAGS:" $CMAKE_FLAGS
echo "MAKE_FLAGS:" $MAKE_FLAGS

cmake -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DBUILD_TIME=$BUILD_TIME -DGIT_COMMIT_ID=$SHORT_COMMIT_ID ${CMAKE_FLAGS} -S . -B ${PREFIX}

0 comments on commit b4608ee

Please sign in to comment.