Skip to content

Commit

Permalink
Merge pull request #85 from MSP-Greg/actions-windows
Browse files Browse the repository at this point in the history
Update CI - Windows, forks, etc
  • Loading branch information
aycabta authored Dec 18, 2019
2 parents db64989 + 66cf00d commit 5d0dd0c
Show file tree
Hide file tree
Showing 7 changed files with 83 additions and 61 deletions.
15 changes: 5 additions & 10 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
name: macos

on:
push:
branches:
- master
pull_request:
branches:
- '*'
on: [push, pull_request]

jobs:
build:
Expand All @@ -20,6 +14,7 @@ jobs:
- name: Download test readline
run: |
sh ./download-test_readline.sh
- name: Run test
run: |
rake ci-test
- name: rake test
run: rake test
- name: rake ci-test
run: rake ci-test
8 changes: 1 addition & 7 deletions .github/workflows/ubuntu-rvm-with-irb.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
name: ubuntu-rvm with irb

on:
push:
branches:
- master
pull_request:
branches:
- '*'
on: [push, pull_request]

jobs:
build:
Expand Down
14 changes: 6 additions & 8 deletions .github/workflows/ubuntu-rvm.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
name: ubuntu-rvm

on:
push:
branches:
- master
pull_request:
branches:
- '*'
on: [push, pull_request]

jobs:
build:
Expand All @@ -32,7 +26,11 @@ jobs:
- name: Download test readline
run: |
sh ./download-test_readline.sh
- name: Run test
- name: rake test
run: |
source $HOME/.rvm/scripts/rvm
bundle exec rake test
- name: rake ci-test
run: |
source $HOME/.rvm/scripts/rvm
bundle exec rake ci-test
15 changes: 5 additions & 10 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
name: ubuntu

on:
push:
branches:
- master
pull_request:
branches:
- '*'
on: [push, pull_request]

jobs:
build:
Expand All @@ -27,6 +21,7 @@ jobs:
- name: Download test readline
run: |
sh ./download-test_readline.sh
- name: Run test
run: |
rake ci-test
- name: rake test
run: rake test
- name: rake ci-test
run: rake ci-test
43 changes: 19 additions & 24 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
@@ -1,33 +1,28 @@
name: windows

on:
push:
branches:
- master
pull_request:
branches:
- '*'
on: [push, pull_request]

jobs:
build:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
ruby: [ '2.6.x', '2.5.x' ]
ruby: [ '9.9.x', '2.6.x', '2.5.x' ]
steps:
- uses: actions/checkout@master
- name: Set up Ruby
uses: actions/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
- name: Install dependencies
run: |
gem install bundler --no-document
bundle install
- name: Download test readline
run: |
download-test_readline.bat
shell: cmd
- name: Run test
run: |
rake ci-test
- uses: actions/checkout@master
- name: Set up Ruby
uses: MSP-Greg/actions-ruby@master
with:
ruby-version: ${{ matrix.ruby }}
- name: Install dependencies
if: matrix.ruby != '9.9.x'
run: |
gem install bundler --no-document --conservative
bundle install
- name: Download test readline
run: ./download-test_readline.ps1
- name: rake test
run: rake test
- name: rake ci-test
run: rake ci-test
4 changes: 2 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ ENCODING_LIST.each_pair do |task_name, encoding|
t.libs << 'test'
t.libs << 'lib'
t.loader = :direct
t.pattern = 'test/**/test_*.rb'
t.pattern = 'test/reline/**/test_*.rb'
end
end

Expand All @@ -29,7 +29,7 @@ ENCODING_LIST.each_pair do |task_name, encoding|
t.libs << 'lib'
t.libs << 'tool/lib'
t.loader = :direct
t.pattern = 'test/**/test_*.rb'
t.pattern = 'test/ext/**/test_*.rb'
end
end

Expand Down
45 changes: 45 additions & 0 deletions download-test_readline.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<# Copies files from ruby/ruby/test/readline, renames
readline.so to readline.no so tests won't run on it
Note: the file name is not reset using rake or Actions scripts
#>

$__dir__ = $PSScriptRoot

$wc = $(New-Object System.Net.WebClient)

$ruby_uri = "https://raw.githubusercontent.com/ruby/ruby/master"

function download_files($uri2, $dir, $files) {
if ( !(Test-Path -Path "$__dir__/$dir" -PathType Container)) {
New-Item -Path "$__dir__/$dir" -ItemType Directory 1> $null
}
foreach ($file in $files) {
try {
$wc.DownloadFile("$ruby_uri/$uri2/$file", "$__dir__/$dir/$file")
} catch {
Write-Host "Can't download $ruby_uri/$uri2/$file"
exit 1
}
}
}

$files = "helper.rb", "test_readline.rb", "test_readline_history.rb"
download_files "test/readline" "test/ext/readline" $files

$files = "leakchecker.rb", "envutil.rb", "colorize.rb", "find_executable.rb"
download_files "tool/lib" "tool/lib" $files

download_files "tool/lib/minitest" "tool/lib/minitest" @("unit.rb")
download_files "tool/lib/test" "tool/lib/test" @("unit.rb")

$files = "assertions.rb", "core_assertions.rb", "parallel.rb", "testcase.rb"
download_files "tool/lib/test/unit" "tool/lib/test/unit" $files

# below renames readline.so to readline.no
$archdir = ruby.exe -e "print RbConfig::CONFIG['archdir']"
$readline_so = "$archdir/readline"

if (Test-Path -Path "$readline_so.so" -PathType leaf) {
Rename-Item -Path "$readline_so.so" -NewName "$readline_so.no"
}

0 comments on commit 5d0dd0c

Please sign in to comment.