Skip to content

Commit

Permalink
Upgrading Ruby and the CircleCI to support the RVM CircleCI Orb (#758)
Browse files Browse the repository at this point in the history
* Updating Ruby to release 3.3.1

* Upgrading Ruby and the CircleCI to support the RVM CircleCI Orb

---------

Co-authored-by: Bess Sadler <[email protected]>
  • Loading branch information
jrgriffiniii and bess authored Jun 17, 2024
1 parent 7528273 commit accebbc
Show file tree
Hide file tree
Showing 6 changed files with 323 additions and 227 deletions.
117 changes: 99 additions & 18 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,33 @@
version: 2.1

orbs:
browser-tools: circleci/[email protected]
ruby: circleci/[email protected]

commands:
install_ruby:
steps:
- run: sudo apt update
- run: sudo NEEDRESTART_MODE=a apt install -y postgresql-client libmsgpack-dev libpq-dev libgnutls-openssl27
- run:
name: Import the GPG2 keys
command: |
curl -sSL https://rvm.io/mpapis.asc | sudo gpg2 --import -
curl -sSL https://rvm.io/pkuczynski.asc | sudo gpg2 --import -
- ruby/install:
version: '3.3.2'
- ruby/install-deps:
pre-install-steps:
- run:
name: reinstall
command: |
rvm get stable
rvm autolibs enable
rvm reinstall ruby-3.3.2
install_dependencies:
steps:
- run: rbenv install 3.2.3
- run: gem install bundler -v '2.5.6'
- run: gem install bundler -v '2.5.11'
- run: cp Gemfile.lock Gemfile.lock.bak
- restore_cache:
key: &gem_key tiger_data-cimg-{{ checksum "Gemfile.lock.bak" }}
Expand All @@ -25,52 +49,96 @@ commands:
key: *yarn_key
paths:
- ~/.cache/yarn

run_mediaflux:
steps:
- run: echo "$DOCKERHUB_PASSWORD" | docker login --username $DOCKERHUB_USERNAME --password-stdin
- run: docker run -d --privileged --name mediaflux --publish 0.0.0.0:8888:8888 --mac-address 02:42:ac:11:00:02 eosadler/mediaflux_dev:4
- run: echo "$DOCKERHUB_PASSWORD" | docker login --username $DOCKERHUB_USERNAME --password-stdin
- run: sudo apt-get update
- run: sudo apt-cache search docker
- run: sudo apt-get install -y docker-ce-cli
- run: docker run --help
- run: docker run -d --privileged --name mediaflux --publish 0.0.0.0:8888:8888 --mac-address 02:42:ac:11:00:02 eosadler/mediaflux_dev:4

run_postgres:
steps:
- run: docker create --name postgres --publish 0.0.0.0:5432:5432 --env POSTGRES_HOST_AUTH_METHOD=trust --env POSTGRES_DB=test_db --env POSTGRES_USER=tiger_data_user postgres:13.5-alpine
- run: docker start postgres
orbs:
browser-tools: circleci/[email protected]
ruby: circleci/[email protected]

jobs:
build: # name of your job
working_directory: ~/tiger_data
machine: # executor type
machine: &machine # executor type
image: default
docker_layer_caching: true
environment:
POSTGRES_USER: tiger_data_user
POSTGRES_DB: test_db
POSTGRES_HOST_AUTH_METHOD: trust
POSTGRES_USER: tiger_data_user
POSTGRES_DB: test_db
POSTGRES_HOST_AUTH_METHOD: trust
steps:
- checkout
- run: sudo apt update && sudo apt install postgresql-client libmsgpack-dev libpq-dev
- checkout
- install_ruby
- install_dependencies
- persist_to_workspace:
root: &root '~/tiger_data'
paths: '*'

rubocop:
working_directory: ~/tiger_data
machine: *machine
steps:
- attach_workspace:
at: *root
- install_ruby
- run:
name: Run rubocop
command: bundle exec rubocop
paths: '*'

eslint:
working_directory: ~/tiger_data
machine: *machine
steps:
- attach_workspace:
at: *root
- install_ruby
- install_dependencies
- run:
name: Run eslint
command: yarn run eslint 'app/javascript/**'
- persist_to_workspace:
root: &root '~/tiger_data'
paths: '*'

vitest:
working_directory: ~/tiger_data
machine: *machine
steps:
- attach_workspace:
at: *root
- install_ruby
- install_dependencies
- run:
name: Run vitest
command: yarn run vitest run --coverage
- persist_to_workspace:
root: &root '~/tiger_data'
paths: '*'

rspec:
working_directory: ~/tiger_data
machine: *machine
steps:
- attach_workspace:
at: *root
- install_ruby
- install_dependencies
# wait for postgres and mediaflux
- run_mediaflux
- run_postgres
# wait for postgres and mediaflux
- run: sleep 10
- run: bundle exec rake db:migrate RAILS_ENV=test
- run: bundle exec rake schema:create
- run:
name: Run Rspec
name: Run RSpec
command: COVERALLS_REPO_TOKEN=$COVERALLS_REPO_TOKEN bundle exec rspec --format progress --format RspecJunitFormatter -o /tmp/rspec/rspec.xml
- store_test_results:
path: /tmp/rspec
Expand All @@ -81,6 +149,19 @@ jobs:

workflows:
version: 2
build_accept_deploy:
ci:
jobs:
- build
- build
- rubocop:
requires:
- build
- eslint:
requires:
- build
- vitest:
requires:
- build
- rspec:
requires:
- build

2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.2.3
3.3.2
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ruby 3.2.3
ruby 3.3.2
nodejs 18.14.0
yarn 1.22.19
java openjdk-19.0.2
7 changes: 2 additions & 5 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
source "https://rubygems.org"
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby "3.2.3"
ruby "3.3.2"

# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
gem "rails", "~> 7.0.4", ">= 7.0.4.2"
Expand Down Expand Up @@ -56,6 +56,7 @@ gem "vite_rails"
gem "devise"
gem "omniauth-cas"

gem "csv"
gem "datacite", github: "sul-dlss/datacite-ruby", branch: "main"
gem "dogstatsd-ruby"
gem "google-protobuf", "~> 3.0"
Expand All @@ -71,13 +72,9 @@ group :staging, :production do
end

group :development, :test do
# See https://guides.rubyonrails.org/debugging_rails_applications.html#debugging-with-the-debug-gem
gem "debug", platforms: %i[mri mingw x64_mingw]

gem "rspec-rails", "~> 6.0.0"

gem "bixby"
gem "pry-byebug"
gem "pry-rails"

gem "bcrypt_pbkdf"
Expand Down
Loading

0 comments on commit accebbc

Please sign in to comment.