build #228
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
name: build | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- v*.*.* | |
pull_request: | |
# allow run workflow manually from a commit | |
# might useful to test pull request in OpenMLDB which changes third-party files | |
workflow_dispatch: | |
inputs: | |
OPENMLDB_REPO: | |
description: OpenMLDB repo url going to fetch, can be a fork | |
required: true | |
default: 4paradigm/OpenMLDB | |
type: string | |
OPENMLDB_REF: | |
description: specific commit/tag SHA | |
required: true | |
type: string | |
UPLOAD: | |
description: upload the built artifact for testing | |
default: false | |
type: boolean | |
env: | |
OPENMLDB_REPO: 4paradigm/OpenMLDB | |
OPENMLDB_REF: cdaf3114904620f5b7a83e3902364eb0f68b91db | |
jobs: | |
thirdparty-linux: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: true | |
matrix: | |
include: | |
- container: ghcr.io/aceforeverd/hybridsql-base:0.4.0 | |
flags: "" | |
distro: centos | |
- container: ubuntu:20.04 | |
flags: -DBUILD_ZOOKEEPER_PATCH=ON | |
distro: ubuntu | |
container: | |
image: ${{ matrix.container }} | |
env: | |
MAKEOPTS: -j2 | |
DISTRO: ${{ matrix.distro }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: setup deps | |
if: startsWith(matrix.container, 'ubuntu') | |
run: | | |
apt update | |
DEBIAN_FRONTEND=noninteractive apt-get install -y bison python3-dev libcppunit-dev build-essential cmake autoconf tcl pkg-config git curl patch libtool-bin | |
- name: setup deps(centos) | |
if: startsWith(matrix.container, 'ghcr') | |
run: | | |
yum install -y patch | |
- name: download thirdparty source | |
uses: actions/checkout@v2 | |
if: github.event_name == 'push' || github.event_name == 'pull_request' | |
with: | |
repository: ${{ env.OPENMLDB_REPO }} | |
ref: ${{ env.OPENMLDB_REF }} | |
path: openmldb | |
- name: download thirdparty source (workflow_dispatch) | |
uses: actions/checkout@v2 | |
if: github.event_name == 'workflow_dispatch' | |
with: | |
repository: ${{ github.event.inputs.OPENMLDB_REPO }} | |
ref: ${{ github.event.inputs.OPENMLDB_REF }} | |
path: openmldb | |
- name: configure | |
run: | | |
cmake -S openmldb/third-party -B deps -DBUILD_BUNDLED=ON -DWITH_ZETASQL=OFF ${{ env.flags }} | |
- name: build | |
run: | | |
cmake --build deps | |
- name: create archive | |
if: startsWith(github.ref, 'refs/tags/v') || (github.event_name == 'workflow_dispatch' && github.event.inputs.UPLOAD == true) | |
run: | | |
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | |
VERSION=${VERSION#v} | |
./pack_all.sh -i deps -n "$VERSION" | |
- name: Upload Artifact | |
if: startsWith(github.ref, 'refs/tags/v') || (github.event_name == 'workflow_dispatch' && github.event.inputs.UPLOAD == true) | |
uses: actions/upload-artifact@v2 | |
with: | |
path: deps/thirdparty-*.tar.gz | |
thirdparty-darwin: | |
runs-on: macos-12 | |
env: | |
MAKEOPTS: -j3 | |
steps: | |
- uses: actions/checkout@v4 | |
# xcode 14.0.1 comes with macOS SDK 12.3, ref https://github.com/actions/runner-images/blob/main/images/macos/macos-12-Readme.md#installed-sdks | |
# so pre-compile zetasql requires macOS >= 12.3 | |
- name: Xcode Select Version | |
uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: '14.0.1' | |
- name: Setup cmake | |
uses: jwlawson/actions-setup-cmake@v2.0 | |
with: | |
cmake-version: "3.20.x" | |
- name: download thirdparty source | |
uses: actions/checkout@v4 | |
if: github.event_name == 'push' || github.event_name == 'pull_request' | |
with: | |
repository: ${{ env.OPENMLDB_REPO }} | |
ref: ${{ env.OPENMLDB_REF }} | |
path: openmldb | |
- name: download thirdparty source (workflow_dispatch) | |
uses: actions/checkout@v4 | |
if: github.event_name == 'workflow_dispatch' | |
with: | |
repository: ${{ github.event.inputs.OPENMLDB_REPO }} | |
ref: ${{ github.event.inputs.OPENMLDB_REF }} | |
path: openmldb | |
- name: Install System Dependencies | |
# coreutils for nproc | |
# gnu-getopt for brpc | |
run: | | |
brew install automake coreutils gnu-getopt | |
- name: configure | |
run: | | |
cmake -S openmldb/third-party -B deps -DBUILD_BUNDLED=ON -DWITH_ZETASQL=OFF ${{ env.flags }} | |
- name: build | |
run: | | |
cmake --build deps | |
- name: verbose minos info | |
run: | | |
otool -l deps/usr/lib/libabsl_base.a | grep -A 20 LC_BUILD_VERSION | |
- name: create archive | |
if: startsWith(github.ref, 'refs/tags/v') || (github.event_name == 'workflow_dispatch' && github.event.inputs.UPLOAD == true) | |
run: | | |
VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') | |
VERSION=${VERSION#v} | |
./pack_all.sh -i deps -n "$VERSION" | |
- name: Upload Artifact | |
if: startsWith(github.ref, 'refs/tags/v') || (github.event_name == 'workflow_dispatch' && github.event.inputs.UPLOAD == true) | |
uses: actions/upload-artifact@v3 | |
with: | |
path: deps/thirdparty-*.tar.gz | |
release: | |
runs-on: ubuntu-latest | |
needs: ["thirdparty-linux", "thirdparty-darwin"] | |
if: startsWith(github.ref, 'refs/tags/v') | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download Artifacts | |
uses: actions/download-artifact@v3 | |
- name: generate signature | |
working-directory: artifact | |
run: | | |
sha256sum third*.tar.gz > SHA256SUM | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: | | |
artifact/thirdparty*.tar.gz | |
artifact/SHA256SUM | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |