feat: Add support for Rails 8, Ruby 3, and latest GraphQL gem #127
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: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| env: | |
| BUNDLE_APP_CONFIG: .bundle | |
| jobs: | |
| ruby-lint: | |
| name: Ruby Lint (Ruby ${{ matrix.ruby }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| ruby: ['2.7', '3.4'] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: ${{ matrix.ruby }} | |
| bundler-cache: false | |
| - name: Install compatible bundler for Ruby 2.7 | |
| if: matrix.ruby == '2.7' | |
| run: | | |
| gem install bundler -v '~> 2.3.0' | |
| bundle config set --local path 'vendor/bundle' | |
| bundle config set --local frozen false | |
| bundle update --bundler | |
| - name: Configure bundler | |
| if: matrix.ruby != '2.7' | |
| run: | | |
| bundle config set --local path 'vendor/bundle' | |
| bundle config set --local frozen false | |
| - name: Install dependencies | |
| run: bundle install | |
| - name: Run RuboCop | |
| run: bundle exec rubocop | |
| ruby-test: | |
| name: Ruby Test (Ruby ${{ matrix.ruby }}, GraphQL ${{ matrix.graphql }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| ruby: ['2.7', '3.4'] | |
| graphql: ['graphql-2.0.19', 'graphql-2.3'] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: ${{ matrix.ruby }} | |
| bundler-cache: false | |
| - name: Install compatible bundler for Ruby 2.7 | |
| if: matrix.ruby == '2.7' | |
| run: | | |
| gem install bundler -v '~> 2.3.0' | |
| bundle config set --local path 'vendor/bundle' | |
| bundle config set --local frozen false | |
| bundle update --bundler | |
| - name: Configure bundler | |
| if: matrix.ruby != '2.7' | |
| run: | | |
| bundle config set --local path 'vendor/bundle' | |
| bundle config set --local frozen false | |
| - name: Install base dependencies | |
| run: bundle install | |
| - name: Generate appraisal gemfiles | |
| run: bundle exec appraisal generate | |
| - name: Install appraisal dependencies | |
| run: bundle exec appraisal ${{ matrix.graphql }} bundle install | |
| - name: Run RSpec | |
| run: bundle exec appraisal ${{ matrix.graphql }} rspec | |
| integration-tests: | |
| name: Integration Tests (Ruby ${{ matrix.ruby }}, GraphQL ${{ matrix.graphql }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| ruby: ['2.7', '3.4'] | |
| graphql: ['graphql-2.0.19', 'graphql-2.3'] | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: ${{ matrix.ruby }} | |
| bundler-cache: false | |
| - name: Install compatible bundler for Ruby 2.7 | |
| if: matrix.ruby == '2.7' | |
| run: | | |
| gem install bundler -v '~> 2.3.0' | |
| bundle config set --local path 'vendor/bundle' | |
| bundle config set --local frozen false | |
| bundle update --bundler | |
| - name: Configure bundler | |
| if: matrix.ruby != '2.7' | |
| run: | | |
| bundle config set --local path 'vendor/bundle' | |
| bundle config set --local frozen false | |
| - name: Install base dependencies | |
| run: bundle install | |
| - name: Generate appraisal gemfiles | |
| run: bundle exec appraisal generate | |
| - name: Install appraisal dependencies | |
| run: bundle exec appraisal ${{ matrix.graphql }} bundle install | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'yarn' | |
| - name: Install yarn dependencies | |
| run: yarn install --frozen-lockfile | |
| - name: Run yarn tests | |
| run: bundle exec appraisal ${{ matrix.graphql }} yarn test | |
| - name: Run yarn lint | |
| run: yarn lint | |
| release: | |
| name: Release | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| needs: [ruby-lint, ruby-test, integration-tests] | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Set up Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: '3.4' | |
| bundler-cache: true | |
| - name: Configure bundler for semantic-release | |
| run: bundle config set --local frozen false | |
| - name: Configure git for semantic-release | |
| run: | | |
| git config --global user.name "semantic-release-bot" | |
| git config --global user.email "[email protected]" | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'yarn' | |
| - name: Install yarn dependencies | |
| run: yarn install --frozen-lockfile | |
| - name: Run semantic-release | |
| run: npx semantic-release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }} |