-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
656 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
pull_request: | ||
schedule: | ||
- cron: '15 9 * * *' | ||
|
||
jobs: | ||
host: | ||
name: ${{ matrix.os }} ${{ matrix.ruby }} | ||
if: ${{ github.repository == 'ruby/cgi' || github.event_name != 'schedule' }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: | ||
- ubuntu-20.04 | ||
- ubuntu-18.04 | ||
- macos-11 | ||
- macos-10.15 | ||
- windows-latest | ||
ruby: | ||
- '3.0' | ||
- 2.7 | ||
- 2.6 | ||
- debug | ||
include: | ||
- { os: ubuntu-20.04, ruby: head, ignore-pkg-error: true } | ||
- { os: windows-latest, ruby: mingw, ignore-pkg-error: true } | ||
- { os: windows-latest, ruby: mswin, ignore-pkg-error: true } | ||
- { os: ubuntu-20.04, ruby: jruby } | ||
- { os: ubuntu-20.04, ruby: jruby-head, ignore-pkg-error: true } | ||
exclude: | ||
- { os: windows-latest, ruby: debug } | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Set up Ruby | ||
uses: ruby/setup-ruby@v1 | ||
with: | ||
ruby-version: ${{ matrix.ruby }} | ||
bundler-cache: true # 'bundle install' and cache | ||
|
||
- run: bundle exec rake compile | ||
|
||
- run: bundle exec rake build | ||
|
||
- run: bundle exec rake test | ||
|
||
- name: Integration test | ||
run: bundle exec rake check | ||
continue-on-error: ${{ matrix.ignore-pkg-error || (matrix.ruby == 'debug') }} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,7 @@ | |
/spec/reports/ | ||
/tmp/ | ||
/Gemfile.lock | ||
*.jar | ||
*.bundle | ||
*.so | ||
*.dll |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,73 @@ | ||
require "bundler/gem_tasks" | ||
require "rake/testtask" | ||
|
||
require 'rake/javaextensiontask' | ||
Rake::JavaExtensionTask.new("escape") do |ext| | ||
ext.source_version = '1.8' | ||
ext.target_version = '1.8' | ||
ext.ext_dir = 'ext/java' | ||
ext.lib_dir = 'lib/cgi' | ||
|
||
task :build => :compile | ||
end | ||
|
||
unless RUBY_ENGINE == 'jruby' | ||
require 'rake/extensiontask' | ||
Rake::ExtensionTask.new("cgi/escape") | ||
end | ||
|
||
Rake::TestTask.new(:test) do |t| | ||
t.libs << "test/lib" | ||
t.libs.concat ["test/lib", "lib"] | ||
t.libs << "ext/java/org/jruby/ext/cgi/escape/lib" if RUBY_ENGINE == 'jruby' | ||
t.ruby_opts << "-rhelper" | ||
t.test_files = FileList['test/**/test_*.rb'] | ||
end | ||
|
||
require 'rake/extensiontask' | ||
Rake::ExtensionTask.new("cgi/escape") | ||
|
||
task :sync_tool do | ||
require 'fileutils' | ||
FileUtils.cp "../ruby/tool/lib/core_assertions.rb", "./test/lib" | ||
FileUtils.cp "../ruby/tool/lib/envutil.rb", "./test/lib" | ||
FileUtils.cp "../ruby/tool/lib/find_executable.rb", "./test/lib" | ||
cp "../ruby/tool/lib/core_assertions.rb", "./test/lib" | ||
cp "../ruby/tool/lib/envutil.rb", "./test/lib" | ||
cp "../ruby/tool/lib/find_executable.rb", "./test/lib" | ||
end | ||
|
||
task :check do | ||
Bundler.with_unbundled_env do | ||
spec = Gem::Specification::load("cgi.gemspec") | ||
version = spec.version.to_s | ||
|
||
gem = "pkg/cgi-#{version}#{"-java" if RUBY_ENGINE == "jruby"}.gem" | ||
File.size?(gem) or abort "gem not built!" | ||
|
||
sh "gem", "install", gem | ||
|
||
require_relative "test/lib/envutil" | ||
|
||
_, _, status = EnvUtil.invoke_ruby([], <<~EOS) | ||
version = #{version.dump} | ||
gem "cgi", version | ||
loaded_version = Gem.loaded_specs["cgi"].version.to_s | ||
if loaded_version == version | ||
puts "cgi \#{loaded_version} is loaded." | ||
else | ||
abort "cgi \#{loaded_version} is loaded instead of \#{version}!" | ||
end | ||
require "cgi/escape" | ||
string = "&<>" | ||
actual = CGI.escape(string) | ||
expected = "%26%3C%3E" | ||
puts "CGI.escape(\#{string.dump}) = \#{actual.dump}" | ||
if actual != expected | ||
abort "no! expected to be \#{expected.dump}!" | ||
end | ||
EOS | ||
|
||
if status.success? | ||
puts "check succeeded!" | ||
else | ||
warn "check failed!" | ||
exit status.exitstatus | ||
end | ||
end | ||
end | ||
|
||
task :default => :test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.