Skip to content

Commit 4bc369e

Browse files
committed
Add dummy Rails app test suite and add Github CI workflow
1 parent 5d383d8 commit 4bc369e

40 files changed

+379
-12
lines changed

.github/workflows/test.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Test
2+
on:
3+
push:
4+
branches: ['master']
5+
pull_request:
6+
7+
jobs:
8+
test:
9+
runs-on: ubuntu-latest
10+
11+
env:
12+
RAILS_ENV: test
13+
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
include:
18+
### TEST RUBY VERSIONS
19+
- ruby: "2.5"
20+
- ruby: "2.6"
21+
- ruby: "2.7"
22+
- ruby: "3.0"
23+
- ruby: "3.1"
24+
- ruby: "3.2"
25+
### TEST RAILS VERSIONS
26+
- ruby: "2.6"
27+
env:
28+
RAILS_VERSION: "5.2"
29+
- ruby: "2.6"
30+
env:
31+
RAILS_VERSION: "6.0"
32+
- ruby: "2.6"
33+
env:
34+
RAILS_VERSION: "6.1"
35+
- ruby: "3.2"
36+
env:
37+
RAILS_VERSION: "7.0"
38+
- ruby: "3.2"
39+
env:
40+
RAILS_VERSION: "7.1"
41+
42+
steps:
43+
- uses: actions/checkout@v3
44+
45+
- name: Install ruby
46+
uses: ruby/setup-ruby@v1
47+
with:
48+
ruby-version: "${{ matrix.ruby }}"
49+
bundler-cache: false ### not compatible with ENV style gemfile
50+
51+
- name: Run test
52+
run: |
53+
bundle install
54+
bundle exec rake test

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,6 @@
1010
/test/*.sqlite3*
1111
/production/*.sqlite3*
1212
.DS_Store
13+
/test/dummy_app/**/*.sqlite3*
14+
/test/dummy_app/**/*.log
15+
/test/dummy_app/tmp/

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- Fix Litesearch tests
66
- Suppress chatty Litejob exit detector when there are no jobs in flight
77
- Tidy up the test folder
8+
- [#xx](https://github.com/oldmoe/litestack/pull/xx) - Add dummy Rails app for test suite and Github CI workflow
89

910
## [0.4.1] - 2023-10-11
1011

Gemfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,9 @@ source "https://rubygems.org"
44

55
# Specify your gem's dependencies in litestack.gemspec
66
gemspec
7+
8+
def get_env(name)
9+
(ENV[name] && !ENV[name].empty?) ? ENV[name] : nil
10+
end
11+
12+
gem 'rails', get_env("RAILS_VERSION")

README.md

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
![litestack](https://github.com/oldmoe/litestack/blob/master/assets/litestack_logo_teal_large.png?raw=true)
22

3+
<a href='https://github.com/oldmoe/litestack/actions' target='_blank'><img src="https://github.com/oldmoe/litestack/actions/workflows/test.yml/badge.svg?branch=master" style="max-width:100%;" height='21' style='border:0px;height:21px;' border='0' alt="CI Status"></a>
4+
35
All your data infrastructure, in a gem!
46

57
Litestack is a Ruby gem that provides both Ruby and Ruby on Rails applications an all-in-one solution for web application data infrastructure. It exploits the power and embeddedness of SQLite to deliver a full-fledged SQL database, a fast cache , a robust job queue, a reliable message broker, a full text search engine and a metrics platform all in a single package.
@@ -105,37 +107,37 @@ In your desired environment file (e.g. production.rb)
105107
```ruby
106108
config.cache_store = :litecache, {path: './path/to/your/cache/file'}
107109
```
108-
This provides a transparent integration that uses the Rails caching interface
110+
This provides a transparent integration that uses the Rails caching interface
109111

110112
litecache spawns a background thread for cleanup purposes. In case it detects that the current environment has *Fiber::Scheduler* or *Polyphony* loaded it will spawn a fiber instead, saving on both memory and CPU cycles.
111113

112114
> ![litejob](https://github.com/oldmoe/litestack/blob/master/assets/litejob_logo_teal.png?raw=true)
113115
114116
More info about Litejob can be found in the [litejob guide](https://github.com/oldmoe/litestack/wiki/Litejob-guide)
115117

116-
litejob is a fast and very efficient job queue processor for Ruby applications. It builds on top of SQLite as well, which provides transactional guarantees, persistence and exceptional performance.
118+
litejob is a fast and very efficient job queue processor for Ruby applications. It builds on top of SQLite as well, which provides transactional guarantees, persistence and exceptional performance.
117119

118120
#### Direct litejob usage
119121
```ruby
120122
require 'litestack'
121123
# define your job class
122124
class MyJob
123125
include ::Litejob
124-
126+
125127
queue = :default
126-
128+
127129
# must implement perform, with any number of params
128130
def perform(params)
129131
# do stuff
130132
end
131133
end
132-
134+
133135
#schedule a job asynchronusly
134136
MyJob.perform_async(params)
135-
137+
136138
#schedule a job at a certain time
137139
MyJob.perform_at(time, params)
138-
140+
139141
#schedule a job after a certain delay
140142
MyJob.perform_after(delay, params)
141143
```
@@ -202,7 +204,7 @@ idx.add({sender: 'Kamal', receiver: 'Laila', subject: 'Are the girls awake?', bo
202204
# search the index, all fields
203205
idx.search('kamal')
204206
# search the index, specific field, partial workd (trigram)
205-
idx.search('subject: awa')
207+
idx.search('subject: awa')
206208
```
207209

208210
Litesearch integrates tightly with ActiveRecord ans Sequel, here are integration examples
@@ -226,8 +228,8 @@ class Book < ActiveRecord::Base
226228
end
227229
end
228230
# insert records
229-
Author.create(name: 'Adam A. Writer')
230-
Book.create(title: 'The biggest stunt', author_id: 1, description: 'a description')
231+
Author.create(name: 'Adam A. Writer')
232+
Book.create(title: 'The biggest stunt', author_id: 1, description: 'a description')
231233
# search the index, the search method integrates with AR's query interface
232234
Book.search('author: writer').limit(1).all
233235
```
@@ -249,8 +251,8 @@ class Book < Sequel::Model
249251
end
250252
end
251253
# insert records
252-
Author.create(name: 'Adam A. Writer')
253-
Book.create(title: 'The biggest stunt', author_id: 1, description: 'a description')
254+
Author.create(name: 'Adam A. Writer')
255+
Book.create(title: 'The biggest stunt', author_id: 1, description: 'a description')
254256
# search the index, the search method integrates with Sequel's query interface
255257
Book.search('author: writer').limit(1).all
256258
```

test/dummy_app/Rakefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/usr/bin/env rake
2+
# Add your own tasks in files placed in lib/tasks ending in .rake,
3+
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
4+
5+
require File.expand_path('../config/application', __FILE__)
6+
7+
Dummy::Application.load_tasks
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
//= link_tree ../images
2+
//= link_directory ../javascripts .js
3+
//= link_directory ../stylesheets .css .scss

test/dummy_app/app/assets/javascripts/application.js

Whitespace-only changes.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/*
2+
*= require_self
3+
*/
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module ApplicationCable
2+
class Channel < ActionCable::Channel::Base
3+
end
4+
5+
class Connection < ActionCable::Connection::Base
6+
end
7+
end

0 commit comments

Comments
 (0)