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

Add gem test #7

Merged
merged 1 commit into from
Mar 2, 2023
Merged
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
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