94 lines
2.5 KiB
YAML
94 lines
2.5 KiB
YAML
name: CI
|
|
|
|
on:
|
|
pull_request:
|
|
push:
|
|
branches: [ main ]
|
|
|
|
jobs:
|
|
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: Scan for common Rails security vulnerabilities using static analysis
|
|
run: bin/brakeman --no-pager
|
|
|
|
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
|
|
|
|
lint:
|
|
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: Lint code for consistent style
|
|
run: bin/rubocop -f github
|
|
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
|
|
- name: Install packages
|
|
run: sudo apt-get update && sudo apt-get install --no-install-recommends -y build-essential git libyaml-dev pkg-config software-properties-common apt-transport-https ca-certificates
|
|
|
|
#- name: Import Chrome GPG key
|
|
# run: curl -fSsL https://dl.google.com/linux/linux_signing_key.pub | sudo gpg --dearmor | sudo tee /usr/share/keyrings/google-chrome.gpg >> /dev/null
|
|
|
|
#- name: Import Chrome APT repository
|
|
# run: echo deb [arch=amd64 signed-by=/usr/share/keyrings/google-chrome.gpg] http://dl.google.com/linux/chrome/deb/ stable main | sudo tee /etc/apt/sources.list.d/google-chrome.list
|
|
|
|
#- name: Install Chrome
|
|
# run: sudo apt update && sudo apt install google-chrome-stable
|
|
|
|
- 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: Run tests
|
|
env:
|
|
RAILS_ENV: test
|
|
# REDIS_URL: redis://localhost:6379/0
|
|
run: bin/rails db:test:prepare test test:system
|
|
|
|
- name: Keep screenshots from failed system tests
|
|
uses: actions/upload-artifact@v4
|
|
if: failure()
|
|
with:
|
|
name: screenshots
|
|
path: ${{ github.workspace }}/tmp/screenshots
|
|
if-no-files-found: ignore
|