Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: add ci cd jobs for linux and macos #74

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: 'Release'

on:
release:
types: [published]

jobs:
release:
permissions:
contents: write
strategy:
fail-fast: false
matrix:
include:
- platform: 'macos-latest' # for Arm based macs (M1 and above).
args: '--target aarch64-apple-darwin'
arch: 'arm64'
- platform: 'macos-latest' # for Intel based macs.
args: '--target x86_64-apple-darwin'
arch: 'x86_64'
- platform: 'ubuntu-22.04' # for Linux using ubuntu distribution.
args: ''
arch: ''

runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v4

- name: install dependencies (ubuntu only)
if: matrix.platform == 'ubuntu-22.04' # This must match the platform value defined above.
run: |
sudo apt-get update
sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf

- name: setup node
uses: actions/setup-node@v4
with:
node-version: lts/*
- name: install Rust stable
uses: dtolnay/rust-toolchain@stable
with:
# Those targets are only used on macos runners so it's in an `if` to slightly speed up windows and linux builds.
targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
- name: install chdb library
run: sh ./src-tauri/update_libchdb.sh
env:
ARCH: ${{ matrix.arch }}
- name: install frontend dependencies
run: npm ci
- uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
releaseId: ${{ github.event.release.id }}
args: ${{ matrix.args }}
17 changes: 15 additions & 2 deletions src-tauri/fix_dylib.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
#!/bin/bash

install_name_tool -change libchdb.so @executable_path/../Resources/libchdb.so src-tauri/target/release/agx
codesign --force --sign - src-tauri/target/release/agx
if [ "$(uname -s)" != "Darwin" ]; then
echo "Signing on macOS only"
exit 0
fi

if [ -n "$CI" ]; then
# CI environment: search in dynamic path
APP_PATH=$(find src-tauri/target -path "*/release/agx" -type f)
else
# Local environment: use fixed path
APP_PATH="src-tauri/target/release/agx"
fi

install_name_tool -change libchdb.so @executable_path/../Resources/libchdb.so "$APP_PATH"
codesign --force --sign - "$APP_PATH"
9 changes: 7 additions & 2 deletions src-tauri/update_libchdb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,22 @@ cd $(dirname "${BASH_SOURCE[0]}")
# Get the newest release version
LATEST_RELEASE=$(curl --silent "https://api.github.com/repos/chdb-io/chdb/releases/latest" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')

echo "Latest version found: $LATEST_RELEASE"

# Set ARCH to uname -m if not already set
ARCH=${ARCH:-$(uname -m)}

# Download the correct version based on the platform
case "$(uname -s)" in
Linux)
if [[ $(uname -m) == "aarch64" ]]; then
if [[ $ARCH == "aarch64" ]]; then
PLATFORM="linux-aarch64-libchdb.tar.gz"
else
PLATFORM="linux-x86_64-libchdb.tar.gz"
fi
;;
Darwin)
if [[ $(uname -m) == "arm64" ]]; then
if [[ $ARCH == "arm64" ]]; then
PLATFORM="macos-arm64-libchdb.tar.gz"
else
PLATFORM="macos-x86_64-libchdb.tar.gz"
Expand Down
Loading