Skip to content

Commit

Permalink
Upgrade to Rails 7 and latest JS/CSS Tooling (#2290)
Browse files Browse the repository at this point in the history
* Bump Gem to Rails 7, and switch to Ruby 3.0.3

Run rails app:update

Start process of porting CSS to Tailwind 3

Use propshaft instead of sprockets

WIP Use esbuild not webpack

Fix trailing whitespace lint error

Update Dockerfile to Rails 3.0.3

Fix init.sql for mysql 8

Fix connecting to database

Normalize quotes

Enable yarn build in background

Disable js watch

Work

Missing files

Get icons working

Allow importing manifest

Use asset url helper

Remove dynamic require

Remove webpack-specific files

Temporarily use local exercism config

Temporarily use local exercism config

Copy config items

Update manifest

Win

Refactor code

Remove unused define

Update

Change vendor prefix

Update

Enable watch mode for js

Minify JS in production

Minify CSS in production

Remove unused code

Remove webpack bin scripts

Move listen gem out of development group

Update manifest in background

Ignore javascript config files

Upgrade config to  0.81.0

Use .config dir

Apply review comments

Upgrade to Ruby 3.1.0

Update bundler version

Fixes rubygems/rubygems#5234

Rename monitor_manifest to monitor-manifest

Upgrade to Rails 7.0.1

Remove webpack references

Exclude file

Fix anycable

Fix anycable

Fix css name

Remove webpacker helper references

Fix passing of params to I18N

Fix asset paths

Fix i18n call

Fix more tests

Add .keep file for .config dir

Add .keep file

Fix esbuild

Some tweaks (#2329)

Co-authored-by: Erik Schierboom <erik_schierboom@hotmail.com>

Fix timestamp test

Fix old image_pack_url

Fix path

Use git version for mysql gem

Remove image

Update Setup Ruby workflow

Add missing package

Don't run tests serially

Fix manifest import

Don't use esbuild-jest

Remove svg plugin

Upate lockfile

Add TODO

Fix rails tests

Build for browserslist

Fix failing tests

Fix failing tests

Fix duplicate key exception in seeds.rb

See https://blog.saeloun.com/2021/03/08/rails-6-1-adds-excluding-to-active-record-relation.html for the .excluding method

Fix websockets

Fix icon call

Fix icons in notifications (#2333)

* Fix icons in notifications

* Fix more stuff

Fix image url for blog post

Sync blog and main docs in seeding

Update octokit

This fixes a warning: octokit/octokit.rb#1359

Fix deprecation warning

Build test.js file

Fix uri encode test

Remove unused import

Use test:prepare instead of assets:precompile

Add empty string to tag.div

Fix omniauth

Write manifest JSON files in test helper

Fix modal argument

Enable esbuild splitting (#2342)

* Enable esbuild splitting

* Add comment

Update migrations to 7.0

Fix CSS classes not inheriting correctly

Add precision to datetime columns

Fix invalid error icon

Remove unused import

Fix non-unique key

Fix JS bug

Moves highlighters CSS to postcss

Remove socket configuration (#2341)

* Member badge shouldn't use estimate for percentage awardees (#2330)

* Remove socket configuration

Co-authored-by: Jeremy Walker <jez.walker@gmail.com>

Member badge shouldn't use estimate for percentage awardees (#2330)

Don't consider wip prerequisites (#2344)

* Don't consider wip prerequisites

* Rename to learnable_concept_slugs

Add timeouts to CI builds (#2331)

* Add timeouts to CI builds

Right now the builds are all stuck for some reason, clogging up the queues. They normal appear to be taking ~2-3 minutes, so a timeout of 30 minutes should be more than enough to prevent this issue in the future.

* Add system tests & rubocup

[skip ci]

Set num_loc correctly when publishing a solution (#2260)

* Set num_loc correctly when publishing a solution

* DRY up publishing and publishing iteration

Co-authored-by: Jeremy Walker <jez.walker@gmail.com>

Fix typo in bug report modal (#2339)

Add first draft of fundraising job role (#2337)

* Add first draft of fundraising job role

* Spelling

* Improve

* Tweaks from DJ

* More tweaks

* Add more

* Tweaks

* Tweaks

* Final tweak

Update setup-ruby action

DRY up code around tooling files (#2257)

* DRY up logic slightly

* Add tests to verify editor files

* Use proper directory

* Fix representation file paths

* DRY further (#2348)

Co-authored-by: Jeremy Walker <jez.walker@gmail.com>

Allow sorting user solutions by most starred (#2238)

* Allow sorting user solutions by num stars

* Allow sorting user published solutions by most stars

* Update system test

* Fix sorting in test

* Improve default of sorting

* Fix many tests

rails 7 rubocop (#2349)

* Update rubocop gems

* Format using rubocop

* Add num_stars

* Fix rubocop warning

* Remove active storage migrations

* Rename .manifest.json.d.ts to manifest.json.d.ts

* Make monitor manifest a 1-time opp in CI

* Fix bug in test helper

* Call super

* Fix tests

* Seperate generate js config into its own file

* Fix production nodejs build

* Fix production rails dockerfile

* Fix production rails dockerfile

* Fix assets sync

* Fix production docker build

* Workaround for NODE_ENV=production yarn install not installing devDependencies

* Use RAILS_ENV=production

* Fix failing test

* Only deploy website to website-staging

Co-authored-by: Erik Schierboom <erik_schierboom@hotmail.com>
  • Loading branch information
iHiD and ErikSchierboom authored Feb 3, 2022
1 parent dd39b70 commit 93b4d92
Show file tree
Hide file tree
Showing 552 changed files with 5,315 additions and 11,118 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ module.exports = {
version: 'detect',
},
},
ignorePatterns: ['**/*.config.js', '**/config/webpack/*.js', '.eslintrc.js'],
ignorePatterns: ['**/*.config.js', '.eslintrc.js'],
overrides: [
{
files: ['*.ts', '*.tsx'],
Expand Down
56 changes: 28 additions & 28 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ env:
sidekiq_cluster_name: sidekiq

website_task_definition_name: website
website_service_name: website
website_service_name: website-staging

api_task_definition_name: api
api_service_name: api
# api_service_name: api

anycable_task_definition_name: anycable
anycable_service_name: anycable
# anycable_service_name: anycable

sidekiq_task_definition_name: sidekiq
sidekiq_service_name: sidekiq
# sidekiq_service_name: sidekiq

ecr_repository_rails: "webserver-rails"
dockerfile_rails: "docker/rails.Dockerfile"
Expand Down Expand Up @@ -95,12 +95,12 @@ jobs:
- name: Copy assets from Dockerfile
run: |
container_id=$(docker create website)
docker cp ${container_id}:/opt/exercism/website/current/public/packs packs
docker cp ${container_id}:/opt/exercism/website/.built-assets assets
docker rm ${container_id}
- name: Upload assets to s3
run: |
aws s3 sync packs s3://${{ env.s3_bucket }}/packs/ --acl public-read --no-progress --cache-control max-age=31536000
aws s3 sync assets s3://${{ env.s3_bucket }} --acl public-read --no-progress --cache-control max-age=31536000
#########################
#########################
Expand Down Expand Up @@ -194,13 +194,13 @@ jobs:
image: "${{ steps.build_nginx.outputs.image }}"

# Push the new definition up to ECS and deploy the new service from it
- name: Deploy API
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
with:
task-definition: ${{ steps.update_definition_for_api_nginx.outputs.task-definition }}
service: ${{ env.api_service_name }}
cluster: ${{ env.webservers_cluster_name }}
wait-for-service-stability: false
# - name: Deploy API
# uses: aws-actions/amazon-ecs-deploy-task-definition@v1
# with:
# task-definition: ${{ steps.update_definition_for_api_nginx.outputs.task-definition }}
# service: ${{ env.api_service_name }}
# cluster: ${{ env.webservers_cluster_name }}
# wait-for-service-stability: false

##################################
##################################
Expand Down Expand Up @@ -240,13 +240,13 @@ jobs:
image: "${{ steps.build_nginx.outputs.image }}"

# Push the new definition up to ECS and deploy the new service from it
- name: Deploy Anycable
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
with:
task-definition: ${{ steps.update_definition_for_anycable_nginx.outputs.task-definition }}
service: ${{ env.anycable_service_name }}
cluster: ${{ env.webservers_cluster_name }}
wait-for-service-stability: false
# - name: Deploy Anycable
# uses: aws-actions/amazon-ecs-deploy-task-definition@v1
# with:
# task-definition: ${{ steps.update_definition_for_anycable_nginx.outputs.task-definition }}
# service: ${{ env.anycable_service_name }}
# cluster: ${{ env.webservers_cluster_name }}
# wait-for-service-stability: false

##################################
##################################
Expand All @@ -271,11 +271,11 @@ jobs:
image: "${{ steps.build_rails.outputs.image }}"

# Push the new definition up to ECS and deploy a new service from it.
- name: Deploy Sidekiq
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
with:
# Ensure this is the final step in the daisy-chain above
task-definition: ${{ steps.update_definition_for_sidekiq.outputs.task-definition }}
service: ${{ env.sidekiq_service_name }}
cluster: ${{ env.sidekiq_cluster_name }}
wait-for-service-stability: true
# - name: Deploy Sidekiq
# uses: aws-actions/amazon-ecs-deploy-task-definition@v1
# with:
# # Ensure this is the final step in the daisy-chain above
# task-definition: ${{ steps.update_definition_for_sidekiq.outputs.task-definition }}
# service: ${{ env.sidekiq_service_name }}
# cluster: ${{ env.sidekiq_cluster_name }}
# wait-for-service-stability: true
32 changes: 24 additions & 8 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- uses: actions/checkout@v2

- name: Set up Ruby
uses: ruby/setup-ruby@b161cb92f0e2f28d992f04f38fff204d84132c47
uses: ruby/setup-ruby@fabf2515e6b5531555983e2641f2acdf622b0e50
with:
ruby-version: .ruby-version

Expand Down Expand Up @@ -78,7 +78,7 @@ jobs:
###
# Run the tests
- name: Run JS tests
run: yarn test --runInBand
run: yarn test

#####################
##### RUBY TESTS ####
Expand Down Expand Up @@ -154,7 +154,7 @@ jobs:
###
# Setup Ruby
- name: Set up Ruby
uses: ruby/setup-ruby@b161cb92f0e2f28d992f04f38fff204d84132c47
uses: ruby/setup-ruby@fabf2515e6b5531555983e2641f2acdf622b0e50
with:
ruby-version: .ruby-version
bundler-cache: true
Expand Down Expand Up @@ -198,6 +198,19 @@ jobs:
bundle exec setup_exercism_config
bundle exec setup_exercism_local_aws
###
# Precompile JS
- name: Precompile JS
env:
RAILS_ENV: test
NODE_ENV: development
EXERCISM_CI: true
AWS_PORT: ${{ job.services.aws.ports['4566'] }}
MYSQL_PORT: ${{ job.services.mysql.ports['3306'] }}
run: |
bundle exec rails r bin/monitor-manifest
bundle exec rails test:prepare
###
# Run the tests
- name: Run Ruby tests
Expand All @@ -209,8 +222,9 @@ jobs:
OPENSEARCH_PORT: ${{ job.services.opensearch.ports['9200'] }}
OPENSEARCH_HOST: https://127.0.0.1:${{ job.services.opensearch.ports['9200'] }}
OPENSEARCH_VERIFY_SSL: false

run: |
bundle exec rails test:zeitwerk ${{ matrix.tests }}
bundle exec rails test:zeitwerk
bundle exec rails test ${{ matrix.tests }}
ruby-tests-completed:
Expand Down Expand Up @@ -292,7 +306,7 @@ jobs:
###
# Setup Ruby - this needs to match the version in the Gemfile
- name: Set up Ruby
uses: ruby/setup-ruby@b161cb92f0e2f28d992f04f38fff204d84132c47
uses: ruby/setup-ruby@fabf2515e6b5531555983e2641f2acdf622b0e50
with:
ruby-version: .ruby-version
bundler-cache: true
Expand Down Expand Up @@ -336,7 +350,8 @@ jobs:
AWS_PORT: ${{ job.services.aws.ports['4566'] }}
MYSQL_PORT: ${{ job.services.mysql.ports['3306'] }}
run: |
bundle exec rails assets:precompile
bundle exec rails r bin/monitor-manifest
bundle exec rails test:prepare
###
# Run the tests
Expand Down Expand Up @@ -373,7 +388,7 @@ jobs:
###
# Setup Ruby - this needs to match the version in the Gemfile
- name: Set up Ruby
uses: ruby/setup-ruby@b161cb92f0e2f28d992f04f38fff204d84132c47
uses: ruby/setup-ruby@fabf2515e6b5531555983e2641f2acdf622b0e50
with:
ruby-version: .ruby-version
bundler-cache: true
Expand Down Expand Up @@ -411,4 +426,5 @@ jobs:
env:
RAILS_ENV: test
EXERCISM_CI: true
run: bundle exec bin/webpack
run: bundle exec rails r bin/monitor-manifest
bundle exec rails test:prepare
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,9 @@ yarn-debug.log*

# Any code coverage that's generated
coverage/

.built-assets/*
!.built-assets/.keep

app/javascript/.config/*
!app/javascript/.config/.keep
14 changes: 13 additions & 1 deletion .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ AllCops:
Exclude:
- "app/controllers/tmp/**/*"
- "bin/**/*"
- "bin/{bundle,rails,rake,setup,webpack,webpack-dev-server,yarn}"
- "bin/{bundle,monitor-manifest,rails,rake,setup,yarn}"
- "db/schema.rb"
- "db/migrate/*"
- "db/seeds.rb"
Expand All @@ -21,6 +21,10 @@ Bundler/OrderedGems:

Layout/ArgumentAlignment:
EnforcedStyle: with_fixed_indentation
# TODO: remove once https://github.com/rubocop/rubocop/issues/10364 is fixed
Exclude:
- "app/helpers/view_components/track/solution_activity.rb"
- "test/helpers/view_components/track/solution_activity_test.rb"

Layout/DotPosition:
EnforcedStyle: trailing
Expand Down Expand Up @@ -63,6 +67,10 @@ Metrics/MethodLength:
Metrics/AbcSize:
IgnoredMethods: ["CLI::PrepareUploadedFiles.call"]

Metrics/ClassLength:
Exclude:
- "test/commands/solution/search_user_solutions_test.rb"

Naming/PredicateName:
Enabled: false

Expand Down Expand Up @@ -106,6 +114,10 @@ Naming/VariableNumber:
- "strip_h1"
- "v2"

# TODO: remove once https://github.com/rubocop/rubocop/issues/10383 is fixed
Style/HashSyntax:
Enabled: false

Style/LambdaCall:
EnforcedStyle: braces

Expand Down
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ruby-2.6.6
ruby-3.1.0
18 changes: 11 additions & 7 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
source 'https://rubygems.org'

ruby '2.6.6'
ruby '3.1.0'

# Service/framework dependencies
gem 'rails', '~> 6.1.3'
gem 'rails', '~> 7.0.1'
gem 'cssbundling-rails'
gem 'jsbundling-rails'
gem 'turbo-rails'
gem 'propshaft'

gem 'mysql2', '>= 0.4.4'
gem 'mysql2', github: 'brianmario/mysql2', ref: '25c42c7'
gem 'redis', '~> 4.0'
gem 'aws-sdk-s3', '~> 1'
gem 'aws-sdk-ecr'
Expand All @@ -29,7 +33,7 @@ gem 'kaminari'
gem 'oj'

# Setup dependencies
gem 'exercism-config', '>= 0.80.0'
gem 'exercism-config', '>= 0.81.0'
# gem 'exercism-config', path: '../exercism_config'

# Model-level dependencies
Expand All @@ -40,8 +44,6 @@ gem 'sidekiq-failures'
gem 'sidekiq-scheduler'

# View-level Dependencies
gem 'webpacker', '~> 5.x'
gem 'turbo-rails'
gem 'hamlit'
gem 'commonmarker'
gem 'ansi-to-html'
Expand All @@ -51,13 +53,16 @@ gem 'devise', '~> 4.7'

# Omniauth
gem 'omniauth-github'
gem "omniauth-rails_csrf_protection"

# Payments
gem 'stripe'

# Reporting
gem 'skylight'

gem 'listen', '>= 3.0.5', '< 3.2'

# Let's be nice to Windows users
platforms :mingw, :mswin, :x64_mingw, :jruby do
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
Expand All @@ -75,7 +80,6 @@ end

group :development do
gem 'haml_lint', require: false
gem 'listen', '>= 3.0.5', '< 3.2'
gem 'solargraph'
gem 'rubocop', require: false
gem 'rubocop-rails', require: false
Expand Down
Loading

0 comments on commit 93b4d92

Please sign in to comment.