Skip to content

Commit

Permalink
Merge pull request #20 from umbrellio/clickhouse-support
Browse files Browse the repository at this point in the history
  • Loading branch information
tycooon authored Dec 9, 2024
2 parents 2b9e18c + ec3af35 commit 27f3b63
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 7 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ jobs:
run: bundle exec ci-helper CheckSpecSuffixes --extra-paths spec/*.rb --ignored-paths spec/*_helper.rb
- name: Run specs
run: bundle exec ci-helper RunSpecs
- name: Audit
run: bundle exec ci-helper BundlerAudit
- name: Coveralls
uses: coverallsapp/github-action@master
with:
Expand All @@ -39,7 +37,7 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby: ["2.7", "3.0", "3.1"]
ruby: ["3.0", "3.1", "3.2", "3.3"]

steps:
- uses: actions/checkout@v4
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
ci-helper (0.6.0)
ci-helper (0.7.0)
colorize (~> 1.1)
dry-inflector (~> 1.0)
umbrellio-sequel-plugins (~> 0.14)
Expand Down
4 changes: 4 additions & 0 deletions lib/ci_helper/commands.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ def create_and_migrate_database!
execute_with_env("bundle exec rake db:drop db:create db:migrate")
end

def create_and_migrate_clickhouse_database!
execute_with_env("bundle exec rake ch:create ch:migrate")
end

def fail!(message)
raise Error, message
end
Expand Down
5 changes: 5 additions & 0 deletions lib/ci_helper/commands/run_specs.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ def call
return if job_files.empty?

create_and_migrate_database! if with_database?
create_and_migrate_clickhouse_database! if with_clickhouse?
execute("bundle exec rspec #{Shellwords.join(job_files)}")
return 0 unless split_resultset?

Expand Down Expand Up @@ -40,6 +41,10 @@ def with_database?
boolean_option(:with_database)
end

def with_clickhouse?
boolean_option(:with_clickhouse)
end

def split_resultset?
boolean_option(:split_resultset)
end
Expand Down
2 changes: 1 addition & 1 deletion lib/ci_helper/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module CIHelper
VERSION = "0.6.0"
VERSION = "0.7.0"
end
5 changes: 3 additions & 2 deletions spec/ci_helper/commands/run_specs_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

before { allow(Pathname).to receive(:pwd).and_return(mocked_pathname) }

let(:options) { Hash[split_resultset: "true", with_database: "true"] }
let(:options) { Hash[split_resultset: "true", with_database: "true", with_clickhouse: "true"] }

let(:mocked_pathname) do
instance_double(Pathname).tap do |pathname|
Expand All @@ -28,14 +28,15 @@
let(:expected_commands) do
[
"export RAILS_ENV=test && bundle exec rake db:drop db:create db:migrate",
"export RAILS_ENV=test && bundle exec rake ch:create ch:migrate",
"bundle exec rspec cool_path_1 cool_path_0",
"mv coverage/.resultset.json coverage/resultset.1.json",
]
end

it "executes command and exits with success" do
expect(command).to eq(0)
expect(popen_executed_commands.size).to eq(3)
expect(popen_executed_commands.size).to eq(4)
expect(popen_executed_commands).to eq(expected_commands)
end

Expand Down

0 comments on commit 27f3b63

Please sign in to comment.