Update Fly.io & CI #21
Workflow file for this run
This file contains 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
# 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: Linting & Testing | |
on: | |
pull_request: | |
branches: ["master"] | |
jobs: | |
rspec-test: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: password | |
ports: ["5432:5432"] | |
# Set health checks to wait until postgres has started | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
- name: Setting up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
- name: Installing Bundler & Gems | |
run: | | |
gem install bundler | |
bundle install --jobs 4 --retry 3 | |
- name: Run yarn commands | |
run: | | |
yarn install | |
yarn run build | |
- name: Preparing Database | |
env: | |
DATABASE_URL: postgres://postgres:password@localhost:5432/test | |
RAILS_ENV: test | |
PG_USER: postgres | |
run: | | |
bundle exec rails db:create | |
bundle exec rails db:migrate | |
- name: Checking linting errors in erb files | |
run: bundle exec erblint -l | |
- name: Checking rubocop errors | |
run: bundle exec rubocop | |
- name: Testing routes | |
env: | |
DATABASE_URL: postgres://postgres:password@localhost:5432/test | |
RAILS_ENV: test | |
PG_USER: postgres | |
run: rspec spec/routing | |
- name: Testing requests | |
env: | |
DATABASE_URL: postgres://postgres:password@localhost:5432/test | |
RAILS_ENV: test | |
PG_USER: postgres | |
run: rspec spec/requests | |
- name: Testing models | |
env: | |
DATABASE_URL: postgres://postgres:password@localhost:5432/test | |
RAILS_ENV: test | |
PG_USER: postgres | |
run: rspec spec/models | |
# - name: Setup Chrome | |
# uses: browser-actions/[email protected] | |
# - name: setup-chromedriver | |
# uses: nanasess/[email protected] | |
- name: Testing features | |
env: | |
DATABASE_URL: postgres://postgres:password@localhost:5432/test | |
RAILS_ENV: test | |
PG_USER: postgres | |
# export DISPLAY=:99 | |
# chromedriver & | |
# sudo Xvfb -ac :99 > /dev/null 2>&1 & # optional | |
run: | | |
rspec spec/features | |
# 'sudo Xvfb -ac :99 > /dev/null 2>&1 & # optional' command launches an instance of Xvfb (X Virtual Framebuffer), a virtual display server for X11 that allows running graphical applications without an actual display hardware. |