diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9776aa899..5b803e602 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -85,7 +85,6 @@ jobs: matrix: ruby: [3.0, 3.3] node: [16, 20] - rake_task: ['run_rspec:all_but_examples', 'run_rspec:examples'] runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 @@ -161,14 +160,12 @@ jobs: sudo apt-get install google-chrome-stable echo -e "\nInstalled $(google-chrome --version)" fi - - name: Install yalc globally - run: sudo yarn global add yalc - name: Increase the amount of inotify watchers run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p - name: generate file system-based packs run: cd spec/dummy && RAILS_ENV=test bundle exec rake react_on_rails:generate_packs - name: Main CI - run: bundle exec rake ${{ matrix.rake_task }} + run: bundle exec rake run_rspec:all_but_examples - name: Store test results uses: actions/upload-artifact@v3 with: @@ -189,3 +186,71 @@ jobs: with: name: dummy-app-yarn-log path: spec/dummy/yarn-error.log + + examples: + needs: build-dummy-app-webpack-test-bundles + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + with: + persist-credentials: false + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: 3.3 + bundler: 2.5.3 + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: 20 + - name: Print system information + run: | + echo "Linux release: "; cat /etc/issue + echo "Current user: "; whoami + echo "Current directory: "; pwd + echo "Ruby version: "; ruby -v + echo "Node version: "; node -v + echo "Yarn version: "; yarn --version + echo "Bundler version: "; bundle --version + - name: Save root node_modules to cache + uses: actions/cache@v3 + with: + path: node_modules + key: v5-package-node-modules-cache-${{ hashFiles('yarn.lock') }} + - name: Save root ruby gems to cache + uses: actions/cache@v3 + with: + path: vendor/bundle + key: v5-package-app-gem-cache-${{ hashFiles('react_on_rails.gemspec') }} + - id: get-sha + run: echo "::set-output name=sha::$(git rev-parse HEAD)" + - 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 + - name: Install Ruby Gems for package + run: bundle lock --add-platform 'x86_64-linux' && bundle check --path=vendor/bundle || bundle install --path=vendor/bundle --jobs=4 --retry=3 + - name: Ensure minimum required Chrome version + run: | + echo -e "Already installed $(google-chrome --version)\n" + MINIMUM_REQUIRED_CHROME_VERSION=75 + INSTALLED_CHROME_MAJOR_VERSION="$(google-chrome --version | tr ' .' '\t' | cut -f3)" + if [[ $INSTALLED_CHROME_MAJOR_VERSION < $MINIMUM_REQUIRED_CHROME_VERSION ]]; then + wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | sudo apt-key add - + sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list' + sudo apt-get update + sudo apt-get install google-chrome-stable + echo -e "\nInstalled $(google-chrome --version)" + fi + - name: Increase the amount of inotify watchers + run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p + - name: Main CI + run: bundle exec rake run_rspec:examples + - name: Store test results + uses: actions/upload-artifact@v3 + with: + name: main-rspec + path: ~/rspec diff --git a/lib/generators/react_on_rails/base_generator.rb b/lib/generators/react_on_rails/base_generator.rb index 919029bc9..aa864e730 100644 --- a/lib/generators/react_on_rails/base_generator.rb +++ b/lib/generators/react_on_rails/base_generator.rb @@ -92,14 +92,7 @@ def add_yarn_dependencies puts "Adding CSS handlers" - # css_minimizer_webpack_plugin version 6 only supports Nodejs v18+ - # When we bump our minimum Nodejs version to 18, we can remove this logic - # and install css_minimizer_webpack_plugin directly. - node_major_version = `node -v`.match(/^v(\d{,2})\./)[1]&.to_i - css_minimizer_webpack_plugin_version = node_major_version >= 18 ? "" : "@<6.0.0" - css_minimizer_webpack_plugin = "css-minimizer-webpack-plugin#{css_minimizer_webpack_plugin_version}" - - run "yarn add 'css-loader@<7.0.0' '#{css_minimizer_webpack_plugin}' mini-css-extract-plugin 'style-loader<4.0.0'" + run "yarn add css-loader css-minimizer-webpack-plugin mini-css-extract-plugin style-loader@" # rubocop:disable Layout/LineLength puts "Adding dev dependencies" run "yarn add -D @pmmmwh/react-refresh-webpack-plugin react-refresh"