diff --git a/.github/workflows/buildbase/action.yml b/.github/workflows/buildbase/action.yml new file mode 100644 index 000000000..1ca32c494 --- /dev/null +++ b/.github/workflows/buildbase/action.yml @@ -0,0 +1,31 @@ +name: "Build base" + +inputs: + save_cache: + description: 'whether to save ccache to github action cache' + required: true + os: + description: 'which runner os to run this build action' + required: true + +runs: + using: "composite" + steps: + - name: Build init + shell: bash + run: | + bash build.sh init + echo "$GITHUB_WORKSPACE/deps/3rd/usr/local/oceanbase/devtools/bin" >> $GITHUB_PATH + + - name: Setup ccache + uses: hendrikmuhs/ccache-action@v1.2 + with: + max-size: 10G + save: ${{inputs.save_cache}} + key: ${{inputs.os}} + + - name: Build project + shell: bash + run: | + bash build.sh debug -DOB_USE_CCACHE=ON + cd build_debug && make -j4 diff --git a/.github/workflows/compile.yml b/.github/workflows/compile.yml index 42d7c3119..44642eae6 100644 --- a/.github/workflows/compile.yml +++ b/.github/workflows/compile.yml @@ -25,16 +25,13 @@ jobs: with: key: ${{ runner.os }}-build-${{ env.cache-name }}-el7.x86_64-${{ hashFiles('deps/init/oceanbase.el7.x86_64.deps') }} path: deps/3rd - - - name: Build init - run: bash build.sh init - - - name: Build project - shell: bash - run: | - bash build.sh debug - cd build_debug && make -j4 - + + - name: Build + uses: ./.github/workflows/buildbase + with: + save_cache: ${{github.event_name == 'push'}} + os: 'centos7' + ubuntu-build: runs-on: ubuntu-22.04 steps: @@ -55,12 +52,9 @@ jobs: with: key: ${{ runner.os }}-build-${{ env.cache-name }}-el9.x86_64-${{ hashFiles('deps/init/oceanbase.el9.x86_64.deps') }} path: deps/3rd - - - name: Build init - run: bash build.sh init - - - name: Build project - shell: bash - run: | - bash build.sh debug - cd build_debug && make -j4 + + - name: Build + uses: ./.github/workflows/buildbase + with: + save_cache: ${{github.event_name == 'push'}} + os: 'ubuntu22'