Skip to content

Commit

Permalink
Merge pull request #63 from ydaniju/ydaniju-patch-1
Browse files Browse the repository at this point in the history
introduce workflow for ruby test
  • Loading branch information
ydaniju authored Jul 31, 2024
2 parents c72fc84 + f4f5758 commit 416f4fb
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 17 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/ruby.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby

name: Ruby

on:
push:
branches: ["master"]
pull_request:
branches: ["master"]

permissions:
contents: read

env:
DATABASE_URL: postgres://postgres:@localhost:5432/test
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres

jobs:
test:
runs-on: ubuntu-latest

services:
postgres:
image: postgres:latest
ports:
- 5432:5432
env:
POSTGRES_DB: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- name: Install libssl
run: sudo apt install -y libssl-dev
- name: Set up Ruby
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
# change this to (see https://github.com/ruby/setup-ruby#versioning):
# uses: ruby/setup-ruby@v1
uses: ruby/setup-ruby@v1 # v1.146.0
with:
# ruby-version: ${{ matrix.ruby-version }} using .ruby-version file
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Create database
run: RAILS_ENV=test bundle exec rails db:create && bundle exec rails db:migrate
- name: Run tests
run: RAILS_ENV=test bundle exec rake spec
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@

# Ignore specs coverage
/coverage/.resultset.json
/coverage/.last_run.json
/coverage/.last_run.json
/spec/reports
34 changes: 19 additions & 15 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ GEM
faker (3.4.2)
i18n (>= 1.8.11, < 2)
ffi (1.17.0-arm64-darwin)
ffi (1.17.0-x86_64-linux-gnu)
font-awesome-sass (6.5.2)
sassc (~> 2.0)
globalid (1.2.1)
Expand Down Expand Up @@ -169,22 +170,25 @@ GEM
mize (0.6.0)
modernizr-rails (2.7.1)
mutex_m (0.2.0)
net-imap (0.4.12)
net-imap (0.4.14)
date
net-protocol
net-pop (0.1.2)
net-protocol
net-protocol (0.2.2)
timeout
net-smtp (0.5.0)
net-protocol
nio4r (2.7.3)
nokogiri (1.16.6-arm64-darwin)
nokogiri (1.16.7-arm64-darwin)
racc (~> 1.4)
nokogiri (1.16.7-x86_64-linux)
racc (~> 1.4)
parallel (1.25.1)
parser (3.3.4.0)
ast (~> 2.4.1)
racc
pg (1.5.6)
pg (1.5.7)
pry (0.14.2)
coderay (~> 1.1)
method_source (~> 1.0)
Expand All @@ -193,16 +197,17 @@ GEM
psych (5.1.2)
stringio
public_suffix (6.0.1)
puma (3.4.0)
racc (1.8.0)
rack (2.2.9)
rack-session (1.0.2)
rack (< 3)
puma (6.4.2)
nio4r (~> 2.0)
racc (1.8.1)
rack (3.1.7)
rack-session (2.0.0)
rack (>= 3.0.0)
rack-test (2.1.0)
rack (>= 1.3)
rackup (1.0.0)
rack (< 3)
webrick
rackup (2.1.0)
rack (>= 3)
webrick (~> 1.8)
rails (7.1.3.4)
actioncable (= 7.1.3.4)
actionmailbox (= 7.1.3.4)
Expand Down Expand Up @@ -313,7 +318,7 @@ GEM
sprockets (4.2.1)
concurrent-ruby (~> 1.0)
rack (>= 2.2.4, < 4)
sprockets-rails (3.5.1)
sprockets-rails (3.5.2)
actionpack (>= 6.1)
activesupport (>= 6.1)
sprockets (>= 3.0.0)
Expand All @@ -336,8 +341,6 @@ GEM
turbolinks-source (5.2.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
tzinfo-data (1.2024.1)
tzinfo (>= 1.0.0)
uglifier (4.2.0)
execjs (>= 0.3.0, < 3)
unicode-display_width (2.5.0)
Expand All @@ -349,12 +352,13 @@ GEM
will_paginate (4.0.1)
xpath (3.2.0)
nokogiri (~> 1.8)
zeitwerk (2.6.16)
zeitwerk (2.6.17)
zeroclipboard-rails (0.1.2)
railties (>= 3.1)

PLATFORMS
arm64-darwin-23
x86_64-linux

DEPENDENCIES
annotate
Expand Down
2 changes: 1 addition & 1 deletion config/puma.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

preload_app!

rackup DefaultRackup
rackup DefaultRackup if defined?(DefaultRackup)
port ENV['PORT'] || 3000
environment ENV['RACK_ENV'] || 'development'

Expand Down

0 comments on commit 416f4fb

Please sign in to comment.