From 4a922870b4257dfe9567ed47a7132d5664c5f8f7 Mon Sep 17 00:00:00 2001 From: MSP-Greg Date: Wed, 11 Dec 2019 11:08:47 -0600 Subject: [PATCH 1/3] Move all Windows CI to GitHub Actions, bat -> ps1 1. Uses current Ruby builds, also master 2. Changes download-test_readline.bat to a PowerShell script 3. PowerShell script also renames readline.so to readline.no --- .github/workflows/windows.yml | 41 +++++++++++++------------------ download-test_readline.ps1 | 45 +++++++++++++++++++++++++++++++++++ 2 files changed, 62 insertions(+), 24 deletions(-) create mode 100644 download-test_readline.ps1 diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index e3f6bb4b21..1f18363509 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -1,33 +1,26 @@ 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: Run test + run: rake ci-test diff --git a/download-test_readline.ps1 b/download-test_readline.ps1 new file mode 100644 index 0000000000..c20c1b03aa --- /dev/null +++ b/download-test_readline.ps1 @@ -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" +} From 7dfbd385a5295503b190120d1606252f22266e3c Mon Sep 17 00:00:00 2001 From: MSP-Greg Date: Wed, 11 Dec 2019 15:12:19 -0600 Subject: [PATCH 2/3] Allow all Actions workflows to run in forks Current workflows restrict branch pushes to 'master', hinders contributors working in forks. --- .github/workflows/macos.yml | 8 +------- .github/workflows/ubuntu-rvm-with-irb.yml | 8 +------- .github/workflows/ubuntu-rvm.yml | 8 +------- .github/workflows/ubuntu.yml | 8 +------- 4 files changed, 4 insertions(+), 28 deletions(-) diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index c4dfa9271d..a473a78fc9 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -1,12 +1,6 @@ name: macos -on: - push: - branches: - - master - pull_request: - branches: - - '*' +on: [push, pull_request] jobs: build: diff --git a/.github/workflows/ubuntu-rvm-with-irb.yml b/.github/workflows/ubuntu-rvm-with-irb.yml index 074ee2c8a0..ac84fee8fb 100644 --- a/.github/workflows/ubuntu-rvm-with-irb.yml +++ b/.github/workflows/ubuntu-rvm-with-irb.yml @@ -1,12 +1,6 @@ name: ubuntu-rvm with irb -on: - push: - branches: - - master - pull_request: - branches: - - '*' +on: [push, pull_request] jobs: build: diff --git a/.github/workflows/ubuntu-rvm.yml b/.github/workflows/ubuntu-rvm.yml index 947b5870fa..894744d8e9 100644 --- a/.github/workflows/ubuntu-rvm.yml +++ b/.github/workflows/ubuntu-rvm.yml @@ -1,12 +1,6 @@ name: ubuntu-rvm -on: - push: - branches: - - master - pull_request: - branches: - - '*' +on: [push, pull_request] jobs: build: diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index 4ab567918a..ca1681abfc 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -1,12 +1,6 @@ name: ubuntu -on: - push: - branches: - - master - pull_request: - branches: - - '*' +on: [push, pull_request] jobs: build: From 66cf00d13c23bfd93a04b863ca41bc96d69f20e5 Mon Sep 17 00:00:00 2001 From: MSP-Greg Date: Wed, 11 Dec 2019 15:14:33 -0600 Subject: [PATCH 3/3] Split 'rake test' and 'rake ci-test' --- .github/workflows/macos.yml | 7 ++++--- .github/workflows/ubuntu-rvm.yml | 6 +++++- .github/workflows/ubuntu.yml | 7 ++++--- .github/workflows/windows.yml | 6 ++++-- Rakefile | 4 ++-- 5 files changed, 19 insertions(+), 11 deletions(-) diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index a473a78fc9..8da6c42ab8 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -14,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 diff --git a/.github/workflows/ubuntu-rvm.yml b/.github/workflows/ubuntu-rvm.yml index 894744d8e9..791bcf9fca 100644 --- a/.github/workflows/ubuntu-rvm.yml +++ b/.github/workflows/ubuntu-rvm.yml @@ -26,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 diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index ca1681abfc..3160d9f5a6 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -21,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 diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 1f18363509..108d848e2b 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -22,5 +22,7 @@ jobs: bundle install - name: Download test readline run: ./download-test_readline.ps1 - - name: Run test - run: rake ci-test + - name: rake test + run: rake test + - name: rake ci-test + run: rake ci-test diff --git a/Rakefile b/Rakefile index 47962f3fe1..47b57630c6 100644 --- a/Rakefile +++ b/Rakefile @@ -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 @@ -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