From 6d410fdfc72ec627afb2a2063173e2ff2eefde4c Mon Sep 17 00:00:00 2001 From: Judah Meek Date: Thu, 13 Jun 2024 23:12:32 -0500 Subject: [PATCH] getting there? --- .github/workflows/examples.yml | 2 +- .github/workflows/lint-js-and-ruby.yml | 3 +-- .github/workflows/main.yml | 2 +- .github/workflows/rspec-package-specs.yml | 11 +++++++---- spec/react_on_rails/configuration_spec.rb | 18 +++++++++--------- 5 files changed, 19 insertions(+), 17 deletions(-) diff --git a/.github/workflows/examples.yml b/.github/workflows/examples.yml index 24c82d121..adc9b05f1 100644 --- a/.github/workflows/examples.yml +++ b/.github/workflows/examples.yml @@ -56,10 +56,10 @@ jobs: - name: Install Node modules with Yarn for renderer package run: | yarn install --no-progress --no-emoji - yarn run eslint -v sudo yarn global add yalc - name: yalc publish for react-on-rails run: yalc publish + - run: gem install appraisal - name: Install Ruby Gems for package run: bundle lock --add-platform 'x86_64-linux' && bundle check --path=vendor/bundle || bundle _2.5.9_ install --path=vendor/bundle --jobs=4 --retry=3 - name: Ensure minimum required Chrome version diff --git a/.github/workflows/lint-js-and-ruby.yml b/.github/workflows/lint-js-and-ruby.yml index edfa9077a..d5cf878d4 100644 --- a/.github/workflows/lint-js-and-ruby.yml +++ b/.github/workflows/lint-js-and-ruby.yml @@ -49,8 +49,7 @@ jobs: - name: Install Node modules with Yarn for renderer package run: | yarn install --no-progress --no-emoji - yarn run eslint -v - sudo yarn global add yalc + - run: gem install appraisal - name: Install Ruby Gems for package run: bundle check --path=vendor/bundle || bundle _2.5.9_ install --path=vendor/bundle --jobs=4 --retry=3 - name: Linting of Ruby diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9a9c130f4..1fe2d2f7a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -63,7 +63,7 @@ jobs: run: cd spec/dummy && yalc add react-on-rails - name: Install Node modules with Yarn for dummy app run: cd spec/dummy && yarn install --no-progress --no-emoji - - run: cd spec/dummy && yarn install "shakapacker@${{ matrix.versions == 'shakapacker_v6' && '6.6.0' || '8.0.0' }}" + - run: cd spec/dummy && yarn add "shakapacker@${{ matrix.versions == 'shakapacker_v6' && '6.6.0' || '8.0.0' }}" - name: Save dummy app ruby gems to cache uses: actions/cache@v3 with: diff --git a/.github/workflows/rspec-package-specs.yml b/.github/workflows/rspec-package-specs.yml index 0dc22b974..0003fd472 100644 --- a/.github/workflows/rspec-package-specs.yml +++ b/.github/workflows/rspec-package-specs.yml @@ -7,11 +7,14 @@ on: pull_request: jobs: - build: + rspec-package-tests: strategy: matrix: - ruby: [3.0, 3.3] + versions: ['shakapacker_v6', 'shakapacker_v8'] runs-on: ubuntu-22.04 + env: + # $BUNDLE_GEMFILE must be set at the job level, so it is set for all steps + BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.versions }}.gemfile steps: - uses: actions/checkout@v4 with: @@ -19,7 +22,7 @@ jobs: - name: Setup Ruby uses: ruby/setup-ruby@v1 with: - ruby-version: ${{ matrix.ruby }} + ruby-version: ${{ matrix.versions == 'shakapacker_v6' && '3.0' || '3.3' }} bundler: 2.5.9 - name: Print system information run: | @@ -34,7 +37,7 @@ jobs: uses: actions/cache@v3 with: path: vendor/bundle - key: v5-package-app-gem-cache-${{ hashFiles('react_on_rails.gemspec') }} + key: package-app-gem-cache-${{ hashFiles(format('{0}/gemfiles/{1}.gemfile.lock', github.workspace, matrix.versions)) }} - run: gem install appraisal - name: Install Ruby Gems for package run: bundle check --path=vendor/bundle || bundle _2.5.9_ install --path=vendor/bundle --jobs=4 --retry=3 diff --git a/spec/react_on_rails/configuration_spec.rb b/spec/react_on_rails/configuration_spec.rb index 606d83738..fe0a88c3f 100644 --- a/spec/react_on_rails/configuration_spec.rb +++ b/spec/react_on_rails/configuration_spec.rb @@ -27,7 +27,7 @@ module ReactOnRails before do allow(Rails).to receive(:root).and_return(File.expand_path(".")) - allow(Shakapacker).to receive_message_chain("config.public_output_path") + allow(ReactOnRails::PackerUtils).to receive_message_chain("packer.config.public_output_path") .and_return(packer_public_output_path) end @@ -83,7 +83,7 @@ module ReactOnRails end it "fails when \"shakapacker_precompile\" is truly and \"build_production_command\" is truly" do - allow(Shakapacker).to receive_message_chain("config.shakapacker_precompile?") + allow(ReactOnRails::PackerUtils).to receive_message_chain("packer.config.shakapacker_precompile?") .and_return(true) expect do ReactOnRails.configure do |config| @@ -93,7 +93,7 @@ module ReactOnRails end it "doesn't fail when \"shakapacker_precompile\" is falsy and \"build_production_command\" is truly" do - allow(Shakapacker).to receive_message_chain("config.shakapacker_precompile?") + allow(ReactOnRails::PackerUtils).to receive_message_chain("packer.config.shakapacker_precompile?") .and_return(false) expect do ReactOnRails.configure do |config| @@ -103,7 +103,7 @@ module ReactOnRails end it "doesn't fail when \"shakapacker_precompile\" is truly and \"build_production_command\" is falsy" do - allow(Shakapacker).to receive_message_chain("config.shakapacker_precompile?") + allow(ReactOnRails::PackerUtils).to receive_message_chain("packer.config.shakapacker_precompile?") .and_return(true) expect do ReactOnRails.configure {} # rubocop:disable-line Lint/EmptyBlock @@ -111,7 +111,7 @@ module ReactOnRails end it "doesn't fail when \"shakapacker_precompile\" is falsy and \"build_production_command\" is falsy" do - allow(Shakapacker).to receive_message_chain("config.shakapacker_precompile?") + allow(ReactOnRails::PackerUtils).to receive_message_chain("packer.config.shakapacker_precompile?") .and_return(false) expect do ReactOnRails.configure {} # rubocop:disable-line Lint/EmptyBlock @@ -127,7 +127,7 @@ module ReactOnRails end it "fails when \"shakapacker_precompile\" is truly and \"build_production_command\" is truly" do - allow(Shakapacker).to receive_message_chain("config.shakapacker_precompile?") + allow(ReactOnRails::PackerUtils).to receive_message_chain("packer.config.shakapacker_precompile?") .and_return(true) expect do ReactOnRails.configure do |config| @@ -137,7 +137,7 @@ module ReactOnRails end it "doesn't fail when \"shakapacker_precompile\" is falsy and \"build_production_command\" is truly" do - allow(Shakapacker).to receive_message_chain("config.shakapacker_precompile?") + allow(ReactOnRails::PackerUtils).to receive_message_chain("packer.config.shakapacker_precompile?") .and_return(false) expect do ReactOnRails.configure do |config| @@ -147,7 +147,7 @@ module ReactOnRails end it "doesn't fail when \"shakapacker_precompile\" is truly and \"build_production_command\" is falsy" do - allow(Shakapacker).to receive_message_chain("config.shakapacker_precompile?") + allow(ReactOnRails::PackerUtils).to receive_message_chain("packer.config.shakapacker_precompile?") .and_return(true) expect do ReactOnRails.configure {} # rubocop:disable-line Lint/EmptyBlock @@ -155,7 +155,7 @@ module ReactOnRails end it "doesn't fail when \"shakapacker_precompile\" is falsy and \"build_production_command\" is falsy" do - allow(Shakapacker).to receive_message_chain("config.shakapacker_precompile?") + allow(ReactOnRails::PackerUtils).to receive_message_chain("packer.config.shakapacker_precompile?") .and_return(false) expect do ReactOnRails.configure {} # rubocop:disable-line Lint/EmptyBlock