From b5112293d2ef6b31f06cfabf9e5ead7e754a7af2 Mon Sep 17 00:00:00 2001 From: Jarrett Lusso Date: Fri, 15 Mar 2024 17:39:33 -0400 Subject: [PATCH] Add GH workflow and fix failing items --- .github/workflows/tests.yml | 32 +++++++++++++++++++++ Gemfile | 5 ++++ bridgetown-seo-tag.gemspec | 6 ---- lib/bridgetown-seo-tag/url_helper.rb | 2 +- spec/bridgetown_seo_tag_integration_spec.rb | 2 ++ 5 files changed, 40 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 0000000..469d5f4 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,32 @@ +name: Tests + +on: + pull_request: + branches: + - "*" + push: + branches: + - master + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + ruby_version: [2.7.7, 3.0.5, 3.1.3, 3.2.0, 3.3.0] + bridgetown_version: [1.2.0] + continue-on-error: ${{ endsWith(matrix.ruby, 'head') || matrix.ruby == 'debug' }} + # Has to be top level to cache properly + env: + BUNDLE_JOBS: 3 + BUNDLE_PATH: "vendor/bundle" + BRIDGETOWN_VERSION: ${{ matrix.bridgetown_version }} + steps: + - uses: actions/checkout@master + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby_version }} + bundler-cache: true + - name: Test with Rake + run: script/cibuild diff --git a/Gemfile b/Gemfile index f3e5e27..83c8468 100644 --- a/Gemfile +++ b/Gemfile @@ -5,3 +5,8 @@ source "https://rubygems.org" gemspec gem "bridgetown", ENV["BRIDGETOWN_VERSION"] if ENV["BRIDGETOWN_VERSION"] +gem "bundler", ">= 1.15" +gem "html-proofer", "~> 3.7" +gem "rake", "~> 13.0" +gem "rspec", "~> 3.5" +gem "rubocop-bridgetown", "~> 0.3" diff --git a/bridgetown-seo-tag.gemspec b/bridgetown-seo-tag.gemspec index 6140bb9..92c058c 100644 --- a/bridgetown-seo-tag.gemspec +++ b/bridgetown-seo-tag.gemspec @@ -17,11 +17,5 @@ Gem::Specification.new do |spec| spec.require_paths = ["lib"] spec.add_dependency "bridgetown", ">= 1.2.0.beta5", "< 2.0" - - spec.add_development_dependency "bundler", ">= 1.15" - spec.add_development_dependency "html-proofer", "~> 3.7" - spec.add_development_dependency "rake", "~> 13.0" - spec.add_development_dependency "rspec", "~> 3.5" - spec.add_development_dependency "rubocop-bridgetown", "~> 0.3" spec.metadata["rubygems_mfa_required"] = "true" end diff --git a/lib/bridgetown-seo-tag/url_helper.rb b/lib/bridgetown-seo-tag/url_helper.rb index 1d54044..c675ca2 100644 --- a/lib/bridgetown-seo-tag/url_helper.rb +++ b/lib/bridgetown-seo-tag/url_helper.rb @@ -12,7 +12,7 @@ module UrlHelper # Retruns false if it's a relative URL # Returns nil if it is not a string or can't be parsed as a URL def absolute_url?(string) - return unless string + return false unless string Addressable::URI.parse(string).absolute? rescue Addressable::URI::InvalidURIError diff --git a/spec/bridgetown_seo_tag_integration_spec.rb b/spec/bridgetown_seo_tag_integration_spec.rb index 14c16e3..f22307c 100755 --- a/spec/bridgetown_seo_tag_integration_spec.rb +++ b/spec/bridgetown_seo_tag_integration_spec.rb @@ -290,6 +290,7 @@ it "minifies the output" do version = Bridgetown::SeoTag::VERSION + # rubocop:disable Bridgetown/HTMLEscapedHeredoc expected = <<~HTML Foo @@ -299,6 +300,7 @@ HTML + # rubocop:enable Bridgetown/HTMLEscapedHeredoc expect(output).to match(expected) end end