From a07e273e2bab5829077c5edf83b438c1aee1ba45 Mon Sep 17 00:00:00 2001 From: James Couball Date: Thu, 5 Nov 2020 10:25:26 -0800 Subject: [PATCH 1/6] Add Github workflow to test, lint, and build the the ruby_git gem --- .github/workflows/ruby.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/ruby.yml diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml new file mode 100644 index 0000000..1a29adb --- /dev/null +++ b/.github/workflows/ruby.yml @@ -0,0 +1,27 @@ +# Download a prebuilt Ruby version, install dependencies, and run the default Rake task + +name: Ruby + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + test_lint_build: + + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.6 # Not needed with a .ruby-version file + bundler-cache: true # runs 'bundle install' and caches installed gems automatically + + - name: Run rake + run: bundle exec rake From 5a90491173afadb78cb681340bc5b704ad8e3e09 Mon Sep 17 00:00:00 2001 From: James Couball Date: Thu, 5 Nov 2020 10:25:49 -0800 Subject: [PATCH 2/6] Fix new Rubocop offenses --- spec/lib/ruby_git/file_helpers_spec.rb | 46 +++++++++++++------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/spec/lib/ruby_git/file_helpers_spec.rb b/spec/lib/ruby_git/file_helpers_spec.rb index a0c4d23..0525e39 100644 --- a/spec/lib/ruby_git/file_helpers_spec.rb +++ b/spec/lib/ruby_git/file_helpers_spec.rb @@ -19,16 +19,16 @@ end context "when path is '/usr/bin:/usr/local/bin' and path_ext is nil" do - let(:path_dir_1) { File.join(root_dir, 'usr', 'bin') } - let(:path_dir_2) { File.join(root_dir, 'usr', 'local', 'bin') } - let(:path) { [path_dir_1, path_dir_2].join(File::PATH_SEPARATOR) } + let(:path_dir1) { File.join(root_dir, 'usr', 'bin') } + let(:path_dir2) { File.join(root_dir, 'usr', 'local', 'bin') } + let(:path) { [path_dir1, path_dir2].join(File::PATH_SEPARATOR) } context 'and command is not found in the path' do it { is_expected.to be_nil } end context 'and /usr/local/bin/command is NOT an executable file' do - let(:command_dir) { path_dir_1 } + let(:command_dir) { path_dir1 } let(:command_path) { File.join(command_dir, command) } before do FileUtils.mkdir_p(command_dir) @@ -39,7 +39,7 @@ end context 'and /usr/local/bin/command is a directory' do - let(:command_dir) { path_dir_1 } + let(:command_dir) { path_dir1 } let(:command_path) { File.join(command_dir, command) } before do FileUtils.mkdir_p(command_dir) @@ -50,7 +50,7 @@ end context 'and /usr/bin/command is an executable file' do - let(:command_dir) { path_dir_1 } + let(:command_dir) { path_dir1 } let(:command_path) { File.join(command_dir, command) } before do FileUtils.mkdir_p(command_dir) @@ -62,7 +62,7 @@ end context 'and /usr/local/bin/command is an executable file' do - let(:command_dir) { path_dir_2 } + let(:command_dir) { path_dir2 } let(:command_path) { File.join(command_dir, command) } before do FileUtils.mkdir_p(command_dir) @@ -74,7 +74,7 @@ end context 'and /usr/local/bin/command is a symlink to an executable file' do - let(:command_dir) { path_dir_2 } + let(:command_dir) { path_dir2 } let(:command_path) { File.join(command_dir, command) } let(:actual_command_path) { File.join(command_dir, "actual_#{command}") } before do @@ -88,33 +88,33 @@ end context 'and both /usr/bin/command and /usr/local/bin/command are executable files' do - let(:command_dir_1) { path_dir_1 } - let(:command_path_1) { File.join(command_dir_1, command) } + let(:command_dir1) { path_dir1 } + let(:command_path1) { File.join(command_dir1, command) } before do - FileUtils.mkdir_p(command_dir_1) - FileUtils.touch(command_path_1) - FileUtils.chmod(0o755, command_path_1) + FileUtils.mkdir_p(command_dir1) + FileUtils.touch(command_path1) + FileUtils.chmod(0o755, command_path1) end - let(:command_dir_2) { path_dir_2 } - let(:command_path_2) { File.join(command_dir_2, command) } + let(:command_dir2) { path_dir2 } + let(:command_path2) { File.join(command_dir2, command) } before do - FileUtils.mkdir_p(command_dir_2) - FileUtils.touch(command_path_2) - FileUtils.chmod(0o755, command_path_2) + FileUtils.mkdir_p(command_dir2) + FileUtils.touch(command_path2) + FileUtils.chmod(0o755, command_path2) end - it { is_expected.to eq(Pathname.new(command_path_1)) } + it { is_expected.to eq(Pathname.new(command_path1)) } end context "and path_ext is '.EXE:.BAT:.CMD'" do - let(:path_dir_1) { File.join(root_dir, 'usr', 'bin') } - let(:path_dir_2) { File.join(root_dir, 'usr', 'local', 'bin') } - let(:path) { [path_dir_1, path_dir_2].join(File::PATH_SEPARATOR) } + let(:path_dir1) { File.join(root_dir, 'usr', 'bin') } + let(:path_dir2) { File.join(root_dir, 'usr', 'local', 'bin') } + let(:path) { [path_dir1, path_dir2].join(File::PATH_SEPARATOR) } let(:path_ext) { %w[.EXE .BAT .CMD].join(File::PATH_SEPARATOR) } context 'and /usr/local/bin/command.BAT is an executable file' do - let(:command_dir) { path_dir_1 } + let(:command_dir) { path_dir1 } let(:command_path) { File.join(command_dir, "#{command}.BAT") } before do FileUtils.mkdir_p(command_dir) From 98b8cbcd9cd7bafcecec112643017586526c7a1d Mon Sep 17 00:00:00 2001 From: James Couball Date: Thu, 5 Nov 2020 10:40:40 -0800 Subject: [PATCH 3/6] Convert to a matrix build --- .github/workflows/ruby.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml index 1a29adb..2269353 100644 --- a/.github/workflows/ruby.yml +++ b/.github/workflows/ruby.yml @@ -9,9 +9,14 @@ on: branches: [ main ] jobs: - test_lint_build: + build: runs-on: ubuntu-latest + strategy: + matrix: + ruby: ['2.6', '2.7', 'head'] + + name: Build on Ruby ${{ matrix.ruby }} steps: - name: Checkout code @@ -20,7 +25,7 @@ jobs: - name: Setup Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: 2.6 # Not needed with a .ruby-version file + ruby-version: ${{ matrix.ruby }} bundler-cache: true # runs 'bundle install' and caches installed gems automatically - name: Run rake From 2db3163aae33b7c0ab9e22af095a4548a650a55b Mon Sep 17 00:00:00 2001 From: James Couball Date: Thu, 5 Nov 2020 11:08:16 -0800 Subject: [PATCH 4/6] Add link to GitHub Action workflow to README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 58699e3..454fe62 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ **THIS PROJECT IS A WORK IN PROGRESS AND IS NOT USEFUL IN ITS CURRENT STATE** [![Gem Version](https://badge.fury.io/rb/ruby_git.svg)](https://badge.fury.io/rb/ruby_git) -[![Build Status](https://travis-ci.org/main-branch/ruby_git.svg?branch=main)](https://travis-ci.org/main-branch/ruby_git) +[![Build Status](https://github.com/main-branch/ruby_git/workflows/Ruby/badge.svg?branch=main)](https://github.com/main-branch/ruby_git/actions?query=workflow%3ARuby) [![Maintainability](https://api.codeclimate.com/v1/badges/5403e4613b7518f70da7/maintainability)](https://codeclimate.com/github/main-branch/ruby_git/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/5403e4613b7518f70da7/test_coverage)](https://codeclimate.com/github/main-branch/ruby_git/test_coverage) [![Slack](https://img.shields.io/badge/slack-main--branch/ruby__git-yellow.svg?logo=slack)](https://main-branch.slack.com/archives/C01CHR7TMM2) From 79771fd04463fc7fc7826b4fbda5bcd5c1e4eebe Mon Sep 17 00:00:00 2001 From: James Couball Date: Thu, 5 Nov 2020 11:24:27 -0800 Subject: [PATCH 5/6] Remove the .travis.yml --- .travis.yml | 26 -------------------------- 1 file changed, 26 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 4584eb2..0000000 --- a/.travis.yml +++ /dev/null @@ -1,26 +0,0 @@ ---- -language: ruby - -env: - global: - secure: SSSOEixn3ZAtlFmDyczVFAn/a7r+oWt2Ji+CZsRyn3jaXGx27kv0jGVWiTEAjjdEpIjoTSGMoagkP2b0o/+G2ZJgWdlZrLZBI16vmQy/OK386aENKseVsWlH3L6FxDAMDOeK8jRMZEPZWBjfK3MbtG2sfTDqA+kxi1VradFRE/YeLaES8AefbqZvXQgsg9CpLw1rBJTjAxduHVmjS23KY26eNy7wu7Pun4kwHOfmYsT7B/9Dbe9TvB3j01mYHBDbHGK8I+i8qLxU9whB9YhvitgnAY7nvH6aiOTaMKwz81Pr16SdQV+IayG+0dZoY81smSwCjlDdWg9+m/3HtcwU6TAbFCo1TGqQiF6zcvlT3P7hKUEJeCdptXtQuf9PVIjU4AIB1CXAIz2sqWoqRSArAzRmLMjho8RW9Nv7JGz6tN2DCyBOa2G5/+y0knkd8zdXvslCMeBjMn+yf6Ot7NZe4ItTT6YMUqb+Sp3CZzXZtkUqZNYC7BtWn+hLZYj/J48tKYLbFY8wQZ/WswWK9V5SqOuGmIKl/vcLF0DMPcsVotTCvU5Masl+GjBjuzyyGRWViF6qcMXW1QFbuTiQxrF1Gz4jVPL7OA4lflpSOWub+bKzeca71VF8QuFC/pIJoNsnMu39TtCbFhHB7H1NOfqsC63XiWx3JJj/a8d/Z7U5qb8= - -cache: bundler - -rvm: - - 2.6 - - 2.7 - - ruby-head - -before_script: - - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter - - chmod +x ./cc-test-reporter - - ./cc-test-reporter before-build - -after_script: - - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT - -matrix: - allow_failures: - - rvm: ruby-head - fast_finish: true From d648ecf1c11318a269f3d9a02e0fa9d8a82869f2 Mon Sep 17 00:00:00 2001 From: James Couball Date: Thu, 5 Nov 2020 13:11:34 -0800 Subject: [PATCH 6/6] Move GitHub specific files to the .github directory --- CODEOWNERS => .github/CODEOWNERS | 0 ISSUE_TEMPLATE.md => .github/ISSUE_TEMPLATE.md | 0 PULL_REQUEST_TEMPLATE.md => .github/PULL_REQUEST_TEMPLATE.md | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename CODEOWNERS => .github/CODEOWNERS (100%) rename ISSUE_TEMPLATE.md => .github/ISSUE_TEMPLATE.md (100%) rename PULL_REQUEST_TEMPLATE.md => .github/PULL_REQUEST_TEMPLATE.md (100%) diff --git a/CODEOWNERS b/.github/CODEOWNERS similarity index 100% rename from CODEOWNERS rename to .github/CODEOWNERS diff --git a/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md similarity index 100% rename from ISSUE_TEMPLATE.md rename to .github/ISSUE_TEMPLATE.md diff --git a/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md similarity index 100% rename from PULL_REQUEST_TEMPLATE.md rename to .github/PULL_REQUEST_TEMPLATE.md