Reuse existing installation if it already exists #3191
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
name: CI | |
on: | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
jobs: | |
scan_js: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: .ruby-version | |
bundler-cache: true | |
- name: Scan for security vulnerabilities in JavaScript dependencies | |
run: bin/importmap audit | |
scan_ruby: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: .ruby-version | |
bundler-cache: true | |
- name: Security bundler audit dependencies | |
run: bundle exec bundler-audit --update | |
- name: Scan for common Rails security vulnerabilities using static analysis | |
run: bin/brakeman --no-pager -w2 | |
lint: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:14-alpine | |
ports: | |
- "5432:5432" | |
env: | |
POSTGRES_DB: rails_test | |
POSTGRES_USER: rails | |
POSTGRES_PASSWORD: password | |
redis: | |
image: redis:alpine | |
ports: [ "6379:6379" ] | |
options: --entrypoint redis-server | |
env: | |
RAILS_ENV: test | |
DATABASE_URL: "postgres://rails:password@localhost:5432/rails_test" | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: .ruby-version | |
bundler-cache: true | |
- name: Lint Ruby files | |
run: bin/rubocop -f github | |
- name: Set up database schema integrity | |
run: bin/rails db:schema:load | |
- name: Check auto-loading | |
run: bundle exec rails zeitwerk:check | |
test: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:14-alpine | |
ports: | |
- "5432:5432" | |
env: | |
POSTGRES_DB: rails_test | |
POSTGRES_USER: rails | |
POSTGRES_PASSWORD: password | |
redis: | |
image: redis:alpine | |
ports: [ "6379:6379" ] | |
options: --entrypoint redis-server | |
env: | |
RAILS_ENV: test | |
DATABASE_URL: "postgres://rails:password@localhost:5432/rails_test" | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: .ruby-version | |
bundler-cache: true | |
- name: Set up database schema | |
run: bin/rails db:schema:load | |
- name: Run asset pre compilation | |
run: bundle exec rails assets:precompile | |
- name: Run tests | |
run: bundle exec rspec |