Skip to content

Build libcows.so

Build libcows.so #62

Workflow file for this run

name: Build libcows.so
on:
workflow_dispatch:
inputs:
TAG_NAME:
description: 'Release Version Tag'
required: true
REMOTE_BRANCH:
description: 'chdb remote branch (main)'
required: false
release:
types: [created]
jobs:
build_libcows_linux:
name: ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-20.04 ]
env:
RUNNER_OS: ${{ matrix.os }}
steps:
- name: Install clang++ for Ubuntu
if: matrix.os == 'ubuntu-20.04'
run: |
pwd
uname -a
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 17
which clang++-17
clang++-17 --version
sudo apt-get install -y make cmake ccache ninja-build yasm gawk wget
ccache -s
- name: Update git
run: |
sudo add-apt-repository ppa:git-core/ppa -y
sudo apt-get update
sudo apt-get install -y git
git --version
- name: Check out chdb
uses: actions/checkout@v4.0.0
with:
repository: cowsdb/cowsdb
ref: ${{ github.event.inputs.REMOTE_BRANCH || 'chdb' }}
- name: Restore submodules cache
uses: actions/cache/restore@v3
id: cache
with:
path: |
contrib/**
key: |
submodule-x64-${{ hashFiles('.gitmodules') }}
- name: Update submodules if cache miss
if: steps.cache.outputs.cache-hit != 'true'
run: |
git submodule update --init --recursive --jobs 4
- name: Save submodules cache
if: steps.cache.outputs.cache-hit != 'true'
uses: actions/cache/save@v3
with:
path: |
contrib/**
key: |
submodule-x64-${{ hashFiles('.gitmodules') }}
- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ matrix.os }}
max-size: 5G
append-timestamp: true
- name: remove old clang and link clang-17 to clang
if: matrix.os == 'ubuntu-20.04'
run: |
sudo rm /usr/bin/clang
sudo ln -s /usr/bin/clang-17 /usr/bin/clang
sudo rm /usr/bin/clang++
sudo ln -s /usr/bin/clang++-17 /usr/bin/clang++
which clang++
clang++ --version
- name: Override Build Script
run: |
wget https://raw.githubusercontent.com/cowsdb/libcows/main/local_build.sh -O ./chdb/build.sh
- name: Patch
if: matrix.os == 'ubuntu-20.04'
run: |
sudo sed -i "s/\${PYINIT_ENTRY}//g" ./chdb/build.sh
sudo sed -i "s/\# strip \$/strip \$/g" ./chdb/build.sh
sudo sed -i "s/CHDB_PY_MODULE.*/CHDB_PY_MODULE=libcows.so/g" ./chdb/vars.sh
sudo sed -i "s/CHDB_VERSION=.*/CHDB_VERSION=${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }}/g" ./chdb/vars.sh
- name: Install python
uses: actions/setup-python@v4
with:
python-version: "${{ matrix.python-version }}"
- name: Run chdb/build.sh
run: |
python3 -m pip install pybind11
export CC=/usr/bin/clang
export CXX=/usr/bin/clang++
bash ./chdb/build.sh
ls -alFh ./chdb/libcows.so
continue-on-error: false
- name: Check ccache statistics
run: |
ccache -s
ls -lh chdb
df -h
- name: Strip & Compress Library
run: |
sudo strip ./chdb/libcows.so
cd chdb && sudo zip -r ./libcows.zip ./libcows.so
- uses: actions/upload-artifact@v3
with:
name: libcows
path: ./chdb/libcows.zip
retention-days: 1
publish_libcows_linux:
needs: build_libcows_linux
runs-on: ubuntu-latest
steps:
- name: Checkout Packaging repository
uses: actions/checkout@v3
- uses: actions/download-artifact@v3
with:
name: libcows
- name: Unzip Library
run: |
ls -alFh
sudo unzip ./libcows.zip
ls -alFh
- name: Patch Version
run: |
sudo sed -i "s/0.0.0/${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }}/g" libcows.yml
cat libcows.yml
- name: Create deb package
id: nfpm-deb
uses: burningalchemist/nfpm-action@v1
env:
VERSION: ${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }}
with:
packager: deb
config: libcows.yml
target: libcows_${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }}_all.deb
- name: Create rpm package
id: nfpm-rpm
uses: burningalchemist/nfpm-action@v1
env:
VERSION: ${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }}
with:
packager: rpm
config: libcows.yml
target: libcows_${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }}.amd64.rpm
- name: Upload release
if: github.event_name != 'pull_request'
uses: boxpositron/upload-multiple-releases@1.0.7
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
release_config: |
libcows_${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }}.amd64.rpm
libcows_${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }}_all.deb
libcows.zip
tag_name: ${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }}
release_name: libcows_v${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }}
draft: false
prerelease: false
overwrite: true