From d6f098567cfaf05c2edacf5978db775d3e6c63bd Mon Sep 17 00:00:00 2001 From: Alexander Date: Fri, 8 Sep 2023 09:55:13 -0400 Subject: [PATCH 1/6] clean up gemspec --- egads.gemspec | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/egads.gemspec b/egads.gemspec index edb2879..2f60839 100644 --- a/egads.gemspec +++ b/egads.gemspec @@ -2,29 +2,30 @@ $:.unshift 'lib' require 'egads/version' Gem::Specification.new do |s| - s.name = "egads" - s.version = Egads::VERSION - s.summary = "Extensible Git Archive Deploy Strategy" - s.homepage = "https://github.com/kickstarter/egads" - s.email = ["aaron@ktheory.com"] - s.authors = ["Aaron Suggs"] - s.license = 'MIT' + s.name = "egads" + s.version = Egads::VERSION + s.summary = "Extensible Git Archive Deploy Strategy" + s.homepage = "https://github.com/kickstarter/egads" + s.email = ["aaron@ktheory.com"] + s.authors = ["Aaron Suggs"] + s.license = 'MIT' s.files = `git ls-files`.split($/) s.executables = s.files.grep(%r{^bin/}).map{ |f| File.basename(f) } s.test_files = s.files.grep(%r{^(test|spec|features)/}) s.require_paths = ["lib"] - s.extra_rdoc_files = [ "README.md" ] + s.extra_rdoc_files = ["README.md"] s.rdoc_options = ["--charset=UTF-8"] s.add_dependency "aws-sdk-s3", '~> 1.0' s.add_dependency "thor" + s.add_development_dependency "rake" s.add_development_dependency "minitest" - #s.add_development_dependency "simple_mock" # Via http://tatey.com/2012/02/07/mocking-with-minitest-mock-and-simple-delegator/ - s.description = %s{ + s.description = <<~EOS A collection of scripts for making a deployable tarball of a git commit, - uploading it to Amazon S3, and downloading it to your servers.} + uploading it to Amazon S3, and downloading it to your servers. + EOS end From fed4d39bb8882e8debde95b2438f2d13c0997aa1 Mon Sep 17 00:00:00 2001 From: Alexander Date: Fri, 8 Sep 2023 09:55:48 -0400 Subject: [PATCH 2/6] git rm .travis.yml --- .travis.yml | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 8d1aaa8..0000000 --- a/.travis.yml +++ /dev/null @@ -1,5 +0,0 @@ -language: ruby -sudo: false # Opt-in to container infrastructure -rvm: - - 2.5.5 - - 2.6.3 From e07bb6fbea1dfa913f469a0375486efa39ea9a23 Mon Sep 17 00:00:00 2001 From: Alexander Date: Fri, 8 Sep 2023 09:58:32 -0400 Subject: [PATCH 3/6] clean up Rakefile --- Rakefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Rakefile b/Rakefile index 65cc3fa..ec5ae26 100644 --- a/Rakefile +++ b/Rakefile @@ -3,8 +3,8 @@ require "bundler/setup" require "bundler/gem_tasks" require 'rake/testtask' +task :default => :test + Rake::TestTask.new do |t| t.pattern = "spec/*_spec.rb" end - -task :default => :test From 4fa0365c3706b93585aa06472661bca3986a6cde Mon Sep 17 00:00:00 2001 From: Alexander Date: Fri, 8 Sep 2023 10:01:12 -0400 Subject: [PATCH 4/6] add rexml dependency rexml no longer bundled with Ruby v3 --- egads.gemspec | 1 + 1 file changed, 1 insertion(+) diff --git a/egads.gemspec b/egads.gemspec index 2f60839..1e1a961 100644 --- a/egads.gemspec +++ b/egads.gemspec @@ -19,6 +19,7 @@ Gem::Specification.new do |s| s.rdoc_options = ["--charset=UTF-8"] s.add_dependency "aws-sdk-s3", '~> 1.0' + s.add_dependency "rexml" # required for Ruby 3+ s.add_dependency "thor" s.add_development_dependency "rake" From 631d67f6230d339bf3fd3098d89f26036af6a6eb Mon Sep 17 00:00:00 2001 From: Alexander Date: Fri, 8 Sep 2023 10:02:29 -0400 Subject: [PATCH 5/6] add Taskfile --- Taskfile.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 Taskfile.yml diff --git a/Taskfile.yml b/Taskfile.yml new file mode 100644 index 0000000..5db80f9 --- /dev/null +++ b/Taskfile.yml @@ -0,0 +1,14 @@ +# https://taskfile.dev + +version: "3" + +tasks: + init: + desc: Initialize project + cmds: + - bundle install + + test: + desc: Run tests + cmds: + - bundle exec rake test From 69ff51250918a7ca31255f10457def28af3b4d4f Mon Sep 17 00:00:00 2001 From: Alexander Date: Fri, 8 Sep 2023 10:09:39 -0400 Subject: [PATCH 6/6] GitHub Actions init --- .github/actions/setup-rubygems/action.yml | 19 +++++++++++ .github/actions/test/action.yml | 15 +++++++++ .github/workflows/test-release.yml | 40 +++++++++++++++++++++++ Rakefile | 21 +++++++++++- 4 files changed, 94 insertions(+), 1 deletion(-) create mode 100644 .github/actions/setup-rubygems/action.yml create mode 100644 .github/actions/test/action.yml create mode 100644 .github/workflows/test-release.yml diff --git a/.github/actions/setup-rubygems/action.yml b/.github/actions/setup-rubygems/action.yml new file mode 100644 index 0000000..8b8c20b --- /dev/null +++ b/.github/actions/setup-rubygems/action.yml @@ -0,0 +1,19 @@ +name: Setup RubyGems +description: Setup RubyGems credentials +inputs: + rubygems_api_key: + description: RubyGems API key + required: true +runs: + using: composite + steps: + - run: mkdir -p ~/.gem + shell: bash + - run: | + cat <<-YAML > ~/.gem/credentials + --- + :rubygems_api_key: ${{ inputs.rubygems_api_key }} + YAML + shell: bash + - run: chmod 0600 ~/.gem/credentials + shell: bash diff --git a/.github/actions/test/action.yml b/.github/actions/test/action.yml new file mode 100644 index 0000000..a36db97 --- /dev/null +++ b/.github/actions/test/action.yml @@ -0,0 +1,15 @@ +name: Test +description: Run tests +inputs: + activesupport-version: + description: ActiveSupport version constraint + required: true +runs: + using: composite + steps: + - run: bundle add activesupport -v '${{ inputs.activesupport-version }}' + shell: bash + - run: bundle install + shell: bash + - run: bundle exec rake + shell: bash diff --git a/.github/workflows/test-release.yml b/.github/workflows/test-release.yml new file mode 100644 index 0000000..184eb3c --- /dev/null +++ b/.github/workflows/test-release.yml @@ -0,0 +1,40 @@ +name: Test and Release +on: + pull_request: + push: + release: + types: + - published +jobs: + test: + name: Test [Ruby ${{ matrix.ruby-version }}] + runs-on: ubuntu-latest + strategy: + matrix: + ruby-version: + - "2.7" + - "3.1" + - "3.2" + steps: + - uses: actions/checkout@v3 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby-version }} + - run: bundle install + - run: bundle exec rake test + push: + name: Publish Gem + if: ${{ github.event.release }} + needs: + - test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.2" + - uses: ./.github/actions/setup-rubygems + with: + rubygems_api_key: ${{ secrets.RUBYGEMS_API_KEY }} + - run: bundle install + - run: bundle exec rake gem:push diff --git a/Rakefile b/Rakefile index ec5ae26..cbb20a5 100644 --- a/Rakefile +++ b/Rakefile @@ -1,6 +1,5 @@ require "rubygems" require "bundler/setup" -require "bundler/gem_tasks" require 'rake/testtask' task :default => :test @@ -8,3 +7,23 @@ task :default => :test Rake::TestTask.new do |t| t.pattern = "spec/*_spec.rb" end + +namespace :gem do + require 'bundler/gem_tasks' + + @gem = "pkg/egads-#{ Egads::VERSION }.gem" + + desc "Push #{ @gem } to rubygems.org" + task :push => %i[test build git:check] do + sh %{gem push #{ @gem }} + end +end + +namespace :git do + desc 'Check git workspace' + task :check do + sh %{git diff HEAD --quiet} do |ok| + abort "\e[31mRefusing to continue - git workspace is dirty\e[0m" unless ok + end + end +end