update CI configuration and demo script to run the demo with Ruby 2.7.8 as a workaround for GitHub Action Ruby limitation. #125
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: serpapi-ruby | |
| on: | |
| push: | |
| branches: [ master, dev ] | |
| pull_request: | |
| branches: [ master ] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| # 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@v4 | |
| - name: Set up Ruby ${{ matrix.ruby-version }} | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: ${{ matrix.ruby-version }} | |
| - name: Install dependencies | |
| run: bundle install | |
| - name: lint | |
| run: bundle exec rake lint | |
| - name: tests | |
| env: | |
| SERPAPI_KEY: ${{ secrets.SERPAPI_KEY }} | |
| run: bundle exec rake test | |
| - name: oobt | |
| 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 |