From 3525a09bdf072159debd8dd953705fea3a90a9aa Mon Sep 17 00:00:00 2001 From: Jon Rowe Date: Mon, 16 Nov 2020 08:45:50 +0000 Subject: [PATCH 1/4] Rename travis folder to ci --- Rakefile | 30 ++++++++++--------- {travis => ci}/.rubocop_rspec_base.yml | 0 {travis => ci}/.travis.yml | 0 {travis => ci}/appveyor.yml | 0 .../script/ci_functions.sh | 0 {travis => ci}/script/clone_all_rspec_repos | 0 {travis => ci}/script/functions.sh | 2 +- {travis => ci}/script/predicate_functions.sh | 0 {travis => ci}/script/run_build | 0 .../update_rubygems_and_install_bundler | 0 10 files changed, 17 insertions(+), 15 deletions(-) rename {travis => ci}/.rubocop_rspec_base.yml (100%) rename {travis => ci}/.travis.yml (100%) rename {travis => ci}/appveyor.yml (100%) rename travis/script/travis_functions.sh => ci/script/ci_functions.sh (100%) rename {travis => ci}/script/clone_all_rspec_repos (100%) rename {travis => ci}/script/functions.sh (99%) rename {travis => ci}/script/predicate_functions.sh (100%) rename {travis => ci}/script/run_build (100%) rename {travis => ci}/script/update_rubygems_and_install_bundler (100%) diff --git a/Rakefile b/Rakefile index d6c11948..a4eea627 100644 --- a/Rakefile +++ b/Rakefile @@ -240,13 +240,13 @@ def create_pull_request(project_name, branch, custom_pr_comment, base=BASE_BRANC ) end -namespace :travis do +namespace :ci do ReadFile = Struct.new(:file_name, :contents, :mode) - def update_travis_files_in_repos(opts={}) - update_files_in_repos('travis build scripts', '', opts) do |name| - around_update_travis_build do - travis_files_with_comments.each do |file| + def update_ci_files_in_repos(opts={}) + update_files_in_repos('ci build scripts', '', opts) do |name| + around_update_ci_build do + ci_files_with_comments.each do |file| full_file_name = ReposPath.join(name, file.file_name) full_file_name.write(file.contents) full_file_name.chmod(file.mode) # ensure executables are set @@ -257,9 +257,9 @@ namespace :travis do end end - def travis_files_with_comments - travis_root = BaseRspecPath.join('travis') - file_names = Pathname.glob(travis_root.join('**', '{*,.*}')).select do |f| + def ci_files_with_comments + ci_root = BaseRspecPath.join('ci') + file_names = Pathname.glob(ci_root.join('**', '{*,.*}')).select do |f| f.file? end @@ -278,7 +278,7 @@ namespace :travis do end ReadFile.new( - file.relative_path_from(travis_root), + file.relative_path_from(ci_root), lines.join, file.stat.mode ) @@ -293,22 +293,24 @@ namespace :travis do sh script_file if File.exist?(script_file) end - def around_update_travis_build + def around_update_ci_build run_if_exists './script/before_update_travis_build.sh' + run_if_exists './script/before_update_build.sh' yield if block_given? ensure + run_if_exists './script/after_update_build.sh' run_if_exists './script/after_update_travis_build.sh' end - desc "Update travis build files" + desc "Update build files" task :update_files do - update_travis_files_in_repos + update_ci_files_in_repos end - desc "Updates the travis files and creates a PR" + desc "Updates the CI files and creates a PR" task :create_pr_with_updates, :custom_pr_comment do |t, args| opts = { except: %w[ rspec-rails ] } - force_update(update_travis_files_in_repos(opts), args[:custom_pr_comment], opts) + force_update(update_ci_files_in_repos(opts), args[:custom_pr_comment], opts) end end diff --git a/travis/.rubocop_rspec_base.yml b/ci/.rubocop_rspec_base.yml similarity index 100% rename from travis/.rubocop_rspec_base.yml rename to ci/.rubocop_rspec_base.yml diff --git a/travis/.travis.yml b/ci/.travis.yml similarity index 100% rename from travis/.travis.yml rename to ci/.travis.yml diff --git a/travis/appveyor.yml b/ci/appveyor.yml similarity index 100% rename from travis/appveyor.yml rename to ci/appveyor.yml diff --git a/travis/script/travis_functions.sh b/ci/script/ci_functions.sh similarity index 100% rename from travis/script/travis_functions.sh rename to ci/script/ci_functions.sh diff --git a/travis/script/clone_all_rspec_repos b/ci/script/clone_all_rspec_repos similarity index 100% rename from travis/script/clone_all_rspec_repos rename to ci/script/clone_all_rspec_repos diff --git a/travis/script/functions.sh b/ci/script/functions.sh similarity index 99% rename from travis/script/functions.sh rename to ci/script/functions.sh index 746462d0..4f876b0f 100644 --- a/travis/script/functions.sh +++ b/ci/script/functions.sh @@ -1,5 +1,5 @@ SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -source $SCRIPT_DIR/travis_functions.sh +source $SCRIPT_DIR/ci_functions.sh source $SCRIPT_DIR/predicate_functions.sh # If JRUBY_OPTS isn't set, use these. diff --git a/travis/script/predicate_functions.sh b/ci/script/predicate_functions.sh similarity index 100% rename from travis/script/predicate_functions.sh rename to ci/script/predicate_functions.sh diff --git a/travis/script/run_build b/ci/script/run_build similarity index 100% rename from travis/script/run_build rename to ci/script/run_build diff --git a/travis/script/update_rubygems_and_install_bundler b/ci/script/update_rubygems_and_install_bundler similarity index 100% rename from travis/script/update_rubygems_and_install_bundler rename to ci/script/update_rubygems_and_install_bundler From 69f90101a239d0c906c48d6f81e292ee97b27710 Mon Sep 17 00:00:00 2001 From: Jon Rowe Date: Mon, 16 Nov 2020 08:47:51 +0000 Subject: [PATCH 2/4] Move builds to github from travis --- Rakefile | 9 +++++++++ ci/.github/workflows/ci.yml | 35 +++++++++++++++++++++++++++++++++++ ci/.travis.yml | 9 --------- 3 files changed, 44 insertions(+), 9 deletions(-) create mode 100644 ci/.github/workflows/ci.yml diff --git a/Rakefile b/Rakefile index a4eea627..70717617 100644 --- a/Rakefile +++ b/Rakefile @@ -248,6 +248,7 @@ namespace :ci do around_update_ci_build do ci_files_with_comments.each do |file| full_file_name = ReposPath.join(name, file.file_name) + ensure_directory_exists(File.dirname(full_file_name)) full_file_name.write(file.contents) full_file_name.chmod(file.mode) # ensure executables are set end @@ -262,6 +263,9 @@ namespace :ci do file_names = Pathname.glob(ci_root.join('**', '{*,.*}')).select do |f| f.file? end + file_names += Pathname.glob(ci_root.join('.github', '**', '{*,.*}')).select do |f| + f.file? + end file_names.map do |file| comments_added = false @@ -285,6 +289,11 @@ namespace :ci do end end + def ensure_directory_exists(dirname) + return if Dir.exist?(dirname) + Dir.mkdir(dirname) + end + def update_maintenance_branch File.write("./maintenance-branch", BASE_BRANCH) unless File.exist?('./maintenance-branch') end diff --git a/ci/.github/workflows/ci.yml b/ci/.github/workflows/ci.yml new file mode 100644 index 00000000..530be01e --- /dev/null +++ b/ci/.github/workflows/ci.yml @@ -0,0 +1,35 @@ +name: RSpec CI +on: [pull_request, push] +jobs: + test: + name: Ruby ${{ matrix.ruby }} + runs-on: ubuntu-20.04 + strategy: + matrix: + ruby: + - 3.0.0-preview1 + - 2.7 + - 2.6 + - 2.5 + - 2.4 + - 2.3 + - 2.2 + - 2.1.9 + - ruby-head + fail-fast: false + continue-on-error: ${{ matrix.ruby == 'jruby-9.2.13.0' || endsWith(matrix.ruby, 'head') }} + steps: + - uses: actions/checkout@v2 + - uses: ruby/setup-ruby@v1 + with: + bundler: ${{ (matrix.ruby == 'jruby-9.1.17.0' && 1) || 2 }} + ruby-version: ${{ matrix.ruby }} + bundler-cache: true + - uses: actions/cache@v2 + with: + path: ../bundle + key: ${{ runner.os }}-${{ matrix.ruby }} + - run: script/update_rubygems_and_install_bundler + - run: script/clone_all_rspec_repos + - run: bundle install --binstubs --standalone + - run: script/run_build diff --git a/ci/.travis.yml b/ci/.travis.yml index 79b3d785..0f1613c1 100644 --- a/ci/.travis.yml +++ b/ci/.travis.yml @@ -16,15 +16,6 @@ rvm: - 1.9.2 - 1.9.3 - 2.0.0 - - 2.1 - - 2.2.10 - - 2.3.8 - - 2.4.10 - - 2.5.8 - - 2.6.6 - - 2.7.1 - - ruby-3.0.0-preview1 - - ruby-head - ree - rbx-3 - jruby-9.1.7.0 # pin JRuby to this until travis/rvm can install later versions From b6bb87d37eb896a8c06c476fddc0265b6f83b162 Mon Sep 17 00:00:00 2001 From: Jon Rowe Date: Mon, 16 Nov 2020 08:48:01 +0000 Subject: [PATCH 3/4] Allow dev branch --- ci/.travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/ci/.travis.yml b/ci/.travis.yml index 0f1613c1..9e647cb6 100644 --- a/ci/.travis.yml +++ b/ci/.travis.yml @@ -40,3 +40,4 @@ branches: only: - main - /^\d+-\d+-maintenance$/ + - /^\d+-\d+-dev$/ From e32ccec7afc67d7df774b598161bc79fef82674b Mon Sep 17 00:00:00 2001 From: Jon Rowe Date: Mon, 16 Nov 2020 10:14:33 +0000 Subject: [PATCH 4/4] Expose error as well as backtrace --- Rakefile | 1 + 1 file changed, 1 insertion(+) diff --git a/Rakefile b/Rakefile index 70717617..065105ec 100644 --- a/Rakefile +++ b/Rakefile @@ -27,6 +27,7 @@ def run_command(command, opts={}) begin Bundler.unbundled_system(command) rescue Exception => e + puts e puts e.backtrace end puts