From fdcc77a1e4cf9f03bf39e33a2a2d3128d96083b6 Mon Sep 17 00:00:00 2001 From: Victor Benarbia Date: Tue, 12 Aug 2025 19:56:53 -0500 Subject: [PATCH 1/4] update CI configuration and demo script to run the demo with Ruby 2.7.8 as a workaround for GitHub Action Ruby limitation. --- .github/workflows/ci.yml | 18 ++++++++++++++---- .gitignore | 3 --- demo/demo.rb | 2 ++ 3 files changed, 16 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6a93059..23fba83 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,12 +9,14 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - ruby-version: ['3.1.0','head'] # test only recommend Ruby version (and stable version on the gitaction server) - # ruby-version: ['2.7.4','3.1.0','head'] + # test only recommend Ruby version (and stable version on the gitaction server) + # GitHub action github.com/ruby/setup-ruby is pretty unstable with older Ruby version + dependencies + # so, we only run a basic example with Ruby 2.7.8 after install the gem from the local build + ruby-version: ['3.1.0','head'] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Ruby ${{ matrix.ruby-version }} - uses: ruby/setup-ruby@359bebbc29cbe6c87da6bc9ea3bc930432750108 + uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby-version }} - name: Install dependencies @@ -29,3 +31,11 @@ jobs: env: SERPAPI_KEY: ${{ secrets.SERPAPI_KEY }} run: bundle exec rake oobt + - name: Run example with ruby 2.7.8 + uses: ruby/setup-ruby@v1 + with: + ruby-version: '2.7.8' + - name: Install and run demo 2.7.8 + env: + SERPAPI_KEY: ${{ secrets.SERPAPI_KEY }} + run: rake install && ruby demo/demo.rb \ No newline at end of file diff --git a/.gitignore b/.gitignore index 00f8b34..0f32379 100644 --- a/.gitignore +++ b/.gitignore @@ -30,9 +30,6 @@ test.rb ## Text Editor .vscode -Gemfile.lock -build_table.rb - # local script only /script README_ruby_EXAMPLE_SECTION.md diff --git a/demo/demo.rb b/demo/demo.rb index a0af3ec..3b9add1 100644 --- a/demo/demo.rb +++ b/demo/demo.rb @@ -9,6 +9,8 @@ require 'pp' require 'serpapi' +puts "SerpApi Ruby Client Example with Ruby version: #{RUBY_VERSION}" + # client initialization with default parameters client = SerpApi::Client.new( engine: 'google', From 0f96c58e12f5baeed9cb269d195afa1661aeb010 Mon Sep 17 00:00:00 2001 From: Victor Benarbia Date: Tue, 12 Aug 2025 20:00:56 -0500 Subject: [PATCH 2/4] Ruby 2.5 is too unstable to work with dependency replacing by latest stable ruby version 3.4.5 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 23fba83..edc6f15 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ jobs: # test only recommend Ruby version (and stable version on the gitaction server) # GitHub action github.com/ruby/setup-ruby is pretty unstable with older Ruby version + dependencies # so, we only run a basic example with Ruby 2.7.8 after install the gem from the local build - ruby-version: ['3.1.0','head'] + ruby-version: ['3.1.0','3.4.5'] steps: - uses: actions/checkout@v4 - name: Set up Ruby ${{ matrix.ruby-version }} From 91711c8f816ce1e1f7ed72642c77c1209297afcd Mon Sep 17 00:00:00 2001 From: Victor Benarbia Date: Tue, 12 Aug 2025 20:03:56 -0500 Subject: [PATCH 3/4] Remove rake dependency when ruby 2.7.8 is the current ruby version --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index edc6f15..833c17d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -38,4 +38,4 @@ jobs: - name: Install and run demo 2.7.8 env: SERPAPI_KEY: ${{ secrets.SERPAPI_KEY }} - run: rake install && ruby demo/demo.rb \ No newline at end of file + run: gem install ./serpapi-*.gem && ruby demo/demo.rb \ No newline at end of file From d3a07d09e35e99cd64c339c99afd4040a1820d37 Mon Sep 17 00:00:00 2001 From: Victor Benarbia Date: Tue, 12 Aug 2025 20:08:22 -0500 Subject: [PATCH 4/4] test ruby 2.7.8 only with 3.1.0 selected in the matrix --- .github/workflows/ci.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 833c17d..8b65a97 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,9 +33,13 @@ jobs: run: bundle exec rake oobt - name: Run example with ruby 2.7.8 uses: ruby/setup-ruby@v1 + if: matrix.ruby-version == '3.1.0' with: ruby-version: '2.7.8' - name: Install and run demo 2.7.8 + if: matrix.ruby-version == '3.1.0' env: SERPAPI_KEY: ${{ secrets.SERPAPI_KEY }} - run: gem install ./serpapi-*.gem && ruby demo/demo.rb \ No newline at end of file + run: | + gem install ./serpapi-*.gem + ruby demo/demo.rb \ No newline at end of file