[DO NOT MERGE] Pro RSC migration: stacked base PR (tracks sub-PRs) #1028
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: "Rspec CI" | |
| on: | |
| push: | |
| branches: [ "master" ] | |
| pull_request: | |
| branches: [ "master" ] | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| node: [22.x] | |
| ruby: [3.4.6] | |
| services: | |
| postgres: | |
| image: postgres:11-alpine | |
| ports: | |
| - "5432:5432" | |
| env: | |
| POSTGRES_DB: rails_test | |
| POSTGRES_USER: rails | |
| POSTGRES_PASSWORD: password | |
| 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 | |
| # Must match config.renderer_password in config/initializers/react_on_rails_pro.rb. | |
| # Setting explicitly avoids silent drift if the two-sided defaults ever diverge. | |
| RENDERER_PASSWORD: local-dev-renderer-password | |
| 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 | |
| - name: Use Ruby ${{ matrix.ruby }} | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: ${{ matrix.ruby }} | |
| bundler-cache: true | |
| - name: Use Node.js ${{ matrix.node }} | |
| uses: actions/setup-node@v3 | |
| with: | |
| 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 | |
| - name: Build i18n libraries | |
| run: bundle exec rake react_on_rails:locale | |
| - name: Generate React on Rails packs | |
| run: bundle exec rails react_on_rails:generate_packs | |
| - name: Build Rescript components | |
| run: yarn res:build | |
| - name: Build shakapacker chunks | |
| run: NODE_ENV=development bundle exec bin/shakapacker | |
| - name: Start Node renderer for SSR | |
| run: | | |
| node renderer/node-renderer.js & | |
| RENDERER_PID=$! | |
| echo "Waiting for Node renderer (PID $RENDERER_PID) on port 3800..." | |
| for i in $(seq 1 30); do | |
| if ! kill -0 $RENDERER_PID 2>/dev/null; then | |
| echo "Node renderer process exited unexpectedly (see output above)." | |
| exit 1 | |
| fi | |
| if nc -z localhost 3800 2>/dev/null; then | |
| echo "Node renderer is ready" | |
| exit 0 | |
| fi | |
| sleep 1 | |
| done | |
| echo "Node renderer failed to start within 30 seconds (see output above)." | |
| exit 1 | |
| - name: Run rspec with xvfb | |
| uses: coactions/setup-xvfb@v1 | |
| with: | |
| run: bundle exec rake ci:rspec | |
| working-directory: ./ #optional | |
| options: ":99 -ac -screen scn 1600x1200x16" |