Skip to content

Commit

Permalink
Add gem test
Browse files Browse the repository at this point in the history
Signed-off-by: Daijiro Fukuda <[email protected]>
  • Loading branch information
daipom committed Feb 20, 2023
1 parent 035b284 commit 0484e3d
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 21 deletions.
42 changes: 30 additions & 12 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,40 @@ name: Ruby
on: [push,pull_request]

jobs:
build:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ruby: [ '2.7', '3.0', '3.1', '3.2' ]
name: Ruby ${{ matrix.ruby }}
steps:
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Run the default task
run: |
rake build
gem install ./pkg/fluent-plugin-utmpx*.gem
TESTOPTS="--verbose" bundle exec rake
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Run the default task
run: |
TESTOPTS="--verbose" bundle exec rake
gem:
runs-on: ubuntu-latest
name: Gem test
steps:
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2
- name: Install
run: |
rake install
gem install test-unit webrick
- name: Test
run: |
mkdir -p tmp
cd tmp
cp -a ../test/ ./
test/run.rb
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/tmp/
/pkg/
/Gemfile.lock
12 changes: 3 additions & 9 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
require "bundler"
Bundler::GemHelper.install_tasks
require "bundler/gem_tasks"

require "rake/testtask"

Rake::TestTask.new(:test) do |t|
t.libs.push("lib", "test")
t.test_files = FileList["test/**/test_*.rb"]
t.verbose = true
t.warning = true
task :test do
ruby("test/run.rb")
end

task default: [:test]
9 changes: 9 additions & 0 deletions test/run.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env ruby

$VERBOSE = true

$LOAD_PATH.unshift("lib", "test")

Dir.glob("test/**/test_*.rb") do |test_rb|
require File.expand_path(test_rb)
end

0 comments on commit 0484e3d

Please sign in to comment.