diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 4df8dfb..781dd3d 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -3,7 +3,7 @@ name: Ruby on: [push,pull_request] jobs: - build: + test: runs-on: ubuntu-latest strategy: fail-fast: false @@ -11,14 +11,32 @@ jobs: 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 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9552bdf --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +/tmp/ +/pkg/ +/Gemfile.lock diff --git a/Rakefile b/Rakefile index 9756c6e..d8f0379 100644 --- a/Rakefile +++ b/Rakefile @@ -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] diff --git a/test/run.rb b/test/run.rb new file mode 100755 index 0000000..20e41dc --- /dev/null +++ b/test/run.rb @@ -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