Skip to content

Commit

Permalink
build: support build on no tag (4paradigm#3641)
Browse files Browse the repository at this point in the history
* build: support build on no tag

* install tool when hit cache in centos6_build.sh

* add zetasql lib url
  • Loading branch information
vagetablechicken committed Dec 4, 2023
1 parent 85926ce commit a8c0226
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
18 changes: 14 additions & 4 deletions .github/workflows/other-os-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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:
Expand All @@ -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"
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
15 changes: 8 additions & 7 deletions steps/centos6_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a8c0226

Please sign in to comment.