|
| 1 | +# This workflow uses actions that are not certified by GitHub. They are |
| 2 | +# provided by a third-party and are governed by separate terms of service, |
| 3 | +# privacy policy, and support documentation. |
| 4 | +# |
| 5 | +# This workflow will install a prebuilt Ruby version, install dependencies, and |
| 6 | +# run tests and linters. |
| 7 | +name: "Ruby on Rails CI" |
| 8 | +on: |
| 9 | + push: |
| 10 | + branches: [ "master" ] |
| 11 | + pull_request: |
| 12 | + branches: [ "master" ] |
| 13 | +jobs: |
| 14 | + test: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + strategy: |
| 17 | + fail-fast: false |
| 18 | + services: |
| 19 | + postgres: |
| 20 | + image: postgres:11-alpine |
| 21 | + ports: |
| 22 | + - "5432:5432" |
| 23 | + env: |
| 24 | + POSTGRES_DB: rails_test |
| 25 | + POSTGRES_USER: rails |
| 26 | + POSTGRES_PASSWORD: password |
| 27 | + env: |
| 28 | + RAILS_ENV: test |
| 29 | + NODE_ENV: test |
| 30 | + DATABASE_URL: "postgres://rails:password@localhost:5432/rails_test" |
| 31 | + DRIVER: selenium_chrome |
| 32 | + CHROME_BIN: /usr/bin/google-chrome |
| 33 | + USE_COVERALLS: true |
| 34 | + steps: |
| 35 | + - name: Install Chrome |
| 36 | + run: | |
| 37 | + sudo apt-get update |
| 38 | + sudo apt-get install -y xvfb libappindicator1 fonts-liberation |
| 39 | + wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb |
| 40 | + sudo dpkg -i google-chrome*.deb |
| 41 | + "/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen scn 1600x1200x16" |
| 42 | + - name: Check Chrome version |
| 43 | + run: google-chrome --version |
| 44 | + - name: Set Display environment variable |
| 45 | + run: "export DISPLAY=:99" |
| 46 | + - name: Checkout code |
| 47 | + uses: actions/checkout@v3 |
| 48 | + # Add or replace dependency steps here |
| 49 | + - name: Install Ruby and gems |
| 50 | + uses: ruby/setup-ruby@0a29871fe2b0200a17a4497bae54fe5df0d973aa # v1.115.3 |
| 51 | + with: |
| 52 | + ruby: 3.x |
| 53 | + bundler-cache: true |
| 54 | + # Add or replace database setup steps here |
| 55 | + - name: Set up database schema |
| 56 | + run: bin/rails db:schema:load |
| 57 | + - name: Use Node.js 16.x |
| 58 | + uses: actions/setup-node@v3 |
| 59 | + with: |
| 60 | + node-version: 16.x |
| 61 | + - name: Build |
| 62 | + run: | |
| 63 | + npm install |
| 64 | + npx webpack |
| 65 | + # Add or replace test runners here |
| 66 | + - name: Run tests |
| 67 | + run: bundle exec rake react_on_rails:locale |
0 commit comments