Skip to content

Commit a8c0226

Browse files
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
1 parent 85926ce commit a8c0226

File tree

2 files changed

+22
-11
lines changed

2 files changed

+22
-11
lines changed

.github/workflows/other-os-build.yml

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ on:
2121
description: 'The branch, tag or SHA to checkout, otherwise use the branch'
2222
required: false
2323
default: ''
24+
ZETASQL_LIB_URL:
25+
description: 'zetasql lib url, default is built by src, if you want to use prebuilt, set it. Only for centos6'
26+
required: false
27+
default: ''
2428

2529
env:
2630
NPROC: 2 # default Parallel build number for GitHub's Linux runner
@@ -35,6 +39,7 @@ jobs:
3539
OS: linux
3640
SQL_JAVASDK_ENABLE: ${{ github.event.inputs.JAVA_SDK }}
3741
SQL_PYSDK_ENABLE: ${{ github.event.inputs.PYTHON_SDK }} # python whl will be built when make, no prerequirement
42+
ZETASQL_LIB_URL: ${{ github.event.inputs.ZETASQL_LIB_URL }}
3843
TESTING_ENABLE: OFF
3944
NPROC: 8
4045
steps:
@@ -46,7 +51,8 @@ jobs:
4651
- name: prepare release
4752
run: |
4853
VERSION="snapshot"
49-
TAG=$(git tag -l | grep $(git describe HEAD))
54+
# if not tag, return error, just ignore it to use snapshot as the version
55+
TAG=$(git tag -l | grep $(git describe HEAD)) || true
5056
if [[ "${TAG}" == "v"* ]]; then
5157
VERSION=${TAG#v}
5258
bash steps/prepare_release.sh "$VERSION"
@@ -74,7 +80,7 @@ jobs:
7480
- uses: addnab/docker-run-action@v3
7581
with:
7682
image: ghcr.io/4paradigm/centos6_gcc7_hybridsql
77-
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 }}
83+
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 }}
7884
shell: bash
7985
run: |
8086
cd /root/OpenMLDB
@@ -89,6 +95,10 @@ jobs:
8995
# 5.8G ./.deps, avail 8G
9096
rm -rf .deps/build # GitHub runner disk space is limited
9197
fi
98+
if [[ "${ZETASQL_LIB_URL}" != "" ]]; then
99+
echo "replace zetasql lib by ${ZETASQL_LIB_URL}"
100+
curl -SLo .deps/usr/lib/libzetasql.a ${ZETASQL_LIB_URL}
101+
fi
92102
echo "build"
93103
# 1.4G ./.deps, avail 13G
94104
@@ -172,7 +182,7 @@ jobs:
172182
run: |
173183
VERSION="snapshot"
174184
# use repo ref not event ref
175-
TAG=$(git tag -l | grep $(git describe HEAD))
185+
TAG=$(git tag -l | grep $(git describe HEAD)) || true
176186
if [[ "${TAG}" == "v"* ]]; then
177187
VERSION=${TAG#v}
178188
bash steps/prepare_release.sh "$VERSION"
@@ -242,7 +252,7 @@ jobs:
242252
- name: prepare release
243253
run: |
244254
VERSION="snapshot"
245-
TAG=$(git tag -l | grep $(git describe HEAD))
255+
TAG=$(git tag -l | grep $(git describe HEAD)) || true
246256
if [[ "${TAG}" == "v"* ]]; then
247257
VERSION=${TAG#v}
248258
bash steps/prepare_release.sh "$VERSION"

steps/centos6_build.sh

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,21 +37,22 @@ function tool_install() {
3737
chmod +x bazel
3838
}
3939

40-
if [ "$USE_DEPS_CACHE" == "true" ]; then
41-
echo "use deps cache, exit"
42-
exit 0
43-
else
44-
echo "not use deps cache, install tools and build deps"
45-
fi
46-
4740
if [ "$IN_WORKFLOW" == "true" ]; then
4841
echo "in workflow"
4942
else
5043
echo "in self build"
5144
fi
5245

46+
echo "always install tools"
5347
tool_install
5448

49+
if [ "$USE_DEPS_CACHE" == "true" ]; then
50+
echo "use deps cache, exit"
51+
exit 0
52+
else
53+
echo "no deps cache, build deps"
54+
fi
55+
5556
echo "set envs, if IN_WORKFLOW, you should set envs in workflow"
5657
new_path=$PATH:$(pwd)
5758
export PATH=$new_path

0 commit comments

Comments
 (0)