Migrate React on Rails Pro CI from CircleCI to GitHub Actions #7
Workflow file for this run
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: | |
| # Jest unit tests for Pro package | |
| package-js-tests: | |
| strategy: | |
| matrix: | |
| node-version: ['20', '22'] | |
| 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: ${{ matrix.node-version }} | |
| 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: 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-node${{ matrix.node-version }} | |
| 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 |