Skip to content

Commit

Permalink
Merge pull request #1 from g3ortega/ci_setup
Browse files Browse the repository at this point in the history
Github CI integration (first iteration) + compiling enhancements
  • Loading branch information
g3ortega authored Dec 21, 2024
2 parents d5466e6 + ccef7a4 commit 66b6312
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 12 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,13 @@ jobs:
bundler-cache: true
- name: Install chdb library
run: curl -sL https://lib.chdb.io | bash
- name: Run the default task
run: bundle exec rake
- name: Copy chdb lib to root path
run: cp /usr/local/lib/libchdb.so .
- name: Compile native extension
run: |
bundle exec rake compile
bundle exec rake build
- name: Run tests
run: |
export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
bundle exec rake spec
5 changes: 1 addition & 4 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@ source "https://rubygems.org"
gemspec

gem "rake", "~> 13.0"

gem "rake-compiler", "~> 1.2.8"
gem "rspec", "~> 3.0"

gem "rubocop", "~> 1.21"

# gem "rake-compiler"
3 changes: 3 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ GEM
racc (1.8.1)
rainbow (3.1.1)
rake (13.2.1)
rake-compiler (1.2.8)
rake
regexp_parser (2.9.3)
rspec (3.13.0)
rspec-core (~> 3.13.0)
Expand Down Expand Up @@ -55,6 +57,7 @@ PLATFORMS
DEPENDENCIES
chdb!
rake (~> 13.0)
rake-compiler (~> 1.2.8)
rspec (~> 3.0)
rubocop (~> 1.21)

Expand Down
6 changes: 5 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@

require "bundler/gem_tasks"
require "rspec/core/rake_task"
require "rake/extensiontask"
require "rubocop/rake_task"

RSpec::Core::RakeTask.new(:spec)

require "rubocop/rake_task"
Rake::ExtensionTask.new("chdb") do |ext|
ext.lib_dir = "lib/chdb"
end

RuboCop::RakeTask.new

Expand Down
2 changes: 1 addition & 1 deletion ext/chdb/chdb.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ static VALUE local_result_elapsed(VALUE self) {
return DBL2NUM(result->c_result->elapsed);
}

void Init_chdb() {
void Init_chdb(void) {
DEBUG_PRINT("Initializing chdb extension");

VALUE mChdb = rb_define_module("Chdb");
Expand Down
12 changes: 8 additions & 4 deletions ext/chdb/extconf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@

require "mkmf"

# First try to find system-wide installations
system_found = have_library("chdb") && have_header("chdb.h")

unless system_found
# Abort if not found
abort "chdb.h or chdb library not found! Please install chdb development files"
abort "chdb.h or chdb library not found! Please install chdb development files.\n" \
"You can try installing with: gem install chdb -- --with-opt-dir=/usr/local/lib \n" \
"Or any other path that contains chdb.h and libchdb.so"
end

if RbConfig::CONFIG['GCC'] == 'yes'
$CFLAGS << ' -Wno-declaration-after-statement'
$CFLAGS = $CFLAGS.gsub(/-Wno-self-assign|-Wno-parentheses-equality|-Wno-constant-logical-operand/, '')
end

# Create Makefile
create_makefile("chdb/chdb")
Binary file removed lib/chdb/chdb.bundle
Binary file not shown.

0 comments on commit 66b6312

Please sign in to comment.