Skip to content

Commit

Permalink
v0.6: ActiveRecord v7 (#210)
Browse files Browse the repository at this point in the history
## [v0.6.0](https://github.com/mvgijssel/arel_toolkit/tree/v0.6.0) (2023-04)

- Tidy up local development stack
  - Ruby 3.2.x in docker container
  - Postgres 13.10
  - Use YJIT in local development
  - Bundler patch version .11
  - Removes appraisals
- CI: Much better coverage
  - Tests ruby 3.2 as well
  - Upgrade to postgres 13.10 from 13.04
  - Re-organize test-suite a bit
- Support activerecord 7
  - Drops support for activerecord 6, 5
- Upgrade nokogiri to mitigate libxml CVEs
- Version 0.6


Collateral damage:

Closes #118
  • Loading branch information
Zarthus authored Apr 17, 2023
1 parent 1121cb6 commit a0e3a70
Show file tree
Hide file tree
Showing 28 changed files with 115 additions and 438 deletions.
69 changes: 35 additions & 34 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Test Ruby 3
name: Test
on:
push:
branches:
Expand All @@ -9,14 +9,21 @@ jobs:
rspec:
name: RSpec
runs-on: ubuntu-22.04
strategy:
matrix:
ruby-version:
- '3.0'
- '3.2'
postgres-version:
- '13.10'
services:
postgres:
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
image: postgres:13.4
image: postgres:${{ matrix.postgres-version }}
ports:
- 5432:5432
env:
Expand All @@ -25,46 +32,40 @@ jobs:
POSTGRES_HOST_AUTH_METHOD: trust
steps:
- uses: actions/checkout@v3

# Based on https://github.com/paambaati/codeclimate-action/blob/0f8af43fca84b500025ca48b581bcff933244252/src/main.ts#L39-L57
- name: Set env for push event
run: |
GIT_BRANCH=$(echo "${{ github.ref }}" | sed 's/refs\/heads\///g')
echo "GIT_BRANCH=$GIT_BRANCH" >> $GITHUB_ENV
echo "GIT_COMMIT_SHA=${{ github.sha }}" >> $GITHUB_ENV
if: ${{ github.event_name == 'push' }}
- name: Set env for pull_request event
run: |
echo "GIT_BRANCH=${{ github.event.pull_request.head.ref }}" >> $GITHUB_ENV
echo "GIT_COMMIT_SHA=${{ github.event.pull_request.head.sha }}" >> $GITHUB_ENV
if: ${{ github.event_name == 'pull_request' }}

# From https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#contexts
- env:
GITHUB: ${{ toJson(github) }}
run: |
env
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
bundler: default
- run: bundle exec appraisal install
ruby-version: ${{ matrix.ruby-version }}
- name: Install
run: |
bundle install -j $(nproc)
- name: Compile extension
run: |
bundle exec rake clean
bundle exec rake compile
- name: Start coverage
run: |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
chmod +x ./cc-test-reporter
./cc-test-reporter before-build
- name: RSpec
run: |
bundle exec rspec --force-color
- name: Appraisal RSpec
run: |
bundle exec appraisal rspec --force-color
- uses: actions/upload-artifact@v3
with:
name: rspec-coverage
path: ./coverage
lint:
name: Lint
runs-on: ubuntu-22.04
strategy:
matrix:
ruby-version:
- '3.2'
steps:
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
bundler: default
ruby-version: ${{ matrix.ruby-version }}
- name: Install
run: |
bundle install -j $(nproc)
- name: Lint
run: |
bundle exec rubocop
43 changes: 0 additions & 43 deletions .github/workflows/test_rubylatest.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ruby 2.7.7
ruby 3.0.5
3 changes: 0 additions & 3 deletions Appraisals

This file was deleted.

19 changes: 18 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,23 @@
# Changelog

## [v0.5.0](https://github.com/mvgijssel/arel_toolkit/tree/v0.4.10) (2023-04)
## [v0.6.0](https://github.com/mvgijssel/arel_toolkit/tree/v0.6.0) (2023-04)

- Tidy up local development stack
- Ruby 3.2.x in docker container
- Postgres 13.10
- Use YJIT in local development
- Bundler patch version .11
- Removes appraisals
- CI: Much better coverage
- Tests ruby 3.2 as well
- Upgrade to postgres 13.10 from 13.04
- Re-organize test-suite a bit
- Support activerecord 7
- Drops support for activerecord 6, 5
- Upgrade nokogiri to mitigate libxml CVEs
- Version 0.6

## [v0.5.0](https://github.com/mvgijssel/arel_toolkit/tree/v0.5.0) (2023-04)

[Full Changelog](https://github.com/mvgijssel/arel_toolkit/compare/v0.4.9...v0.5.0)

Expand Down
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
FROM ruby:2.7.7
FROM ruby:3.2

WORKDIR /app

ENV RUBY_YJIT_ENABLE=1

COPY Gemfile Gemfile.lock arel_toolkit.gemspec /app/
COPY lib/arel_toolkit/version.rb /app/lib/arel_toolkit/
RUN bundle install
Expand Down
23 changes: 8 additions & 15 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,26 @@ PATH
remote: .
specs:
arel_toolkit (0.5.0)
activerecord (>= 6.1, < 7)
activerecord (>= 7.0, < 8)
pg (>= 1.1.4)
pg_query (~> 2.2)

GEM
remote: https://rubygems.org/
specs:
activemodel (6.1.7.3)
activesupport (= 6.1.7.3)
activerecord (6.1.7.3)
activemodel (= 6.1.7.3)
activesupport (= 6.1.7.3)
activesupport (6.1.7.3)
activemodel (7.0.4.3)
activesupport (= 7.0.4.3)
activerecord (7.0.4.3)
activemodel (= 7.0.4.3)
activesupport (= 7.0.4.3)
activesupport (7.0.4.3)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
zeitwerk (~> 2.3)
addressable (2.8.1)
public_suffix (>= 2.0.2, < 6.0)
ansi (1.5.0)
appraisal (2.4.1)
bundler
rake
thor (>= 0.14.0)
approvals (0.0.26)
json (~> 2.0)
nokogiri (~> 1.8)
Expand Down Expand Up @@ -222,13 +217,11 @@ GEM
webrick (1.7.0)
yard (0.9.28)
webrick (~> 1.7.0)
zeitwerk (2.6.7)

PLATFORMS
ruby

DEPENDENCIES
appraisal (~> 2.4.1)
approvals (~> 0.0.24)
arel_toolkit!
bundler (~> 2.0)
Expand Down Expand Up @@ -256,4 +249,4 @@ DEPENDENCIES
stackprof (~> 0.2)

BUNDLED WITH
2.4.10
2.4.11
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,6 @@ This gem aims to have full support for PostgreSQL's SQL. In order to do so, it n
1. Run `bin/setup` to install dependencies.
1. Start the postgres database `docker compose up`
1. Run `bundle exec rspec` to run the tests
1. Run `bundle exec appraisal rspec` to run the tests for the different gem sets

You can also run `bin/console` for an interactive prompt that will allow you to experiment. To install this gem onto your local machine, run `bundle exec rake install`.

Expand All @@ -156,7 +155,6 @@ You can also run `bin/console` for an interactive prompt that will allow you to
1. Update version in `version.rb`
1. Create a new branch `v<<VERSION_HERE>>`
1. Run `bundle install`
1. Run `bundle exec appraisal install`
1. Run `bundle exec rake changelog`
1. Commit the changes
1. Open a PR with name `Version <<VERSION_HERE>>` ([example](https://github.com/mvgijssel/arel_toolkit/pull/172))
Expand Down
3 changes: 1 addition & 2 deletions arel_toolkit.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Gem::Specification.new do |spec|
spec.require_paths = ['lib']
spec.extensions = ['ext/pg_result_init/extconf.rb']

spec.add_dependency 'activerecord', '>= 6.1', '< 7'
spec.add_dependency 'activerecord', '>= 7.0', '< 8'
spec.add_dependency 'pg', '>= 1.1.4'
spec.add_dependency 'pg_query', '~> 2.2'

Expand All @@ -37,7 +37,6 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'rake-compiler', '~> 1.0'
spec.add_development_dependency 'rspec', '~> 3.8'
spec.add_development_dependency 'approvals', '~> 0.0.24'
spec.add_development_dependency 'appraisal', '~> 2.4.1'
spec.add_development_dependency 'database_cleaner', '~> 1.7.0'
spec.add_development_dependency 'simplecov', '~> 0.16.1'
spec.add_development_dependency 'simplecov-console', '~> 0.4.2'
Expand Down
5 changes: 2 additions & 3 deletions bin/setup
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ asdf install
asdf reshim ruby

# Need specific version of bundler for this ruby version
gem install bundler -v 2.4.10
gem install bundler -v 2.4.11

# Make sure "bundle" is available
asdf reshim ruby

EXPECTED_VERSION="Bundler version 2.4.10"
EXPECTED_VERSION="Bundler version 2.4.11"
BUNDLER_VERSION=$(bundle --version)

if [[ "$BUNDLER_VERSION" != "$EXPECTED_VERSION" ]]; then
Expand All @@ -24,6 +24,5 @@ if [[ "$BUNDLER_VERSION" != "$EXPECTED_VERSION" ]]; then
fi

bundle install
bundle exec appraisal install
bundle exec rake clean
bundle exec rake compile
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
version: '3.8'
services:
database:
image: postgres:13.4
image: postgres:13.10
container_name: arel_toolkit_database
environment:
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
POSTGRES_DB: arel_toolkit_test
ports:
- 5432:5432
- "5432:5432"
arel_toolkit:
profiles:
- tests
Expand Down
7 changes: 0 additions & 7 deletions gemfiles/active_record_6_1_7.gemfile

This file was deleted.

Loading

0 comments on commit a0e3a70

Please sign in to comment.