diff --git a/.github/workflows/js_test.yml b/.github/workflows/js_test.yml index bfb7f6e2e..ba98a7669 100644 --- a/.github/workflows/js_test.yml +++ b/.github/workflows/js_test.yml @@ -1,76 +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" - 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" + 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 - - name: Install Node Packages - run: npm install --legacy-peer-deps + node-version: ${{ matrix.node }} + cache: yarn - - name: Set up database schema - run: bin/rails db:schema:load + - 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: Build shakapacker chunks - 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" + - 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 863a6429c..e9e70e8a0 100644 --- a/.github/workflows/lint_test.yml +++ b/.github/workflows/lint_test.yml @@ -1,51 +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: Set Display environment variable - run: "export DISPLAY=:99" + 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 - - 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: 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 - uses: GabrielBB/xvfb-action@v1 - with: - run: bundle exec rake lint - working-directory: ./ #optional - options: ":99 -ac -screen scn 1600x1200x16" + - name: Run lint + run: bundle exec rake lint diff --git a/.github/workflows/rspec_test.yml b/.github/workflows/rspec_test.yml index 55da03fbf..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,8 +76,8 @@ jobs: - name: Build shakapacker chunks run: NODE_ENV=development bundle exec bin/shakapacker - - name: Run tests with xvfb - uses: GabrielBB/xvfb-action@v1 + - name: Run rspec with xvfb + uses: coactions/setup-xvfb@v1 with: run: bundle exec rake ci:rspec working-directory: ./ #optional 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",