Update ci.yml #77
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: | ||
pull_request: | ||
push: | ||
branches: | ||
- main | ||
defaults: &defaults | ||
- 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: Install error_highlight | ||
run: gem install error_highlight -v '0.7.0' | ||
jobs: | ||
scan_ruby: | ||
runs-on: ubuntu-latest | ||
steps: | ||
<<: *defaults | ||
- name: Scan for common Rails security vulnerabilities using static analysis | ||
run: bundle exec bin/brakeman --no-pager | ||
scan_js: | ||
runs-on: ubuntu-latest | ||
steps: | ||
<<: *defaults | ||
- name: Scan for security vulnerabilities in JavaScript dependencies | ||
run: bin/importmap audit | ||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
<<: *defaults | ||
- name: Lint code for consistent style | ||
run: bin/rubocop -f github | ||
test: | ||
runs-on: ubuntu-latest | ||
services: | ||
redis: | ||
image: redis | ||
ports: | ||
- 6379:6379 | ||
options: --health-cmd "redis-cli ping" --health-interval 10s --health-timeout 5s --health-retries 5 | ||
steps: | ||
- name: Add Chrome repository | ||
run: | | ||
wget -q -O - https://dl.google.com/linux/linux_signing_key.pub | sudo apt-key add - | ||
sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main' > /etc/apt/sources.list.d/google-chrome.list | ||
- name: Install dependencies | ||
run: sudo apt-get update && sudo apt-get install --no-install-recommends -y google-chrome-stable curl libjemalloc2 libvips sqlite3 | ||
<<: *defaults | ||
- name: Precompile assets | ||
run: bundle exec rails assets:precompile | ||
- name: Run rspec | ||
env: | ||
RAILS_ENV: test | ||
REDIS_URL: redis://localhost:6379/0 | ||
run: bundle exec rspec | ||
- name: Keep screenshots from failed system tests | ||
uses: actions/upload-artifact@v4 | ||
if: failure() | ||
with: | ||
name: screenshots | ||
path: tmp/screenshots | ||
if-no-files-found: ignore |