From de9bee4e5829c301f236253ae1888ecce826677e Mon Sep 17 00:00:00 2001 From: Namil Kim Date: Thu, 27 Aug 2020 00:50:29 +0900 Subject: [PATCH 01/15] Add initial workflow --- .github/workflows/build-and-test.yml | 34 ++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/build-and-test.yml diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml new file mode 100644 index 0000000000..e0bf474cbe --- /dev/null +++ b/.github/workflows/build-and-test.yml @@ -0,0 +1,34 @@ +name: Build and test + +on: [push, pull_request] + +jobs: + install-package-node-packages: + strategy: + matrix: + ruby: [2.6] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + - name: Setup Node + uses: ruby/setup-node@v1 + with: + node-version: '12' + - 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 dependencies +# uses: actions/cache@v2 +# with: +# path: vendor/bundle +# key: v4-package-node-modules-cache-${{ hashFiles('yarn.lock') }} From 54d772ba64cadd4d4f6f256f2abbcf2959228457 Mon Sep 17 00:00:00 2001 From: Namil Kim Date: Thu, 27 Aug 2020 00:55:43 +0900 Subject: [PATCH 02/15] Minor fix --- .github/workflows/build-and-test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index e0bf474cbe..b2a06a7e32 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -15,7 +15,7 @@ jobs: with: ruby-version: ${{ matrix.ruby }} - name: Setup Node - uses: ruby/setup-node@v1 + uses: actions/setup-node@v1.4.3 with: node-version: '12' - name: Print system information From ff553fcee2902a81db7a3c75f198e04630ae1e36 Mon Sep 17 00:00:00 2001 From: Namil Kim Date: Thu, 27 Aug 2020 01:19:10 +0900 Subject: [PATCH 03/15] Add install-package-node-packages job --- .github/workflows/build-and-test.yml | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index b2a06a7e32..dbfd3fefd0 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -27,8 +27,13 @@ jobs: echo "Node version: "; node -v echo "Yarn version: "; yarn --version echo "Bundler version: "; bundle --version -# - name: Cache dependencies -# uses: actions/cache@v2 -# with: -# path: vendor/bundle -# key: v4-package-node-modules-cache-${{ hashFiles('yarn.lock') }} + - name: Save root node_modules to cache + uses: actions/cache@v2 + with: + path: node_modules + key: v4-package-node-modules-cache-${{ hashFiles('yarn.lock') }} + - 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 From 7d6c04c970f8064e121e9cc1030a9bc5ea67ecb1 Mon Sep 17 00:00:00 2001 From: Namil Kim Date: Thu, 27 Aug 2020 02:20:27 +0900 Subject: [PATCH 04/15] Add lint-js-and-ruby workflow --- ...uild-and-test.yml => lint-js-and-ruby.yml} | 20 ++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) rename .github/workflows/{build-and-test.yml => lint-js-and-ruby.yml} (63%) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/lint-js-and-ruby.yml similarity index 63% rename from .github/workflows/build-and-test.yml rename to .github/workflows/lint-js-and-ruby.yml index dbfd3fefd0..6b67ff9db7 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/lint-js-and-ruby.yml @@ -1,12 +1,13 @@ -name: Build and test +name: Lint JS and Ruby on: [push, pull_request] jobs: - install-package-node-packages: + build: strategy: matrix: ruby: [2.6] + node: [12] runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -17,7 +18,7 @@ jobs: - name: Setup Node uses: actions/setup-node@v1.4.3 with: - node-version: '12' + node-version: ${{ matrix.node }} - name: Print system information run: | echo "Linux release: "; cat /etc/issue @@ -32,8 +33,21 @@ jobs: with: path: node_modules key: v4-package-node-modules-cache-${{ hashFiles('yarn.lock') }} + - name: Save root ruby gems to cache + uses: actions/cache@v2 + with: + path: vendor/bundle + key: v4-package-app-gem-cache-${{ hashFiles('react_on_rails.gemspec') }} - 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: Install Ruby Gems for package + run: bundle check --path=vendor/bundle || bundle install --path=vendor/bundle --jobs=4 --retry=3 + - name: Linting of Ruby + run: bundle exec rubocop + - name: Linting of JS + run: yarn start lint + - name: Check formatting + run: yarn start format.listDifferent From ae68c6b103ef8f8f7016df123b954b286d694bc8 Mon Sep 17 00:00:00 2001 From: Namil Kim Date: Thu, 27 Aug 2020 03:19:20 +0900 Subject: [PATCH 05/15] Fix lint-js-and-ruby workflow --- .../actions/install-package-node-packages.yml | 16 ++++++++++++++++ .github/workflows/lint-js-and-ruby.yml | 12 ++---------- 2 files changed, 18 insertions(+), 10 deletions(-) create mode 100644 .github/actions/install-package-node-packages.yml diff --git a/.github/actions/install-package-node-packages.yml b/.github/actions/install-package-node-packages.yml new file mode 100644 index 0000000000..a5cf88b176 --- /dev/null +++ b/.github/actions/install-package-node-packages.yml @@ -0,0 +1,16 @@ +name: 'Install root node modules' +description: 'Install Node modules for Renderer package with Yarn and save them to chache' +runs: + using: "composite" + steps: + - name: Save root node_modules to cache + uses: actions/cache@v2 + with: + path: node_modules + key: v4-package-node-modules-cache-${{ hashFiles('yarn.lock') }} + - 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 + shell: bash diff --git a/.github/workflows/lint-js-and-ruby.yml b/.github/workflows/lint-js-and-ruby.yml index 6b67ff9db7..e3dd57e671 100644 --- a/.github/workflows/lint-js-and-ruby.yml +++ b/.github/workflows/lint-js-and-ruby.yml @@ -28,21 +28,13 @@ jobs: 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@v2 - with: - path: node_modules - key: v4-package-node-modules-cache-${{ hashFiles('yarn.lock') }} + - name: Use local my-action + uses: ./.github/actions/install-package-node-packages - name: Save root ruby gems to cache uses: actions/cache@v2 with: path: vendor/bundle key: v4-package-app-gem-cache-${{ hashFiles('react_on_rails.gemspec') }} - - 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: Install Ruby Gems for package run: bundle check --path=vendor/bundle || bundle install --path=vendor/bundle --jobs=4 --retry=3 - name: Linting of Ruby From f46f5304166367d21a334808dda8f020de1ac163 Mon Sep 17 00:00:00 2001 From: Namil Kim Date: Fri, 28 Aug 2020 01:51:08 +0900 Subject: [PATCH 06/15] Add build-dummy-app-webpack-test-bundles workflow --- .../actions/install-package-node-packages.yml | 16 ----- .../build-dummy-app-webpack-test-bundles.yml | 67 +++++++++++++++++++ .github/workflows/lint-js-and-ruby.yml | 12 +++- 3 files changed, 77 insertions(+), 18 deletions(-) delete mode 100644 .github/actions/install-package-node-packages.yml create mode 100644 .github/workflows/build-dummy-app-webpack-test-bundles.yml diff --git a/.github/actions/install-package-node-packages.yml b/.github/actions/install-package-node-packages.yml deleted file mode 100644 index a5cf88b176..0000000000 --- a/.github/actions/install-package-node-packages.yml +++ /dev/null @@ -1,16 +0,0 @@ -name: 'Install root node modules' -description: 'Install Node modules for Renderer package with Yarn and save them to chache' -runs: - using: "composite" - steps: - - name: Save root node_modules to cache - uses: actions/cache@v2 - with: - path: node_modules - key: v4-package-node-modules-cache-${{ hashFiles('yarn.lock') }} - - 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 - shell: bash diff --git a/.github/workflows/build-dummy-app-webpack-test-bundles.yml b/.github/workflows/build-dummy-app-webpack-test-bundles.yml new file mode 100644 index 0000000000..9794fd0018 --- /dev/null +++ b/.github/workflows/build-dummy-app-webpack-test-bundles.yml @@ -0,0 +1,67 @@ +name: Build client and server bundles for dummy app with Webpack and save them to cache + +on: [push, pull_request] + +jobs: + build: + strategy: + matrix: + ruby: [2.6] + node: [12] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + - name: Setup Node + uses: actions/setup-node@v1.4.3 + with: + node-version: ${{ matrix.node }} + - 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@v2 + with: + path: node_modules + key: v4-package-node-modules-cache-${{ hashFiles('yarn.lock') }} + - 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: Save spec/dummy/node_modules to cache + uses: actions/cache@v2 + with: + path: spec/dummy/node_modules + key: v4-dummy-app-node-modules-cache-${{ hashFiles('spec/dummy/yarn.lock') }} + - name: yalc add react-on-rails + 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 + - name: Save dummy app ruby gems to cache + uses: actions/cache@v2 + with: + path: spec/dummy/vendor/bundle + key: v4-dummy-app-gem-cache-${{ hashFiles('spec/dummy/Gemfile.lock') }} + - name: Install Ruby Gems for dummy app + run: cd spec/dummy && bundle check --path=vendor/bundle || bundle install --path=vendor/bundle --jobs=4 --retry=3 + - name: Build test bundles for dummy app + run: cd spec/dummy && yarn run build:test + - id: get-sha + run: echo "::set-output name=sha::$(git rev-parse HEAD) + - name: Save test webpack bundles to cache (for build number checksum used by rspec job) + uses: actions/cache@v2 + with: + path: spec/dummy/public/webpack + key: v4-dummy-app-webpack-bundle-${{ steps.get-sha.outputs.sha }} diff --git a/.github/workflows/lint-js-and-ruby.yml b/.github/workflows/lint-js-and-ruby.yml index e3dd57e671..6b67ff9db7 100644 --- a/.github/workflows/lint-js-and-ruby.yml +++ b/.github/workflows/lint-js-and-ruby.yml @@ -28,13 +28,21 @@ jobs: echo "Node version: "; node -v echo "Yarn version: "; yarn --version echo "Bundler version: "; bundle --version - - name: Use local my-action - uses: ./.github/actions/install-package-node-packages + - name: Save root node_modules to cache + uses: actions/cache@v2 + with: + path: node_modules + key: v4-package-node-modules-cache-${{ hashFiles('yarn.lock') }} - name: Save root ruby gems to cache uses: actions/cache@v2 with: path: vendor/bundle key: v4-package-app-gem-cache-${{ hashFiles('react_on_rails.gemspec') }} + - 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: Install Ruby Gems for package run: bundle check --path=vendor/bundle || bundle install --path=vendor/bundle --jobs=4 --retry=3 - name: Linting of Ruby From 2398aad404ca348f1d758756f3b130687ffe41ee Mon Sep 17 00:00:00 2001 From: Namil Kim Date: Fri, 28 Aug 2020 02:01:51 +0900 Subject: [PATCH 07/15] Fix typo --- .github/workflows/build-dummy-app-webpack-test-bundles.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-dummy-app-webpack-test-bundles.yml b/.github/workflows/build-dummy-app-webpack-test-bundles.yml index 9794fd0018..90e01612f7 100644 --- a/.github/workflows/build-dummy-app-webpack-test-bundles.yml +++ b/.github/workflows/build-dummy-app-webpack-test-bundles.yml @@ -59,7 +59,7 @@ jobs: - name: Build test bundles for dummy app run: cd spec/dummy && yarn run build:test - id: get-sha - run: echo "::set-output name=sha::$(git rev-parse HEAD) + run: echo "::set-output name=sha::$(git rev-parse HEAD)" - name: Save test webpack bundles to cache (for build number checksum used by rspec job) uses: actions/cache@v2 with: From 1235ccf01dba08eb9762083245097f58c57f3dd9 Mon Sep 17 00:00:00 2001 From: Namil Kim Date: Fri, 28 Aug 2020 02:38:29 +0900 Subject: [PATCH 08/15] Add main workflow --- .../build-dummy-app-webpack-test-bundles.yml | 67 -------- .github/workflows/main.yml | 155 ++++++++++++++++++ 2 files changed, 155 insertions(+), 67 deletions(-) delete mode 100644 .github/workflows/build-dummy-app-webpack-test-bundles.yml create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/build-dummy-app-webpack-test-bundles.yml b/.github/workflows/build-dummy-app-webpack-test-bundles.yml deleted file mode 100644 index 90e01612f7..0000000000 --- a/.github/workflows/build-dummy-app-webpack-test-bundles.yml +++ /dev/null @@ -1,67 +0,0 @@ -name: Build client and server bundles for dummy app with Webpack and save them to cache - -on: [push, pull_request] - -jobs: - build: - strategy: - matrix: - ruby: [2.6] - node: [12] - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Setup Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: ${{ matrix.ruby }} - - name: Setup Node - uses: actions/setup-node@v1.4.3 - with: - node-version: ${{ matrix.node }} - - 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@v2 - with: - path: node_modules - key: v4-package-node-modules-cache-${{ hashFiles('yarn.lock') }} - - 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: Save spec/dummy/node_modules to cache - uses: actions/cache@v2 - with: - path: spec/dummy/node_modules - key: v4-dummy-app-node-modules-cache-${{ hashFiles('spec/dummy/yarn.lock') }} - - name: yalc add react-on-rails - 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 - - name: Save dummy app ruby gems to cache - uses: actions/cache@v2 - with: - path: spec/dummy/vendor/bundle - key: v4-dummy-app-gem-cache-${{ hashFiles('spec/dummy/Gemfile.lock') }} - - name: Install Ruby Gems for dummy app - run: cd spec/dummy && bundle check --path=vendor/bundle || bundle install --path=vendor/bundle --jobs=4 --retry=3 - - name: Build test bundles for dummy app - run: cd spec/dummy && yarn run build:test - - id: get-sha - run: echo "::set-output name=sha::$(git rev-parse HEAD)" - - name: Save test webpack bundles to cache (for build number checksum used by rspec job) - uses: actions/cache@v2 - with: - path: spec/dummy/public/webpack - key: v4-dummy-app-webpack-bundle-${{ steps.get-sha.outputs.sha }} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000000..9e1c5652c4 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,155 @@ +name: Main test + +on: [push, pull_request] + +jobs: + build-dummy-app-webpack-test-bundles: + strategy: + matrix: + ruby: [2.6] + node: [12] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + - name: Setup Node + uses: actions/setup-node@v1.4.3 + with: + node-version: ${{ matrix.node }} + - 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@v2 + with: + path: node_modules + key: v4-package-node-modules-cache-${{ hashFiles('yarn.lock') }} + - 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: Save spec/dummy/node_modules to cache + uses: actions/cache@v2 + with: + path: spec/dummy/node_modules + key: v4-dummy-app-node-modules-cache-${{ hashFiles('spec/dummy/yarn.lock') }} + - name: yalc add react-on-rails + 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 + - name: Save dummy app ruby gems to cache + uses: actions/cache@v2 + with: + path: spec/dummy/vendor/bundle + key: v4-dummy-app-gem-cache-${{ hashFiles('spec/dummy/Gemfile.lock') }} + - name: Install Ruby Gems for dummy app + run: cd spec/dummy && bundle check --path=vendor/bundle || bundle install --path=vendor/bundle --jobs=4 --retry=3 + - name: Build test bundles for dummy app + run: cd spec/dummy && yarn run build:test + - id: get-sha + run: echo "::set-output name=sha::$(git rev-parse HEAD)" + - name: Save test webpack bundles to cache (for build number checksum used by rspec job) + uses: actions/cache@v2 + with: + path: spec/dummy/public/webpack + key: v4-dummy-app-webpack-bundle-${{ steps.get-sha.outputs.sha }} + + main: + needs: build-dummy-app-webpack-test-bundles + strategy: + matrix: + ruby: [2.6] + node: [12] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Setup Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + - name: Setup Node + uses: actions/setup-node@v1.4.3 + with: + node-version: ${{ matrix.node }} + - 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@v2 + with: + path: node_modules + key: v4-package-node-modules-cache-${{ hashFiles('yarn.lock') }} + - name: Save root ruby gems to cache + uses: actions/cache@v2 + with: + path: vendor/bundle + key: v4-package-app-gem-cache-${{ hashFiles('react_on_rails.gemspec') }} + - name: Save dummy app ruby gems to cache + uses: actions/cache@v2 + with: + path: spec/dummy/vendor/bundle + key: v4-dummy-app-gem-cache-${{ hashFiles('spec/dummy/Gemfile.lock') }} + - name: Save spec/dummy/node_modules to cache + uses: actions/cache@v2 + with: + path: spec/dummy/node_modules + key: v4-dummy-app-node-modules-cache-${{ hashFiles('spec/dummy/yarn.lock') }} + - id: get-sha + run: echo "::set-output name=sha::$(git rev-parse HEAD)" + - name: Save test webpack bundles to cache (for build number checksum used by rspec job) + uses: actions/cache@v2 + with: + path: spec/dummy/public/webpack + key: v4-dummy-app-webpack-bundle-${{ steps.get-sha.outputs.sha }} + + - 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: yalc add react-on-rails + run: cd spec/dummy && yalc add react-on-rails + - name: Install Ruby Gems for package + run: bundle check --path=vendor/bundle || bundle install --path=vendor/bundle --jobs=4 --retry=3 + - name: Install Ruby Gems for dummy app + run: cd spec/dummy && bundle check --path=vendor/bundle || bundle install --path=vendor/bundle --jobs=4 --retry=3 + - name: Ensure minimum required Chrome version + run: | + echo -e "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: Touch webpack bundles + run: touch spec/dummy/public/webpack/test/* + - name: Install yalc globally + run: sudo yarn global add yalc + - name: Prep for CI + run: bundle exec rake prepare_for_ci + - name: Main CI + run: bundle exec rake run_rspec:all_dummy From b2f3c1844459638160d510de0250b0042feb2390 Mon Sep 17 00:00:00 2001 From: Namil Kim Date: Fri, 28 Aug 2020 21:49:02 +0900 Subject: [PATCH 09/15] Fix selenium chrome options --- .github/workflows/main.yml | 2 +- spec/dummy/spec/support/driver_registration.rb | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 9e1c5652c4..5ed15bc7b0 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -135,7 +135,7 @@ jobs: run: cd spec/dummy && bundle check --path=vendor/bundle || bundle install --path=vendor/bundle --jobs=4 --retry=3 - name: Ensure minimum required Chrome version run: | - echo -e "Installed $(google-chrome --version)\n" + 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 diff --git a/spec/dummy/spec/support/driver_registration.rb b/spec/dummy/spec/support/driver_registration.rb index e356c03ffd..ba77131e82 100644 --- a/spec/dummy/spec/support/driver_registration.rb +++ b/spec/dummy/spec/support/driver_registration.rb @@ -29,8 +29,10 @@ def self.register_selenium_headless return if @selenium_headless_registered Capybara.register_driver :selenium_chrome_headless do |app| - capabilities = Selenium::WebDriver::Remote::Capabilities.chrome(chromeOptions: { args: %w[headless disable-gpu] }) - Capybara::Selenium::Driver.new app, browser: :chrome, desired_capabilities: capabilities + options = Selenium::WebDriver::Chrome::Options.new + options.add_argument('--headless') + options.add_argument('--disable-gpu') + Capybara::Selenium::Driver.new app, browser: :chrome, options: options end Capybara::Screenshot.register_driver(:selenium_chrome_headless) do |js_driver, path| js_driver.browser.save_screenshot(path) From 05893d2fb85618175e0da1798a6411752f4d8f1f Mon Sep 17 00:00:00 2001 From: Namil Kim Date: Fri, 28 Aug 2020 21:52:27 +0900 Subject: [PATCH 10/15] Fix rubocop --- spec/dummy/spec/support/driver_registration.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/dummy/spec/support/driver_registration.rb b/spec/dummy/spec/support/driver_registration.rb index ba77131e82..8c97ab0c51 100644 --- a/spec/dummy/spec/support/driver_registration.rb +++ b/spec/dummy/spec/support/driver_registration.rb @@ -30,8 +30,8 @@ def self.register_selenium_headless Capybara.register_driver :selenium_chrome_headless do |app| options = Selenium::WebDriver::Chrome::Options.new - options.add_argument('--headless') - options.add_argument('--disable-gpu') + options.add_argument("--headless") + options.add_argument("--disable-gpu") Capybara::Selenium::Driver.new app, browser: :chrome, options: options end Capybara::Screenshot.register_driver(:selenium_chrome_headless) do |js_driver, path| From 79b66bcfe90aae757ffa4273843e4145f8e7d730 Mon Sep 17 00:00:00 2001 From: Namil Kim Date: Sat, 29 Aug 2020 01:42:22 +0900 Subject: [PATCH 11/15] Add artifact uploading steps --- .github/workflows/main.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5ed15bc7b0..688eb4d1bb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -153,3 +153,23 @@ jobs: run: bundle exec rake prepare_for_ci - name: Main CI run: bundle exec rake run_rspec:all_dummy + - name: Store test results + uses: actions/upload-artifact@v2 + with: + name: main-rspec + path: ~/rspec + - name: Store artifacts + uses: actions/upload-artifact@v2 + with: + name: dummy-app-capybara + path: spec/dummy/tmp/capybara + - name: Store artifacts + uses: actions/upload-artifact@v2 + with: + name: dummy-app-test-log + path: spec/dummy/log/test.log + - name: Store artifacts + uses: actions/upload-artifact@v2 + with: + name: dummy-app-yarn-log + path: spec/dummy/yarn-error.log From 6b9ad041b3555f0b607bef2e100b88301887fb01 Mon Sep 17 00:00:00 2001 From: Namil Kim Date: Sat, 29 Aug 2020 03:11:11 +0900 Subject: [PATCH 12/15] Add package-js-tests workflow --- .github/workflows/package-js-tests.yml | 38 ++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .github/workflows/package-js-tests.yml diff --git a/.github/workflows/package-js-tests.yml b/.github/workflows/package-js-tests.yml new file mode 100644 index 0000000000..dfd6b2d774 --- /dev/null +++ b/.github/workflows/package-js-tests.yml @@ -0,0 +1,38 @@ +name: Run JS unit tests for Renderer package + +on: [push, pull_request] + +jobs: + build: + strategy: + matrix: + ruby: [2.6] + node: [12] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Setup Node + uses: actions/setup-node@v1.4.3 + with: + node-version: ${{ matrix.node }} + - 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@v2 + with: + path: node_modules + key: v4-package-node-modules-cache-${{ hashFiles('yarn.lock') }} + - 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: Run JS unit tests for Renderer package + run: yarn test From 06fcf0fc62829d25e41a2f98fa19fa1188c81c6c Mon Sep 17 00:00:00 2001 From: Namil Kim Date: Sat, 29 Aug 2020 03:14:55 +0900 Subject: [PATCH 13/15] Minor fix --- .github/workflows/package-js-tests.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/package-js-tests.yml b/.github/workflows/package-js-tests.yml index dfd6b2d774..b73a830b78 100644 --- a/.github/workflows/package-js-tests.yml +++ b/.github/workflows/package-js-tests.yml @@ -6,7 +6,6 @@ jobs: build: strategy: matrix: - ruby: [2.6] node: [12] runs-on: ubuntu-latest steps: @@ -20,10 +19,8 @@ jobs: 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@v2 with: From af3733fbc48fa0f71cd9a9d1f835ebfb6cb2d842 Mon Sep 17 00:00:00 2001 From: Namil Kim Date: Sat, 29 Aug 2020 04:30:41 +0900 Subject: [PATCH 14/15] Add rspec-package-specs workflow --- .github/workflows/package-js-tests.yml | 2 +- .github/workflows/rspec-package-specs.yml | 45 +++++++++++++++++++++++ 2 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/rspec-package-specs.yml diff --git a/.github/workflows/package-js-tests.yml b/.github/workflows/package-js-tests.yml index b73a830b78..ec9f9ebecb 100644 --- a/.github/workflows/package-js-tests.yml +++ b/.github/workflows/package-js-tests.yml @@ -1,4 +1,4 @@ -name: Run JS unit tests for Renderer package +name: JS unit tests for Renderer package on: [push, pull_request] diff --git a/.github/workflows/rspec-package-specs.yml b/.github/workflows/rspec-package-specs.yml new file mode 100644 index 0000000000..17e53adf27 --- /dev/null +++ b/.github/workflows/rspec-package-specs.yml @@ -0,0 +1,45 @@ +name: Rspec test for gem + +on: [push, pull_request] + +jobs: + build: + strategy: + matrix: + ruby: [2.6] + node: [12] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Setup Node + uses: actions/setup-node@v1.4.3 + with: + node-version: ${{ matrix.node }} + - 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 ruby gems to cache + uses: actions/cache@v2 + with: + path: vendor/bundle + key: v4-package-app-gem-cache-${{ hashFiles('react_on_rails.gemspec') }} + - name: Install Ruby Gems for package + run: bundle check --path=vendor/bundle || bundle install --path=vendor/bundle --jobs=4 --retry=3 + - name: Run rspec tests + run: bundle exec rspec spec/react_on_rails + - name: Store test results + uses: actions/upload-artifact@v2 + with: + name: main-rspec + path: ~/rspec + - name: Store artifacts + uses: actions/upload-artifact@v2 + with: + name: main-test-log + path: log/test.log From 2582b9f00f944c99285c5f1915422e6c74db7f10 Mon Sep 17 00:00:00 2001 From: Namil Kim Date: Sat, 29 Aug 2020 04:54:33 +0900 Subject: [PATCH 15/15] Minor fix --- .github/workflows/rspec-package-specs.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/rspec-package-specs.yml b/.github/workflows/rspec-package-specs.yml index 17e53adf27..7efa660089 100644 --- a/.github/workflows/rspec-package-specs.yml +++ b/.github/workflows/rspec-package-specs.yml @@ -11,10 +11,10 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - name: Setup Node - uses: actions/setup-node@v1.4.3 + - name: Setup Ruby + uses: ruby/setup-ruby@v1 with: - node-version: ${{ matrix.node }} + ruby-version: ${{ matrix.ruby }} - name: Print system information run: | echo "Linux release: "; cat /etc/issue