mirror of
https://github.com/puma/puma.git
synced 2022-11-09 13:48:40 -05:00
Appveyor - Create pre-compiled Windows gems and test
This commit is contained in:
parent
6f7dcc5f22
commit
84c9a5685c
6 changed files with 112 additions and 102 deletions
2
.gitattributes
vendored
Normal file
2
.gitattributes
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
# Auto detect text files and perform LF normalization
|
||||
* text eol=lf
|
8
.gitignore
vendored
8
.gitignore
vendored
|
@ -16,3 +16,11 @@ Gemfile.lock
|
|||
/test/test_puma.state
|
||||
/test/test_server.sock
|
||||
/test/test_control.sock
|
||||
|
||||
# windows local build artifacts
|
||||
/win_gem_test/shared/
|
||||
/win_gem_test/packages/
|
||||
/win_gem_test/test_logs/
|
||||
/Rakefile_wintest
|
||||
*.gem
|
||||
/lib/puma/puma_http11.rb
|
||||
|
|
114
appveyor.yml
114
appveyor.yml
|
@ -1,110 +1,20 @@
|
|||
init:
|
||||
- set PATH=C:\Ruby%ruby_version%\bin;C:\Program Files\7-Zip;C:\Program Files\AppVeyor\BuildAgent;C:\Program Files\Git\cmd;C:\Windows\system32
|
||||
# Download current trunk, install OpenSSL via trunk_pkgs.cmd file
|
||||
- ps: >-
|
||||
if ($env:ruby_version -eq '_trunk') {
|
||||
$trunk_uri = 'https://ci.appveyor.com/api/projects/MSP-Greg/ruby-loco/artifacts/ruby_trunk.7z'
|
||||
(New-Object Net.WebClient).DownloadFile($trunk_uri, 'C:\ruby_trunk.7z')
|
||||
7z.exe x C:\ruby_trunk.7z -oC:\Ruby_trunk
|
||||
}
|
||||
|
||||
install:
|
||||
# Install ragel
|
||||
# download shared script files
|
||||
- ps: >-
|
||||
if ($env:ri_file -lt 'x86') {
|
||||
C:\msys64\usr\bin\pacman -S --noconfirm --noprogressbar mingw-w64-x86_64-ragel
|
||||
} else {
|
||||
C:\msys64\usr\bin\pacman -S --noconfirm --noprogressbar mingw-w64-i686-ragel
|
||||
}
|
||||
|
||||
# For RI builds, set SSL_CERT_FILE & add path for ragel
|
||||
- ps: >-
|
||||
if ($env:ruby_version -lt '24') {
|
||||
$env:SSL_CERT_FILE = C:/Ruby25-x64/ssl/cert.pem
|
||||
$env:path += ";C:\msys64\ming32\bin;"
|
||||
}
|
||||
|
||||
# Download RubyInstaller OpenSSL Knapsack packages
|
||||
# DevKit is installed in Ruby23 and Ruby23-x64 folders
|
||||
- ps: >-
|
||||
if ($env:ri_file -eq "x86") {
|
||||
appveyor DownloadFile https://dl.bintray.com/oneclick/OpenKnapsack/x86/openssl-1.0.2j-x86-windows.tar.lzma
|
||||
7z e openssl-1.0.2j-x86-windows.tar.lzma
|
||||
7z x -y openssl-1.0.2j-x86-windows.tar -oC:\ruby23\DevKit\mingw\i686-w64-mingw32
|
||||
# $env:b_config = "--with-ssl-dir=C:/Ruby23/DevKit/mingw --with-opt-include=C:/Ruby23/DevKit/mingw/include"
|
||||
} elseif ($env:ri_file -eq "x64") {
|
||||
appveyor DownloadFile https://dl.bintray.com/oneclick/OpenKnapsack/x64/openssl-1.0.2j-x64-windows.tar.lzma
|
||||
7z e openssl-1.0.2j-x64-windows.tar.lzma
|
||||
7z x -y openssl-1.0.2j-x64-windows.tar -oC:\ruby23-x64\DevKit\mingw\x86_64-w64-mingw32
|
||||
# $env:b_config = "--with-ssl-dir=C:/Ruby23-x64/DevKit/mingw --with-opt-include=C:/Ruby23-x64/DevKit/mingw/include"
|
||||
}
|
||||
|
||||
- RAKEOPT:
|
||||
- APPVEYOR: true
|
||||
- ruby --version
|
||||
- gem --version
|
||||
- bundle --version
|
||||
- bundle install --without documentation --path C:/av_bundle
|
||||
|
||||
# Download & install current OpenSSL package for later RubyInstaller2/MSYS2 versions
|
||||
- ps: >-
|
||||
if ($env:ruby_version -ge '25' -or $env:ruby_version -eq '_trunk') {
|
||||
if ($env:ruby_version -eq '25-x64' -or $env:ruby_version -eq '_trunk') {
|
||||
$openssl = "mingw-w64-x86_64-openssl"
|
||||
$dl_uri = "https://dl.bintray.com/msp-greg/ruby_trunk/"
|
||||
$key = "77D8FA18"
|
||||
} elseif ($env:ruby_version -eq '25') {
|
||||
$openssl = "mingw-w64-i686-openssl"
|
||||
$dl_uri = "https://dl.bintray.com/larskanis/rubyinstaller2-packages/"
|
||||
$key = "BE8BF1C5"
|
||||
}
|
||||
Appveyor-Retry C:\msys64\usr\bin\bash.exe -lc "pacman-key -r $key --keyserver hkp://pool.sks-keyservers.net && pacman-key -f $key && pacman-key --lsign-key $key" 2> $null
|
||||
C:\msys64\usr\bin\pacman.exe -Rdd --noconfirm --noprogressbar $openssl
|
||||
$openssl += "-1.1.0.h-1-any.pkg.tar.xz"
|
||||
$dl_uri += $openssl
|
||||
$wc = $(New-Object System.Net.WebClient)
|
||||
$wc.DownloadFile($dl_uri , "C:\$openssl")
|
||||
$wc.DownloadFile("$dl_uri.sig", "C:\$openssl.sig")
|
||||
C:\msys64\usr\bin\pacman.exe -Udd --noconfirm --noprogressbar --force C:\$openssl
|
||||
$env:b_config = "--use-system-libraries"
|
||||
if ( !(Test-Path -Path ./shared -PathType Container) ) {
|
||||
$uri = 'https://ci.appveyor.com/api/projects/MSP-Greg/av-gem-build-test/artifacts/shared.7z'
|
||||
$7z = 'C:\Program Files\7-Zip\7z.exe'
|
||||
$fn = "$env:TEMP\shared.7z"
|
||||
(New-Object System.Net.WebClient).DownloadFile($uri, $fn)
|
||||
&$7z x $fn -owin_gem_test 1> $null
|
||||
Remove-Item -LiteralPath $fn -Force
|
||||
Write-Host "Downloaded shared files" -ForegroundColor Yellow
|
||||
}
|
||||
|
||||
build_script:
|
||||
- bundle exec rake -rdevkit compile -- %b_config%
|
||||
|
||||
test_script:
|
||||
# clear path to test with ruby packaged dll's
|
||||
- set PATH=C:\Ruby%ruby_version%\bin;C:\Program Files\7-Zip;C:\Program Files\AppVeyor\BuildAgent;C:\Program Files\Git\cmd;C:\Windows\system32
|
||||
- set OPENSSL_DIR=
|
||||
- bundle exec rake test TESTOPTS="--verbose"
|
||||
|
||||
on_finish:
|
||||
- ruby -v
|
||||
- ps: .\win_gem_test\puma.ps1 $env:gem_bits
|
||||
|
||||
environment:
|
||||
matrix:
|
||||
- ruby_version: _trunk
|
||||
ri_file: x64_2
|
||||
- ruby_version: 25
|
||||
ri_file: x86_2
|
||||
- ruby_version: 25-x64
|
||||
ri_file: x64_2
|
||||
- ruby_version: 24
|
||||
ri_file: x86_2
|
||||
- ruby_version: 24-x64
|
||||
ri_file: x64_2
|
||||
- ruby_version: 23
|
||||
ri_file: x86
|
||||
- ruby_version: 23-x64
|
||||
ri_file: x64
|
||||
- ruby_version: 22
|
||||
ri_file: x86
|
||||
- ruby_version: 22-x64
|
||||
ri_file: x64
|
||||
|
||||
cache:
|
||||
- C:\av_bundle
|
||||
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
- gem_bits: 64
|
||||
- gem_bits: 32
|
||||
|
|
11
win_gem_test/Rakefile_wintest
Normal file
11
win_gem_test/Rakefile_wintest
Normal file
|
@ -0,0 +1,11 @@
|
|||
# rake -f Rakefile_wintest -N -R norakelib
|
||||
|
||||
require "rake/testtask"
|
||||
|
||||
Rake::TestTask.new(:win_test) do |t|
|
||||
t.libs << "test"
|
||||
t.warning = false
|
||||
t.options = '--verbose'
|
||||
end
|
||||
|
||||
task :default => [:win_test]
|
21
win_gem_test/package_gem.rb
Normal file
21
win_gem_test/package_gem.rb
Normal file
|
@ -0,0 +1,21 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'rubygems'
|
||||
require 'rubygems/package'
|
||||
|
||||
spec = Gem::Specification.load("./puma.gemspec")
|
||||
|
||||
spec.files.concat ['Rakefile_wintest', 'lib/puma/puma_http11.rb']
|
||||
spec.files.concat Dir['lib/**/*.so']
|
||||
spec.test_files = Dir['{examples,test}/**/*.*']
|
||||
|
||||
# below lines are required and not gem specific
|
||||
spec.platform = ARGV[0]
|
||||
spec.required_ruby_version = [">= #{ARGV[1]}", "< #{ARGV[2]}"]
|
||||
spec.extensions = []
|
||||
if spec.respond_to?(:metadata=)
|
||||
spec.metadata.delete("msys2_mingw_dependencies")
|
||||
spec.metadata['commit'] = ENV['commit_info']
|
||||
end
|
||||
|
||||
Gem::Package.build(spec)
|
58
win_gem_test/puma.ps1
Normal file
58
win_gem_test/puma.ps1
Normal file
|
@ -0,0 +1,58 @@
|
|||
# PowerShell script for building & testing SQLite3-Ruby fat binary gem
|
||||
# Code by MSP-Greg, see https://github.com/MSP-Greg/av-gem-build-test
|
||||
|
||||
# load utility functions, pass 64 or 32
|
||||
. $PSScriptRoot\shared\appveyor_setup.ps1 $args[0]
|
||||
if ($LastExitCode) { exit }
|
||||
|
||||
# above is required code
|
||||
#———————————————————————————————————————————————————————————————— above for all repos
|
||||
|
||||
Make-Const gem_name 'puma'
|
||||
Make-Const repo_name 'puma'
|
||||
Make-Const url_repo 'https://github.com/puma/puma.git'
|
||||
|
||||
#———————————————————————————————————————————————————————————————— lowest ruby version
|
||||
Make-Const ruby_vers_low 22
|
||||
# null = don't compile; false = compile, ignore test (allow failure);
|
||||
# true = compile & test
|
||||
Make-Const trunk $false ; Make-Const trunk_x64 $false
|
||||
Make-Const trunk_JIT $null ; Make-Const trunk_x64_JIT $null
|
||||
|
||||
#———————————————————————————————————————————————————————————————— make info
|
||||
Make-Const dest_so 'lib\puma'
|
||||
Make-Const exts @(
|
||||
@{ 'conf' = 'ext/puma_http11/extconf.rb' ; 'so' = 'puma_http11' }
|
||||
)
|
||||
Make-Const write_so_require $true
|
||||
|
||||
#———————————————————————————————————————————————————————————————— Pre-Compile
|
||||
# runs before compiling starts on every ruby version
|
||||
function Pre-Compile {
|
||||
# load the correct OpenSSL version in the build system
|
||||
Check-OpenSSL
|
||||
Write-Host Compiling With $env:SSL_VERS
|
||||
}
|
||||
|
||||
#———————————————————————————————————————————————————————————————— Run-Tests
|
||||
function Run-Tests {
|
||||
# call with comma separated list of gems to install or update
|
||||
Update-Gems minitest, minitest-retry, rack, rake
|
||||
$env:CI = 1
|
||||
rake -f Rakefile_wintest -N -R norakelib | Set-Content -Path $log_name -PassThru -Encoding UTF8
|
||||
# add info after test results
|
||||
$(ruby -ropenssl -e "STDOUT.puts $/ + OpenSSL::OPENSSL_LIBRARY_VERSION") |
|
||||
Add-Content -Path $log_name -PassThru -Encoding UTF8
|
||||
minitest # collects test results
|
||||
}
|
||||
|
||||
#———————————————————————————————————————————————————————————————— below for all repos
|
||||
# below is required code
|
||||
Make-Const dir_gem $(Convert-Path $PSScriptRoot\..)
|
||||
Make-Const dir_ps $PSScriptRoot
|
||||
|
||||
Push-Location $PSScriptRoot
|
||||
.\shared\make.ps1
|
||||
.\shared\test.ps1
|
||||
Pop-Location
|
||||
exit $ttl_errors_fails + $exit_code
|
Loading…
Reference in a new issue