Ruby test and lint github action workflow #2
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: "Continuous Integration" | |
on: | |
push: | |
branches: ['main'] | |
pull_request: | |
types: ['opened', 'reopened', 'synchronize', 'unlocked'] | |
jobs: | |
ruby-lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Ruby Lint | |
uses: standardrb/standard-ruby-action@v0.0.5 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
USE_BUNDLE_VERSION: true # use Gemfile.lock version of standardrb | |
rails-test: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:15 | |
ports: | |
- "5432:5432" | |
env: | |
POSTGRES_DB: sif | |
POSTGRES_USER: sif | |
POSTGRES_PASSWORD: password | |
redis: | |
image: redis:7.0 | |
env: | |
RAILS_ENV: test | |
DATABASE_URL: "postgres://sif:password@localhost:5432/sif" | |
REDIS_URL: "redis://localhost:6379/1" | |
BROWSERSLIST_IGNORE_OLD_DATA: true | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1.178.0 | |
with: | |
ruby-version: '3.2.3' | |
bundler-cache: true # runs 'bundle install' and caches installed gems automatically | |
- name: Set up database | |
run: bin/rails db:setup | |
- name: Run tests | |
run: bin/rails test |