Rails Sessions Generator #107
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: | |
lint-n-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: | |
ruby-version: .ruby-version | |
bundler-cache: true | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
- name: Install dependencies | |
run: | | |
sudo apt-get install -y -qq libvips | |
yarn install --frozen-lockfile | |
- name: Installing Bundler & Gems | |
run: | | |
gem install bundler | |
bundle install --jobs 4 --retry 3 | |
- name: Scan for common Rails security vulnerabilities using static analysis | |
run: bin/brakeman | |
- name: Find linting errors | |
run: bundle exec erb_lint --lint-all | |
- name: Find rubocop errors | |
run: bin/rubocop | |
- name: Precompile assets | |
run: bin/rails assets:precompile | |
- name: Running Tests | |
env: | |
DATABASE_URL: postgres://postgres:password@localhost:5432/test | |
RAILS_ENV: test | |
PG_USER: postgres | |
run: | | |
bin/rails db:create | |
bin/rails db:migrate | |
bundle exec rspec |