Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

required Ruby 2.7, add new CI workflow with graphql-ruby master branch #14

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby: [ '2.6', '2.7', '3.0' ]
ruby: [ '2.7', '3.0', '3.1', '3.2' ]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2.7 is dead for 7 months already, maybe we can drop it too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm, okay, thanks :)
done

env:
RUBY_IMAGE: ${{ matrix.ruby }}
name: Ruby ${{ matrix.ruby }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.0
ruby-version: ${{ matrix.ruby }}
- name: Install dependencies
run: |
gem install dip
Expand Down
69 changes: 69 additions & 0 deletions .github/workflows/ruby_edge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Edge Build

on:
push:
branches: [ master ]
pull_request:
schedule:
- cron: "10 4 * * */2"

jobs:
edge-test:
runs-on: ubuntu-latest
env:
BUNDLE_JOBS: 4
BUNDLE_RETRY: 3
BUNDLE_GEMFILE: gemfiles/graphql_master.gemfile
DATABASE_URL: postgres://postgres:postgres@localhost:5432
ELASTICSEARCH_URL: http://localhost:9200
Comment on lines +17 to +18
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need these two? The setup must be similar to ruby.yml, the only difference is the Gemfile.

And I'm not sure we need to extract this into a separate workflow; it can be another parameter in the ruby.yml matrix.

Also, ruby_edge is a confusing name; we're not testing against edge Ruby but graphql gem.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because in the matrix we put "head" ruby (for master ruby), and this ruby version puts RUBY_VERSION to the docker file through env (it is default, like ci cd looks for ruby.yml).
So Docker doesn't know about the "head" ruby version.
Also, I couldn't find the image with the master ruby

About naming - OK, agree

CI: true
strategy:
fail-fast: false
matrix:
ruby: [ '2.7', '3.0', '3.1', '3.2', head ]
services:
postgres:
image: postgres:13
ports: ["5432:5432"]
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5

elasticsearch:
image: elasticsearch:7.12.1
ports:
- 9200:9200
env:
ES_JAVA_OPTS: -Xms64m -Xmx256m
discovery.type: single-node
http.cors.enabled: "true"
bootstrap.memory_lock: "true"
options: >-
--health-cmd "curl http://localhost:9200/_cluster/health"
--health-interval 10s
--health-timeout 5s
--health-retries 10
steps:
- uses: actions/checkout@v4
- name: Install system deps
run: |
sudo apt-get update
sudo apt-get -yqq install libpq-dev
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Create DB
run: |
env PGPASSWORD=postgres createdb -h localhost -U postgres graphql_paging
- name: Run Standard commands
run: |
bundle exec standardrb
- name: Run RSpec
run: |
bundle exec rspec -f d --force-color

2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/_yardoc/
/coverage/
/doc/
/gemfiles/
/gemfiles/*.lock
/pkg/
/spec/reports/
/tmp/
Expand Down
2 changes: 1 addition & 1 deletion .standard.yml
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ruby_version: 2.6
ruby_version: 2.7
5 changes: 5 additions & 0 deletions gemfiles/graphql_master.gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
source "https://rubygems.org"

gem "graphql", github: "rmosolgo/graphql-ruby"

gemspec path: ".."
4 changes: 2 additions & 2 deletions graphql-connections.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ Gem::Specification.new do |spec|
spec.bindir = "exe"
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]
spec.required_ruby_version = "> 2.5"
spec.required_ruby_version = ">= 2.7"

spec.add_runtime_dependency "activerecord", ">= 5"
spec.add_runtime_dependency "graphql", [">= 1.10", "< 3.0"]
spec.add_runtime_dependency "graphql", ">= 1.10"

spec.add_development_dependency "bundler", ">= 1.16"
spec.add_development_dependency "factory_bot_rails", "~> 6.2"
Expand Down
3 changes: 2 additions & 1 deletion lib/graphql/connections/keyset/asc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def has_next_page
false
end
end
# rubocop:enable Naming/PredicateName, Metrics/AbcSize, Metrics/MethodLength
# rubocop:enable Naming/PredicateName

private

Expand Down Expand Up @@ -82,3 +82,4 @@ def sliced_relation_before(relation)
end
end
end
# rubocop:enable Metrics/AbcSize
2 changes: 1 addition & 1 deletion lib/graphql/connections/keyset/desc.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def has_next_page
false
end
end
# rubocop:enable Naming/PredicateName, Metrics/AbcSize, Metrics/MethodLength
# rubocop:enable Naming/PredicateName

def cursor_for(item)
cursor = [item[field_key], item[primary_key]].map { |value| serialize(value) }.join(@separator)
Expand Down