From 543760610c89c54e7113ddfadec51d716faf441e Mon Sep 17 00:00:00 2001 From: Mostafa Ahangarha Date: Fri, 4 Aug 2023 15:23:57 +0330 Subject: [PATCH 1/5] Update CI to use xvfb-action --- .github/workflows/js_test.yml | 6 +----- .github/workflows/lint_test.yml | 6 +----- .github/workflows/rspec_test.yml | 2 +- 3 files changed, 3 insertions(+), 11 deletions(-) diff --git a/.github/workflows/js_test.yml b/.github/workflows/js_test.yml index bfb7f6e2e..065c2727f 100644 --- a/.github/workflows/js_test.yml +++ b/.github/workflows/js_test.yml @@ -69,8 +69,4 @@ jobs: run: NODE_ENV=development bundle exec bin/shakapacker - name: Run js tests with xvfb - uses: GabrielBB/xvfb-action@v1 - with: - run: bundle exec rake ci:js - working-directory: ./ #optional - options: ":99 -ac -screen scn 1600x1200x16" + run: bundle exec rake ci:js diff --git a/.github/workflows/lint_test.yml b/.github/workflows/lint_test.yml index 863a6429c..9391f7d40 100644 --- a/.github/workflows/lint_test.yml +++ b/.github/workflows/lint_test.yml @@ -44,8 +44,4 @@ jobs: run: NODE_ENV=development bundle exec bin/shakapacker - name: Run lint tests with xvfb - uses: GabrielBB/xvfb-action@v1 - with: - run: bundle exec rake lint - working-directory: ./ #optional - options: ":99 -ac -screen scn 1600x1200x16" + run: bundle exec rake lint diff --git a/.github/workflows/rspec_test.yml b/.github/workflows/rspec_test.yml index 55da03fbf..301ba8a5e 100644 --- a/.github/workflows/rspec_test.yml +++ b/.github/workflows/rspec_test.yml @@ -69,7 +69,7 @@ jobs: run: NODE_ENV=development bundle exec bin/shakapacker - name: Run tests with xvfb - uses: GabrielBB/xvfb-action@v1 + uses: coactions/setup-xvfb@v1 with: run: bundle exec rake ci:rspec working-directory: ./ #optional From a646aa0cd2e19bfa5304a46ff9284b52dfdff0ae Mon Sep 17 00:00:00 2001 From: Mostafa Ahangarha Date: Fri, 4 Aug 2023 15:54:15 +0330 Subject: [PATCH 2/5] Remove unneeded entries in js and lint workflows --- .github/workflows/js_test.yml | 23 ++--------------------- .github/workflows/lint_test.yml | 9 ++------- 2 files changed, 4 insertions(+), 28 deletions(-) diff --git a/.github/workflows/js_test.yml b/.github/workflows/js_test.yml index 065c2727f..cb785c5e5 100644 --- a/.github/workflows/js_test.yml +++ b/.github/workflows/js_test.yml @@ -28,22 +28,8 @@ jobs: RAILS_ENV: test NODE_ENV: test DATABASE_URL: "postgres://rails:password@localhost:5432/rails_test" - DRIVER: selenium_chrome - CHROME_BIN: /usr/bin/google-chrome USE_COVERALLS: true steps: - - name: Install Chrome - uses: browser-actions/setup-chrome@latest - - - name: Check Chrome version - run: chrome --version - - - name: Check Chrome version - run: google-chrome --version - - - name: Set Display environment variable - run: "export DISPLAY=:99" - - name: Checkout code uses: actions/checkout@v3 @@ -56,17 +42,12 @@ jobs: uses: actions/setup-node@v3 with: node-version: 18.x - - name: Install Node Packages - run: npm install --legacy-peer-deps - - name: Set up database schema - run: bin/rails db:schema:load + - name: Install Node Packages + run: yarn install - name: Build i18n libraries run: bundle exec rake react_on_rails:locale - - name: Build shakapacker chunks - run: NODE_ENV=development bundle exec bin/shakapacker - - name: Run js tests with xvfb run: bundle exec rake ci:js diff --git a/.github/workflows/lint_test.yml b/.github/workflows/lint_test.yml index 9391f7d40..7a6bd875e 100644 --- a/.github/workflows/lint_test.yml +++ b/.github/workflows/lint_test.yml @@ -19,9 +19,6 @@ jobs: RAILS_ENV: test NODE_ENV: test steps: - - name: Set Display environment variable - run: "export DISPLAY=:99" - - name: Checkout code uses: actions/checkout@v3 @@ -34,14 +31,12 @@ jobs: uses: actions/setup-node@v3 with: node-version: 18.x + - name: Install Node Packages - run: npm install --legacy-peer-deps + run: yarn - name: Build i18n libraries run: bundle exec rake react_on_rails:locale - - name: Build shakapacker chunks - run: NODE_ENV=development bundle exec bin/shakapacker - - name: Run lint tests with xvfb run: bundle exec rake lint From c9ae291943ae2b3437cbd560a1dbccd48bf1495d Mon Sep 17 00:00:00 2001 From: Mostafa Ahangarha Date: Fri, 4 Aug 2023 16:19:59 +0330 Subject: [PATCH 3/5] Match the js and lint workflows with other projects --- .github/workflows/js_test.yml | 41 +++++++++++++++------------------ .github/workflows/lint_test.yml | 31 ++++++++++++++----------- 2 files changed, 36 insertions(+), 36 deletions(-) diff --git a/.github/workflows/js_test.yml b/.github/workflows/js_test.yml index cb785c5e5..ba98a7669 100644 --- a/.github/workflows/js_test.yml +++ b/.github/workflows/js_test.yml @@ -1,53 +1,48 @@ -# This workflow uses actions that are not certified by GitHub. They are -# provided by a third-party and are governed by separate terms of service, -# privacy policy, and support documentation. -# -# This workflow will install a prebuilt Ruby version, install dependencies, and -# run js tests. name: "JS CI" + on: push: branches: [ "master" ] pull_request: branches: [ "master" ] + jobs: test: runs-on: ubuntu-latest + strategy: fail-fast: false - services: - postgres: - image: postgres:11-alpine - ports: - - "5432:5432" - env: - POSTGRES_DB: rails_test - POSTGRES_USER: rails - POSTGRES_PASSWORD: password + matrix: + node: [18.x] + ruby: [3.1.2] + env: RAILS_ENV: test NODE_ENV: test - DATABASE_URL: "postgres://rails:password@localhost:5432/rails_test" USE_COVERALLS: true + steps: - name: Checkout code uses: actions/checkout@v3 - - name: Install Ruby and gems - uses: ruby/setup-ruby@0a29871fe2b0200a17a4497bae54fe5df0d973aa # v1.115.3 + - uses: ruby/setup-ruby@v1 with: + ruby-version: ${{ matrix.ruby }} bundler-cache: true - - name: Use Node.js 18.x + - name: Use Node.js ${{ matrix.node }} uses: actions/setup-node@v3 with: - node-version: 18.x + node-version: ${{ matrix.node }} + cache: yarn - - name: Install Node Packages - run: yarn install + - name: Install dependencies + run: | + bundle install + yarn install --frozen-lockfile --non-interactive --prefer-offline - name: Build i18n libraries run: bundle exec rake react_on_rails:locale - - name: Run js tests with xvfb + - name: Run js tests run: bundle exec rake ci:js diff --git a/.github/workflows/lint_test.yml b/.github/workflows/lint_test.yml index 7a6bd875e..e9e70e8a0 100644 --- a/.github/workflows/lint_test.yml +++ b/.github/workflows/lint_test.yml @@ -1,42 +1,47 @@ -# This workflow uses actions that are not certified by GitHub. They are -# provided by a third-party and are governed by separate terms of service, -# privacy policy, and support documentation. -# -# This workflow will install a prebuilt Ruby version, install dependencies, and -# run rspec tests. name: "Lint CI" + on: push: branches: [ "master" ] pull_request: branches: [ "master" ] + jobs: test: runs-on: ubuntu-latest + strategy: fail-fast: false + matrix: + node: [18.x] + ruby: [3.1.2] + env: RAILS_ENV: test NODE_ENV: test + steps: - name: Checkout code uses: actions/checkout@v3 - - name: Install Ruby and gems - uses: ruby/setup-ruby@0a29871fe2b0200a17a4497bae54fe5df0d973aa # v1.115.3 + - uses: ruby/setup-ruby@v1 with: + ruby-version: ${{ matrix.ruby }} bundler-cache: true - - name: Use Node.js 18.x + - name: Use Node.js ${{ matrix.node }} uses: actions/setup-node@v3 with: - node-version: 18.x + node-version: ${{ matrix.node }} + cache: yarn - - name: Install Node Packages - run: yarn + - name: Install dependencies + run: | + bundle install + yarn install --frozen-lockfile --non-interactive --prefer-offline - name: Build i18n libraries run: bundle exec rake react_on_rails:locale - - name: Run lint tests with xvfb + - name: Run lint run: bundle exec rake lint From 4bd8f3599483ef60e51d2d0c54c00b560ac10b83 Mon Sep 17 00:00:00 2001 From: Mostafa Ahangarha Date: Fri, 4 Aug 2023 16:51:02 +0330 Subject: [PATCH 4/5] Fix packs path in yarn scripts --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index d1aa1205b..4870536b1 100644 --- a/package.json +++ b/package.json @@ -22,9 +22,9 @@ "lint": " yarn lint:eslint --fix && yarn lint:prettier --w", "test": "yarn build:test && yarn lint", "test:client": "cd client && yarn test", - "build:test": "rm -rf public/webpack/test && RAILS_ENV=test NODE_ENV=test bin/shakapacker", - "build:dev": "rm -rf public/webpack/development && RAILS_ENV=development NODE_ENV=development bin/shakapacker", - "build:clean": "rm -rf public/webpack || true" + "build:test": "rm -rf public/packs-test && RAILS_ENV=test NODE_ENV=test bin/shakapacker", + "build:dev": "rm -rf public/packs && RAILS_ENV=development NODE_ENV=development bin/shakapacker", + "build:clean": "rm -rf public/packs || true" }, "dependencies": { "@babel/cli": "^7.21.0", From 055cfc784d082aae41a1c72a553b284ebf619ca0 Mon Sep 17 00:00:00 2001 From: Mostafa Ahangarha Date: Fri, 4 Aug 2023 16:54:49 +0330 Subject: [PATCH 5/5] Match rspec workflow with other projects --- .github/workflows/rspec_test.yml | 34 ++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/.github/workflows/rspec_test.yml b/.github/workflows/rspec_test.yml index 301ba8a5e..1106cf291 100644 --- a/.github/workflows/rspec_test.yml +++ b/.github/workflows/rspec_test.yml @@ -1,20 +1,21 @@ -# This workflow uses actions that are not certified by GitHub. They are -# provided by a third-party and are governed by separate terms of service, -# privacy policy, and support documentation. -# -# This workflow will install a prebuilt Ruby version, install dependencies, and -# run tests and linters. -name: "Ruby on Rails CI" +name: "Rspec CI" + on: push: branches: [ "master" ] pull_request: branches: [ "master" ] + jobs: test: runs-on: ubuntu-latest + strategy: fail-fast: false + matrix: + node: [18.x] + ruby: [3.1.2] + services: postgres: image: postgres:11-alpine @@ -24,6 +25,7 @@ jobs: POSTGRES_DB: rails_test POSTGRES_USER: rails POSTGRES_PASSWORD: password + env: RAILS_ENV: test NODE_ENV: test @@ -31,6 +33,7 @@ jobs: DRIVER: selenium_chrome CHROME_BIN: /usr/bin/google-chrome USE_COVERALLS: true + steps: - name: Install Chrome uses: browser-actions/setup-chrome@latest @@ -47,17 +50,22 @@ jobs: - name: Checkout code uses: actions/checkout@v3 - - name: Install Ruby and gems + - name: Use Ruby ${{ matrix.node }} uses: ruby/setup-ruby@v1 with: + ruby-version: ${{ matrix.ruby }} bundler-cache: true - - name: Use Node.js 18.x + - name: Use Node.js ${{ matrix.node }} uses: actions/setup-node@v3 with: - node-version: 18.x - - name: Install Node Packages - run: npm install --legacy-peer-deps + node-version: ${{ matrix.node }} + cache: yarn + + - name: Install dependencies + run: | + bundle install + yarn install --frozen-lockfile --non-interactive --prefer-offline - name: Set up database schema run: bin/rails db:schema:load @@ -68,7 +76,7 @@ jobs: - name: Build shakapacker chunks run: NODE_ENV=development bundle exec bin/shakapacker - - name: Run tests with xvfb + - name: Run rspec with xvfb uses: coactions/setup-xvfb@v1 with: run: bundle exec rake ci:rspec

AltStyle によって変換されたページ (->オリジナル) /