From 40471e73374a17ba7d16cae2aaba0df53cac7e03 Mon Sep 17 00:00:00 2001 From: Jason Frey Date: Tue, 26 Mar 2024 13:47:05 -0400 Subject: [PATCH] Add GitHub Actions for CI Additionally fix an issue where the delegation module was not required --- .github/workflows/ci.yaml | 38 ++++++++++++++++++++++++++++++++++++++ .gitignore | 1 + .rspec | 1 + Gemfile | 6 ++++-- lib/servicenow.rb | 1 + spec/spec_helper.rb | 4 ++++ 6 files changed, 49 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/ci.yaml create mode 100644 .rspec diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..b6231be --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,38 @@ +name: CI + +on: + push: + pull_request: + schedule: + - cron: '0 0 * * 0' + workflow_dispatch: + +jobs: + ci: + runs-on: ubuntu-latest + strategy: + matrix: + ruby-version: + - '2.5' + - '2.6' + - '2.7' + - '3.0' + - '3.1' + rails-version: + - '5.2' + - '6.0' + - '6.1' + - '7.0' + env: + TEST_RAILS_VERSION: ${{ matrix.rails-version }} + CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} + steps: + - uses: actions/checkout@v4 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby-version }} + bundler-cache: true + timeout-minutes: 30 + - name: Run tests + run: bundle exec rake diff --git a/.gitignore b/.gitignore index 5011f4d..bd1f5de 100644 --- a/.gitignore +++ b/.gitignore @@ -56,3 +56,4 @@ build-iPhoneSimulator/ # .rubocop-https?--* Gemfile.lock +.rspec_status diff --git a/.rspec b/.rspec new file mode 100644 index 0000000..c99d2e7 --- /dev/null +++ b/.rspec @@ -0,0 +1 @@ +--require spec_helper diff --git a/Gemfile b/Gemfile index 2ca2854..1bbabcb 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,8 @@ source "https://rubygems.org" -git_source(:github) {|repo_name| "https://github.com/#{repo_name}" } - # Specify your gem's dependencies in servicenow-ruby.gemspec gemspec + +if ENV["TEST_RAILS_VERSION"] + gem "activesupport", "~> #{ENV["TEST_RAILS_VERSION"]}.0" +end diff --git a/lib/servicenow.rb b/lib/servicenow.rb index 141b3f6..9996cc3 100644 --- a/lib/servicenow.rb +++ b/lib/servicenow.rb @@ -2,6 +2,7 @@ require "active_support" require "active_support/core_ext/hash" +require "active_support/core_ext/module/delegation" module ServiceNow require "servicenow/api" diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb index 0c47393..60037bc 100644 --- a/spec/spec_helper.rb +++ b/spec/spec_helper.rb @@ -12,3 +12,7 @@ c.syntax = :expect end end + +require "active_support" +puts +puts "\e[93mUsing ActiveSupport #{ActiveSupport.version}\e[0m"