From a8c02264e22a99841cf70901141a755bb727dd01 Mon Sep 17 00:00:00 2001 From: HuangWei Date: Mon, 4 Dec 2023 17:09:49 +0800 Subject: [PATCH] build: support build on no tag (#3641) * build: support build on no tag * install tool when hit cache in centos6_build.sh * add zetasql lib url --- .github/workflows/other-os-build.yml | 18 ++++++++++++++---- steps/centos6_build.sh | 15 ++++++++------- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/.github/workflows/other-os-build.yml b/.github/workflows/other-os-build.yml index aa63c3cc19a..be7e090821d 100644 --- a/.github/workflows/other-os-build.yml +++ b/.github/workflows/other-os-build.yml @@ -21,6 +21,10 @@ on: description: 'The branch, tag or SHA to checkout, otherwise use the branch' required: false default: '' + ZETASQL_LIB_URL: + description: 'zetasql lib url, default is built by src, if you want to use prebuilt, set it. Only for centos6' + required: false + default: '' env: NPROC: 2 # default Parallel build number for GitHub's Linux runner @@ -35,6 +39,7 @@ jobs: OS: linux SQL_JAVASDK_ENABLE: ${{ github.event.inputs.JAVA_SDK }} SQL_PYSDK_ENABLE: ${{ github.event.inputs.PYTHON_SDK }} # python whl will be built when make, no prerequirement + ZETASQL_LIB_URL: ${{ github.event.inputs.ZETASQL_LIB_URL }} TESTING_ENABLE: OFF NPROC: 8 steps: @@ -46,7 +51,8 @@ jobs: - name: prepare release run: | VERSION="snapshot" - TAG=$(git tag -l | grep $(git describe HEAD)) + # if not tag, return error, just ignore it to use snapshot as the version + TAG=$(git tag -l | grep $(git describe HEAD)) || true if [[ "${TAG}" == "v"* ]]; then VERSION=${TAG#v} bash steps/prepare_release.sh "$VERSION" @@ -74,7 +80,7 @@ jobs: - uses: addnab/docker-run-action@v3 with: image: ghcr.io/4paradigm/centos6_gcc7_hybridsql - options: -v ${{ github.workspace }}:/root/OpenMLDB -e USE_DEPS_CACHE=${{ steps.deps-cache.outputs.cache-hit }} -e OPENMLDB_PREFIX=${{ env.OPENMLDB_PREFIX }} -e SQL_PYSDK_ENABLE=${{ env.SQL_PYSDK_ENABLE }} -e SQL_JAVASDK_ENABLE=${{ env.SQL_JAVASDK_ENABLE }} + options: -v ${{ github.workspace }}:/root/OpenMLDB -e USE_DEPS_CACHE=${{ steps.deps-cache.outputs.cache-hit }} -e OPENMLDB_PREFIX=${{ env.OPENMLDB_PREFIX }} -e SQL_PYSDK_ENABLE=${{ env.SQL_PYSDK_ENABLE }} -e SQL_JAVASDK_ENABLE=${{ env.SQL_JAVASDK_ENABLE }} -e ZETASQL_LIB_URL=${{ env.ZETASQL_LIB_URL }} shell: bash run: | cd /root/OpenMLDB @@ -89,6 +95,10 @@ jobs: # 5.8G ./.deps, avail 8G rm -rf .deps/build # GitHub runner disk space is limited fi + if [[ "${ZETASQL_LIB_URL}" != "" ]]; then + echo "replace zetasql lib by ${ZETASQL_LIB_URL}" + curl -SLo .deps/usr/lib/libzetasql.a ${ZETASQL_LIB_URL} + fi echo "build" # 1.4G ./.deps, avail 13G @@ -172,7 +182,7 @@ jobs: run: | VERSION="snapshot" # use repo ref not event ref - TAG=$(git tag -l | grep $(git describe HEAD)) + TAG=$(git tag -l | grep $(git describe HEAD)) || true if [[ "${TAG}" == "v"* ]]; then VERSION=${TAG#v} bash steps/prepare_release.sh "$VERSION" @@ -242,7 +252,7 @@ jobs: - name: prepare release run: | VERSION="snapshot" - TAG=$(git tag -l | grep $(git describe HEAD)) + TAG=$(git tag -l | grep $(git describe HEAD)) || true if [[ "${TAG}" == "v"* ]]; then VERSION=${TAG#v} bash steps/prepare_release.sh "$VERSION" diff --git a/steps/centos6_build.sh b/steps/centos6_build.sh index b5cee80838f..780d64c7ac6 100644 --- a/steps/centos6_build.sh +++ b/steps/centos6_build.sh @@ -37,21 +37,22 @@ function tool_install() { chmod +x bazel } -if [ "$USE_DEPS_CACHE" == "true" ]; then - echo "use deps cache, exit" - exit 0 -else - echo "not use deps cache, install tools and build deps" -fi - if [ "$IN_WORKFLOW" == "true" ]; then echo "in workflow" else echo "in self build" fi +echo "always install tools" tool_install +if [ "$USE_DEPS_CACHE" == "true" ]; then + echo "use deps cache, exit" + exit 0 +else + echo "no deps cache, build deps" +fi + echo "set envs, if IN_WORKFLOW, you should set envs in workflow" new_path=$PATH:$(pwd) export PATH=$new_path