mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-11 09:41:40 -05:00
Add a GitHub Actions workflow for Ruby on Rails
This commit is contained in:
parent
359795672b
commit
fb83c8280c
3 changed files with 46 additions and 65 deletions
80
.github/workflows/ci.yml
vendored
80
.github/workflows/ci.yml
vendored
|
|
@ -1,57 +1,53 @@
|
||||||
name: CI
|
# .github/workflows/ruby.yml
|
||||||
on: [pull_request]
|
name: Ruby
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
pull_request:
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
|
env:
|
||||||
|
POSTGRES_DB: postgres
|
||||||
|
POSTGRES_USER: postgres
|
||||||
|
POSTGRES_PASSWORD: password
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
tests:
|
||||||
|
name: Tests
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
services:
|
services:
|
||||||
postgres:
|
postgres:
|
||||||
image: postgres:12
|
image: postgres:12
|
||||||
ports:
|
|
||||||
- 5432:5432
|
|
||||||
env:
|
env:
|
||||||
POSTGRES_USER: postgres
|
POSTGRES_PASSWORD: password
|
||||||
POSTGRES_PASSWORD: postgres
|
ports: ['5432:5432']
|
||||||
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
|
options: >-
|
||||||
|
--health-cmd pg_isready
|
||||||
|
--health-interval 10s
|
||||||
|
--health-timeout 5s
|
||||||
|
--health-retries 5
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
- name: Setup Ruby and install gems
|
- name: Setup Ruby
|
||||||
uses: ruby/setup-ruby@v1
|
uses: ruby/setup-ruby@v1
|
||||||
with:
|
with:
|
||||||
|
ruby-version: 3.2.2
|
||||||
bundler-cache: true
|
bundler-cache: true
|
||||||
|
|
||||||
- name: Install dependent libraries
|
- name: Install dependencies
|
||||||
run: sudo apt-get install libpq-dev
|
|
||||||
|
|
||||||
- name: Bundle install
|
|
||||||
run: |
|
run: |
|
||||||
gem install bundler
|
sudo apt-get update && sudo apt-get -yqq install libpq-dev
|
||||||
bundle install --jobs 4 --retry 3
|
bundle install --jobs 4 --retry 3
|
||||||
|
- name: Run Tests
|
||||||
- name: Install daisyui
|
env:
|
||||||
run: npm i daisyui
|
RAILS_ENV: test
|
||||||
|
PGHOST: localhost
|
||||||
- name: Compile assets
|
DISABLE_SPRING: 1
|
||||||
run: bundle exec rake assets:precompile
|
|
||||||
|
|
||||||
- name: Setup Database
|
|
||||||
run: |
|
run: |
|
||||||
cp config/database.yml.github-actions config/database.yml
|
cp config/database.ci.yml config/database.yml
|
||||||
bundle exec rake db:create
|
bundle exec rails db:schema:load
|
||||||
bundle exec rake db:schema:load
|
bundle exec rspec --format progress
|
||||||
env:
|
|
||||||
RAILS_ENV: test
|
|
||||||
POSTGRES_USER: postgres
|
|
||||||
POSTGRES_PASSWORD: postgres
|
|
||||||
|
|
||||||
- name: Run RSpec
|
|
||||||
run: COVERAGE=true bundle exec rspec --require rails_helper
|
|
||||||
env:
|
|
||||||
RAILS_ENV: test
|
|
||||||
POSTGRES_USER: postgres
|
|
||||||
POSTGRES_PASSWORD: postgres
|
|
||||||
|
|
||||||
- name: Simplecov Report
|
|
||||||
uses: aki77/simplecov-report-action@v1
|
|
||||||
with:
|
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
|
||||||
8
config/database.ci.yml
Normal file
8
config/database.ci.yml
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
# config/database.ci.yml
|
||||||
|
test:
|
||||||
|
adapter: postgresql
|
||||||
|
encoding: unicode
|
||||||
|
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
|
||||||
|
database: <%= ENV["POSTGRES_DB"] %>
|
||||||
|
username: <%= ENV['POSTGRES_USER'] %>
|
||||||
|
password: <%= ENV["POSTGRES_PASSWORD"] %>
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
default: &default
|
|
||||||
adapter: postgresql
|
|
||||||
encoding: unicode
|
|
||||||
database: <%= ENV['DATABASE_NAME'] %>
|
|
||||||
username: <%= ENV['DATABASE_USERNAME'] %>
|
|
||||||
password: <%= ENV['DATABASE_PASSWORD'] %>
|
|
||||||
port: <%= ENV['DATABASE_PORT'] || '5432' %>
|
|
||||||
host: <%= ENV['DATABASE_HOST'] %>
|
|
||||||
pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %>
|
|
||||||
timeout: 5000
|
|
||||||
|
|
||||||
development:
|
|
||||||
<<: *default
|
|
||||||
database: solo_customer_template_development
|
|
||||||
|
|
||||||
test:
|
|
||||||
<<: *default
|
|
||||||
database: solo_customer_template_test
|
|
||||||
|
|
||||||
production:
|
|
||||||
<<: *default
|
|
||||||
database: solo_customer_template_production
|
|
||||||
url: <%= ENV['DATABASE_URL'] %>
|
|
||||||
Loading…
Reference in a new issue