[pull] master from shakacode:master #4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: React on Rails Pro - Package Tests | |
| on: | |
| push: | |
| branches: | |
| - 'master' | |
| pull_request: | |
| defaults: | |
| run: | |
| working-directory: react_on_rails_pro | |
| jobs: | |
| # Build webpack test bundles for dummy app | |
| build-dummy-app-webpack-test-bundles: | |
| runs-on: ubuntu-22.04 | |
| env: | |
| REACT_ON_RAILS_PRO_LICENSE: ${{ secrets.REACT_ON_RAILS_PRO_LICENSE }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: false | |
| - name: Setup Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: 3.3.7 | |
| bundler: 2.5.4 | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: yarn | |
| cache-dependency-path: 'react_on_rails_pro/**/yarn.lock' | |
| - 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: Cache Pro package node modules | |
| uses: actions/cache@v4 | |
| with: | |
| path: react_on_rails_pro/node_modules | |
| key: v4-pro-package-node-modules-cache-${{ hashFiles('react_on_rails_pro/yarn.lock') }} | |
| - name: Cache Pro dummy app node modules | |
| uses: actions/cache@v4 | |
| with: | |
| path: react_on_rails_pro/spec/dummy/node_modules | |
| key: v4-pro-dummy-app-node-modules-cache-${{ hashFiles('react_on_rails_pro/spec/dummy/yarn.lock') }} | |
| - name: Cache Pro dummy app Ruby gems | |
| uses: actions/cache@v4 | |
| with: | |
| path: react_on_rails_pro/spec/dummy/vendor/bundle | |
| key: v4-pro-dummy-app-gem-cache-${{ hashFiles('react_on_rails_pro/spec/dummy/Gemfile.lock') }} | |
| - name: Install Node modules with Yarn for Pro package | |
| run: | | |
| sudo yarn global add yalc | |
| yarn install --frozen-lockfile --no-progress --no-emoji | |
| - name: Install Node modules with Yarn for Pro dummy app | |
| run: cd spec/dummy && yarn install --frozen-lockfile --no-progress --no-emoji | |
| - name: Install Ruby Gems for Pro dummy app | |
| run: | | |
| gem install bundler -v "2.5.4" | |
| cd spec/dummy | |
| bundle lock --add-platform 'x86_64-linux' | |
| bundle _2.5.4_ check || bundle _2.5.4_ install --jobs=4 --retry=3 | |
| - name: Generate file-system based entrypoints | |
| run: cd spec/dummy && bundle exec rake react_on_rails:generate_packs | |
| - name: Build test bundles for Pro dummy app | |
| run: cd spec/dummy && yarn run build:test | |
| - id: get-sha | |
| run: echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" | |
| - name: Save test webpack bundles to cache | |
| uses: actions/cache/save@v4 | |
| with: | |
| path: | | |
| react_on_rails_pro/spec/dummy/public/webpack/test | |
| react_on_rails_pro/spec/dummy/ssr-generated | |
| key: v4-pro-dummy-app-webpack-bundle-${{ steps.get-sha.outputs.sha }} | |
| # Jest unit tests for Pro package | |
| package-js-tests: | |
| needs: build-dummy-app-webpack-test-bundles | |
| runs-on: ubuntu-22.04 | |
| env: | |
| REACT_ON_RAILS_PRO_LICENSE: ${{ secrets.REACT_ON_RAILS_PRO_LICENSE }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: false | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: yarn | |
| cache-dependency-path: 'react_on_rails_pro/**/yarn.lock' | |
| - name: Print system information | |
| run: | | |
| echo "Linux release: "; cat /etc/issue | |
| echo "Current user: "; whoami | |
| echo "Current directory: "; pwd | |
| echo "Node version: "; node -v | |
| echo "Yarn version: "; yarn --version | |
| - name: Cache Pro package node modules | |
| uses: actions/cache@v4 | |
| with: | |
| path: react_on_rails_pro/node_modules | |
| key: v4-pro-package-node-modules-cache-${{ hashFiles('react_on_rails_pro/yarn.lock') }} | |
| - name: Remove old webpack bundles | |
| run: | | |
| rm -rf spec/dummy/public/webpack | |
| rm -rf spec/dummy/ssr-generated | |
| - id: get-sha | |
| run: echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" | |
| - name: Restore test webpack bundles from cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| react_on_rails_pro/spec/dummy/public/webpack/test | |
| react_on_rails_pro/spec/dummy/ssr-generated | |
| key: v4-pro-dummy-app-webpack-bundle-${{ steps.get-sha.outputs.sha }} | |
| - name: Install Node modules with Yarn for Pro package | |
| run: | | |
| sudo yarn global add yalc | |
| yarn install --frozen-lockfile --no-progress --no-emoji | |
| - name: Run JS unit tests for Pro package | |
| run: yarn run nps test.ci | |
| env: | |
| JEST_JUNIT_OUTPUT_DIR: ./jest | |
| JEST_JUNIT_ADD_FILE_ATTRIBUTE: "true" | |
| - name: Store test results | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: pro-jest-results | |
| path: react_on_rails_pro/jest | |
| # RSpec tests for Pro package | |
| rspec-package-specs: | |
| strategy: | |
| matrix: | |
| ruby-version: ['3.3.7'] | |
| runs-on: ubuntu-22.04 | |
| env: | |
| REACT_ON_RAILS_PRO_LICENSE: ${{ secrets.REACT_ON_RAILS_PRO_LICENSE }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: false | |
| - name: Setup Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: ${{ matrix.ruby-version }} | |
| bundler: 2.5.4 | |
| - 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 "Bundler version: "; bundle --version | |
| - name: Cache Pro package Ruby gems | |
| uses: actions/cache@v4 | |
| with: | |
| path: react_on_rails_pro/vendor/bundle | |
| key: v4-pro-package-gem-cache-ruby${{ matrix.ruby-version }}-${{ hashFiles('react_on_rails_pro/react_on_rails_pro.gemspec') }} | |
| - name: Install Ruby Gems for Pro package | |
| run: | | |
| gem install bundler -v "2.5.4" | |
| echo "Bundler version: "; bundle --version | |
| bundle config set --local path 'vendor/bundle' | |
| bundle config set --local disable_checksum_validation true | |
| bundle _2.5.4_ check || bundle _2.5.4_ install --jobs=4 --retry=3 | |
| - name: Run RSpec tests for Pro package | |
| run: bundle exec rspec spec/react_on_rails_pro | |
| - name: Store test results | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: pro-rspec-package-results-ruby${{ matrix.ruby-version }} | |
| path: ~/rspec | |
| - name: Store test log | |
| uses: actions/upload-artifact@v4 | |
| if: always() | |
| with: | |
| name: pro-rspec-package-log-ruby${{ matrix.ruby-version }} | |
| path: react_on_rails_pro/log/test.log |