mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-10 17:21:38 -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
|
||||
on: [pull_request]
|
||||
# .github/workflows/ruby.yml
|
||||
name: Ruby
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [main]
|
||||
pull_request:
|
||||
branches: [main]
|
||||
|
||||
env:
|
||||
POSTGRES_DB: postgres
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: password
|
||||
|
||||
jobs:
|
||||
build:
|
||||
tests:
|
||||
name: Tests
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
services:
|
||||
postgres:
|
||||
image: postgres:12
|
||||
ports:
|
||||
- 5432:5432
|
||||
env:
|
||||
POSTGRES_USER: postgres
|
||||
POSTGRES_PASSWORD: postgres
|
||||
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5
|
||||
POSTGRES_PASSWORD: password
|
||||
ports: ['5432:5432']
|
||||
options: >-
|
||||
--health-cmd pg_isready
|
||||
--health-interval 10s
|
||||
--health-timeout 5s
|
||||
--health-retries 5
|
||||
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
|
||||
with:
|
||||
ruby-version: 3.2.2
|
||||
bundler-cache: true
|
||||
|
||||
- name: Install dependent libraries
|
||||
run: sudo apt-get install libpq-dev
|
||||
|
||||
- name: Bundle install
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
gem install bundler
|
||||
sudo apt-get update && sudo apt-get -yqq install libpq-dev
|
||||
bundle install --jobs 4 --retry 3
|
||||
|
||||
- name: Install daisyui
|
||||
run: npm i daisyui
|
||||
|
||||
- name: Compile assets
|
||||
run: bundle exec rake assets:precompile
|
||||
|
||||
- name: Setup Database
|
||||
- name: Run Tests
|
||||
env:
|
||||
RAILS_ENV: test
|
||||
PGHOST: localhost
|
||||
DISABLE_SPRING: 1
|
||||
run: |
|
||||
cp config/database.yml.github-actions config/database.yml
|
||||
bundle exec rake db:create
|
||||
bundle exec rake db:schema:load
|
||||
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 }}
|
||||
cp config/database.ci.yml config/database.yml
|
||||
bundle exec rails db:schema:load
|
||||
bundle exec rspec --format progress
|
||||
|
|
|
|||
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