fix(workflow): ci/cd failure #8184
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# OpenMLDB core cpp jobs | |
name: cicd | |
on: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- 'docs/**' | |
- 'demo/**' | |
- 'docker/**' | |
- 'image/**' | |
- 'release/**' | |
- 'tools/**' | |
- '*.md' | |
- 'benchmark/**' | |
tags: | |
- v* | |
pull_request: | |
paths-ignore: | |
- 'docs/**' | |
- 'demo/**' | |
- 'docker/**' | |
- 'image/**' | |
- 'release/**' | |
- 'tools/**' | |
- '*.md' | |
- 'benchmark/**' | |
workflow_dispatch: | |
env: | |
GIT_SUBMODULE_STRATEGY: recursive | |
NPROC: 2 # default Parallel build number for GitHub's Linux runner | |
EXAMPLES_ENABLE: OFF # turn off hybridse's example code | |
HYBRIDSE_TESTING_ENABLE: OFF # turn off hybridse's test code | |
jobs: | |
cpp: | |
runs-on: [self-hosted,generic] | |
if: github.repository == '4paradigm/OpenMLDB' | |
container: | |
image: ghcr.io/4paradigm/hybridsql:latest | |
env: | |
ACTIONS_RUNNER_FORCE_ACTIONS_NODE_VERSION: node16 | |
ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true | |
OS: linux | |
SQL_PYSDK_ENABLE: OFF | |
TESTING_ENABLE: ON | |
NPROC: 8 | |
CTEST_PARALLEL_LEVEL: 1 # parallel test level for ctest (make test) | |
steps: | |
- uses: actions/checkout@v2 | |
- name: prepare release | |
run: | | |
VERSION="snapshot" | |
if [[ ${{ github.ref }} == "refs/tags/v"* ]]; then | |
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | |
VERSION=${VERSION#v} | |
bash steps/prepare_release.sh "$VERSION" | |
fi | |
echo "OPENMLDB_PREFIX=openmldb-$VERSION-linux" >> $GITHUB_ENV | |
- name: enable java on release | |
if: github.event_name == 'push' | |
run: | | |
echo "SQL_JAVASDK_ENABLE=ON" >> $GITHUB_ENV | |
- name: configure | |
env: | |
SQL_JAVASDK_ENABLE: ${{ env.SQL_JAVASDK_ENABLE }} | |
run: | | |
make configure CMAKE_INSTALL_PREFIX=${{ env.OPENMLDB_PREFIX }} | |
- name: build | |
run: | | |
make build | |
# GitHub runner disk space is limited | |
# delete thirdparty build directory($ROOT/.deps/) to save disk space | |
# make thirdpartybuild-clean | |
- name: run cpp | |
id: unittest | |
run: | | |
make test | |
- name: run sql_router_test | |
id: sql_router_test | |
run: | | |
bash steps/ut.sh sql_router_test 0 | |
- name: run sql_sdk_test | |
id: sql_sdk_test | |
run: | | |
bash steps/ut.sh sql_sdk_test 0 | |
- name: run sql_cluster_test | |
id: sql_cluster_test | |
run: | | |
bash steps/ut.sh sql_cluster_test 0 | |
- name: run sql_standalone_sdk_test | |
id: sql_standalone_sdk_test | |
run: | | |
bash steps/ut.sh sql_standalone_sdk_test 0 | |
- name: upload unit test results | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: linux-ut-result-cpp-${{ github.sha }} | |
# exclude _deps xml | |
path: | | |
build/**/*.xml | |
reports/*.xml | |
!build/_deps/* | |
- name: install | |
if: ${{ github.event_name == 'push' }} | |
run: | | |
make install | |
- name: package | |
if: ${{ github.event_name == 'push' }} | |
run: | | |
tar czf ${{ env.OPENMLDB_PREFIX }}.tar.gz ${{ env.OPENMLDB_PREFIX }}/ | |
- name: upload artifacts | |
if: ${{ github.event_name == 'push' }} | |
uses: actions/upload-artifact@v4 | |
with: | |
path: openmldb-*.tar.gz | |
name: release-artifacts | |
publish-test-results: | |
needs: [ "cpp" ] | |
# the action will only run on 4paradigm/OpenMLDB's context, not for fork repo or dependabot | |
if: > | |
always() && github.event_name == 'push' || ( | |
github.event.pull_request.head.repo.full_name == github.repository && | |
github.event.sender.login != 'dependabot[bot]' ) | |
name: Publish Linux UT Results | |
uses: ./.github/workflows/publish-test-results-action.yml | |
with: | |
files: linux-ut-result-*/**/*.xml | |
check_name: Linux Test Report | |
comment_title: Linux Test Report | |
macos-cpp: | |
runs-on: macos-12 | |
if: github.repository == '4paradigm/OpenMLDB' | |
env: | |
OS: darwin | |
ARCH: x86_64 | |
NPROC: 3 | |
CTEST_PARALLEL_LEVEL: 1 # parallel test level for ctest (make test) | |
steps: | |
- uses: actions/checkout@v4 | |
# target on macOS >= 12.0 | |
- name: Xcode Select Version | |
uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: '14.0.1' | |
- name: prepare release | |
run: | | |
VERSION="snapshot" | |
if [[ ${{ github.ref }} == "refs/tags/v"* ]]; then | |
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | |
VERSION=${VERSION#v} | |
bash steps/prepare_release.sh "$VERSION" | |
fi | |
echo "OPENMLDB_PREFIX=openmldb-$VERSION-darwin" >> $GITHUB_ENV | |
- name: enable java on release | |
if: ${{ github.event_name == 'push' }} | |
run: | | |
echo "SQL_JAVASDK_ENABLE=ON" >> $GITHUB_ENV | |
- name: configure | |
env: | |
SQL_JAVASDK_ENABLE: ${{ env.SQL_JAVASDK_ENABLE }} | |
run: | | |
make configure CMAKE_INSTALL_PREFIX=${{ env.OPENMLDB_PREFIX }} | |
- name: build | |
run: | | |
# even gnu binutils support ar -M script, get error `ar: BFD (GNU Binutils) 2.40 assertion fail archive.c:1813` | |
# brew install binutils | |
# export PATH="/usr/local/opt/binutils/bin:$PATH" | |
make build | |
# GitHub runner disk space is limited | |
# delete thirdparty build directory($ROOT/.deps/) to save disk space | |
# make thirdpartybuild-clean | |
- name: install | |
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') }} | |
run: | | |
make install | |
- name: package | |
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') }} | |
run: | | |
tar czf ${{ env.OPENMLDB_PREFIX }}.tar.gz ${{ env.OPENMLDB_PREFIX }}/ | |
- name: upload artifacts | |
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') }} | |
uses: actions/upload-artifact@v4 | |
with: | |
path: openmldb-*.tar.gz | |
name: release-artifacts | |
- name: Upload Event File | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: event-file | |
path: ${{ github.event_path }} | |
release: | |
runs-on: ubuntu-latest | |
# if test failed, shouldn't release | |
needs: [ "cpp", "macos-cpp" ] | |
if: > | |
success() && startsWith(github.ref, 'refs/tags/v') | |
steps: | |
- name: Download Release Artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: release-artifacts | |
- name: generate signature | |
run: | | |
sha256sum openmldb-*.tar.gz > SHA256SUM | |
- name: Release | |
if: ${{ startsWith(github.ref, 'refs/tags/v') }} | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: | | |
openmldb-*.tar.gz | |
SHA256SUM | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |