From 6078cbfdef76ed20588a8de7d5de4aba33cc4037 Mon Sep 17 00:00:00 2001 From: Cody Robbins Date: Tue, 16 Apr 2024 11:51:14 -0400 Subject: [PATCH] Added a script to set up the dummy app for running the dummy app test suite locally and changed the GitHub Actions workflow to leverage the new setup script. --- .github/workflows/test.yml | 18 ++---------------- README.md | 10 ++++++++++ bin/dummy-app-setup | 19 +++++++++++++++++++ spec/dummy_app_config/Gemfile.append | 2 +- .../gemfiles/Gemfile-rails-6.0 | 3 +++ 5 files changed, 35 insertions(+), 17 deletions(-) create mode 100755 bin/dummy-app-setup diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6bdfe5e..4a285af 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -53,22 +53,8 @@ jobs: bundle bundle exec rake - name: Set up new Rails dummy app - working-directory: ./spec - env: - RAILS_NEW_GEMFILE: dummy_app_config/gemfiles/Gemfile-rails-${{ matrix.rails-version }} run: | - bundle config set --local path '/tmp/system-tests' - BUNDLE_GEMFILE=$RAILS_NEW_GEMFILE bundle - rails new dummy_app --database=sqlite3 --skip-active-storage --skip-action-cable --skip-spring --skip-listen --skip-test - cat dummy_app_config/Gemfile.append >> dummy_app/Gemfile - cd dummy_app - bundle - rails g rspec:install - cp -rf ../dummy_app_config/shared_source/all/* ./ - cp -rf ../dummy_app_config/shared_source/${{ matrix.rails-version }}/* ./ - yarn install + bin/dummy-app-setup ${{ matrix.rails-version }} - name: Run Rails dummy app tests - working-directory: ./spec/dummy_app run: | - rake db:drop db:create db:migrate - rake + bundle exec rails db:drop db:create db:migrate spec diff --git a/README.md b/README.md index 5f335d5..ceb2146 100644 --- a/README.md +++ b/README.md @@ -590,6 +590,16 @@ Other Ruby libraries that offer passwordless authentication: * [passwordless](https://github.com/mikker/passwordless) * [magic-link](https://github.com/dvanderbeek/magic-link) +## Gem development + +### Running tests + +``` +bin/dummy-app-setup 6.1 +cd spec/tmp/dummy_app-rails-6.1/dummy_app +bundle exec rails db:drop db:create db:migrate spec +``` + ## License The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT). diff --git a/bin/dummy-app-setup b/bin/dummy-app-setup new file mode 100755 index 0000000..82ea639 --- /dev/null +++ b/bin/dummy-app-setup @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +set -xeuo pipefail + +DIRECTORY=spec/tmp/dummy_app-rails-$1 + +mkdir -p $DIRECTORY +cp spec/dummy_app_config/gemfiles/Gemfile-rails-$1 $DIRECTORY/Gemfile +cd $DIRECTORY +bundle config set --local path gems +bundle install +bundle exec rails new dummy_app --database=sqlite3 --skip-active-storage --skip-action-cable --skip-spring --skip-listen --skip-test +cat ../../dummy_app_config/Gemfile.append >> dummy_app/Gemfile +cd dummy_app +bundle install +bundle exec rails generate rspec:install +cp -rf ../../../dummy_app_config/shared_source/all/* ./ +cp -rf ../../../dummy_app_config/shared_source/$1/* ./ +yarn install diff --git a/spec/dummy_app_config/Gemfile.append b/spec/dummy_app_config/Gemfile.append index 02a55d8..de46b52 100644 --- a/spec/dummy_app_config/Gemfile.append +++ b/spec/dummy_app_config/Gemfile.append @@ -7,4 +7,4 @@ group :development, :test do end gem "devise" -gem "devise-passwordless", :path => "../../../" +gem "devise-passwordless", :path => "../../../../" diff --git a/spec/dummy_app_config/gemfiles/Gemfile-rails-6.0 b/spec/dummy_app_config/gemfiles/Gemfile-rails-6.0 index 3219c4d..4400f9c 100644 --- a/spec/dummy_app_config/gemfiles/Gemfile-rails-6.0 +++ b/spec/dummy_app_config/gemfiles/Gemfile-rails-6.0 @@ -3,3 +3,6 @@ git_source(:github) { |repo| "https://github.com/#{repo}.git" } # Bundle edge Rails instead: gem 'rails', github: 'rails/rails' gem 'rails', '~> 6.0.0' + +gem 'bootsnap' +gem 'webpacker'