Skip to content

Commit

Permalink
Merge pull request #552 from ozfortress/rails-upgrade
Browse files Browse the repository at this point in the history
Rails 7 Upgrade
  • Loading branch information
BenjaminSchaaf authored Aug 17, 2024
2 parents e59ec20 + cfe100d commit 5025e41
Show file tree
Hide file tree
Showing 82 changed files with 515 additions and 440 deletions.
45 changes: 18 additions & 27 deletions .github/workflows/rails.yml
Original file line number Diff line number Diff line change
@@ -1,55 +1,46 @@
name: Rails
on: push
on:
- push
- workflow_dispatch

jobs:
verify:
name: Build
runs-on: ubuntu-latest
env:
BUNDLE_PATH: vendor/bundle
BUNDLE_WITHOUT: development
SECRET_KEY_BASE: ad4d97aef89588c346638cfe689f667f06bc29d2c40724107558e5d4defe723e42cfb294cdb25d7e3241195cfb7cc952e8a2c1680460bea4904bd79d21784307
STEAM_API_KEY: abcd1234
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

services:
postgres:
image: postgres:9.5
image: postgres:16.2
env:
POSTGRES_USER: citadel
POSTGRES_PASSWORD: citadel
ports: ["5432:5432"]

steps:
- uses: actions/checkout@v1
- name: Install ruby
uses: actions/setup-ruby@v1
with:
ruby-version: 2.5.x
- name: Setup Cache
uses: actions/cache@v2
with:
path: vendor/bundle
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
restore-keys: |
${{ runner.os }}-gems-
- name: Install dependencies
run: |
sudo apt-get -yqq install libpq-dev build-essential libcurl4-openssl-dev
gem install bundler
bundle config path vendor/bundle
bundle config set --local without 'development'
bundle install --jobs 4 --retry 3
sudo apt-get -yqq install libpq-dev libyaml-dev build-essential libcurl4-openssl-dev
- name: Install ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1.6
bundler-cache: true
- name: Setup database
env:
RAILS_ENV: test
PGHOST: localhost
run: |
cp config/database.yml.github config/database.yml
cp config/secrets.local.yml.example secrets.local.yml
rake "parallel:setup[2]"
bundle exec rake "parallel:setup"
- name: Run tests
env:
RAILS_ENV: test
PGHOST: localhost
run: rake test
- name: Upload coverage
env:
RAILS_ENV: test
PGHOST: localhost
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
run: rake codecov:upload
run: bundle exec rake test
14 changes: 10 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,6 @@ capybara-*.html
rerun.txt
pickle-email-*.html

# TODO Comment out these rules if you are OK with secrets being uploaded to the repo
config/initializers/secret_token.rb
config/secrets.local.yml

## Environment normalization:
/.bundle
/vendor/bundle
Expand All @@ -77,6 +73,16 @@ bower.json
# Ignore pow environment settings
.powenv

# Ignore rubocop cache
.cache

# Ignore node stuff
.npm

# CarrierWave
public/uploads
spec/carrierwave

# Ignore credentials
/config/master.key
/config/credentials.yml.enc
10 changes: 10 additions & 0 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@ require: rubocop-rails

Rails:
Enabled: true
Rails/ActionOrder:
Enabled: false
Rails/I18nLocaleTexts:
Enabled: false
Rails/UniqueValidationWithoutIndex:
Enabled: false
Rails/ApplicationRecord:
Exclude:
- 'lib/**/*'
Expand Down Expand Up @@ -45,6 +51,8 @@ Style/FormatStringToken:
EnforcedStyle: template
Style/StringConcatenation:
Enabled: false
Style/NegatedIfElseCondition:
Enabled: false
Style/MixinUsage:
Exclude:
- 'bin/setup'
Expand All @@ -56,6 +64,8 @@ Naming/MethodParameterName:
MinNameLength: 2
AllowedNames:
- _
Naming/VariableNumber:
Enabled: false

# 'old' style
Style/EmptyMethod:
Expand Down
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.1.2
19 changes: 11 additions & 8 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
source 'https://rubygems.org'

gem 'rails', '~> 5.2.1'
gem 'rails', '~> 7.1.0'
gem 'rake', '~> 12.0'
gem 'sprockets-rails'
# Use postgres
gem 'pg', '~> 1.0'
# Fast loading
Expand All @@ -10,11 +11,11 @@ gem 'pg', '~> 1.0'
gem 'active_record_union', '~> 1.3'
gem 'ancestry'
# SASS for stylesheets
gem 'sass-rails', '~> 5.0'
gem 'sass-rails', '~> 6'
# Compress JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2.0'
gem 'coffee-rails', '~> 5'
# Easy styling
gem 'bootstrap', '~> 4.5.0'
# Easy bootstrap forms
Expand Down Expand Up @@ -50,10 +51,12 @@ gem 'active_model_serializers', '~> 0.10.0'
gem 'counter_culture', '~> 2.0'
# Tournament systems
gem 'tournament-system', '~> 2.0'
# Backwards compatibility with ruby 2
gem 'scanf'

group :test do
# Use rspec for tests
gem 'rspec-rails', '~> 3.8'
gem 'rspec-rails', '~> 6'

# Parallelize tests
gem 'parallel_tests'
Expand All @@ -68,17 +71,17 @@ group :test do
gem 'database_cleaner'

# Easy database manipulation
gem 'factory_bot_rails', '~> 4'
gem 'factory_bot_rails', '~> 6'

# Web feature testing
gem 'capybara'

# Keep codebase clean
gem 'haml_lint', require: false
gem 'rails_best_practices', require: false
gem 'reek', '~> 5', require: false
gem 'rubocop', '~> 0.58', require: false
gem 'rubocop-rails', '~> 2.2.1', require: false
gem 'reek', '~> 6', require: false
gem 'rubocop', '~> 1.64.1', require: false
gem 'rubocop-rails', '~> 2.25.0', require: false

gem 'codecov', require: false
end
Expand Down
Loading

0 comments on commit 5025e41

Please sign in to comment.