File tree Expand file tree Collapse file tree 9 files changed +158
-2
lines changed
Expand file tree Collapse file tree 9 files changed +158
-2
lines changed Original file line number Diff line number Diff line change 1+ # @see https://dev.to/smitjel/kicking-the-tires-on-github-actions-45g9
2+ # @see https://boringrails.com/articles/building-a-rails-ci-pipeline-with-github-actions/
3+
4+ name : Test
5+
6+ on :
7+ push :
8+ branches :
9+ - main
10+ jobs :
11+ lint :
12+ runs-on : ubuntu-20.04
13+ steps :
14+ - uses : actions/checkout@v2
15+ - name : Set up Ruby
16+ uses : ruby/setup-ruby@v1
17+ with :
18+ bundler-cache : true
19+ - name : Setup gems
20+ run : |
21+ gem install bundler
22+ bundle config set --local deployment 'true'
23+ bundle config set --local with 'test'
24+ bundle install --jobs 4 --retry 3
25+ - name : Linter
26+ run : |
27+ bundle exec rubocop -D
28+ test :
29+ runs-on : ubuntu-20.04
30+ services :
31+ postgres :
32+ env :
33+ POSTGRES_PASSWORD : thisisstupid
34+ image : postgres:11
35+ ports :
36+ - 5432:5432
37+ options : >-
38+ --health-cmd pg_isready
39+ --health-interval 15s
40+ --health-timeout 5s
41+ --health-retries 5
42+
43+ steps :
44+ - uses : actions/checkout@v2
45+ - name : Set up Ruby
46+ uses : ruby/setup-ruby@v1
47+ with :
48+ bundler-cache : true
49+ - name : Setup gems
50+ run : |
51+ sudo apt-get -yqq install libpq-dev
52+ gem install bundler
53+ bundle config set --local deployment 'true'
54+ bundle config set --local with 'test'
55+ bundle install --jobs 4 --retry 3
56+ - name : Prepare postgresql database
57+ env :
58+ RAILS_ENV : test
59+ DATABASE_URL :
postgresql://postgres:[email protected] /chore-schedule-test?pool=5 60+ run : |
61+ rm config/database.yml
62+ bin/rails db:setup
63+ - name : Test
64+ env :
65+ RAILS_ENV : test
66+ DATABASE_URL :
postgresql://postgres:[email protected] /chore-schedule-test?pool=5 67+ run : |
68+ bin/rails test
Original file line number Diff line number Diff line change @@ -46,6 +46,5 @@ production.yaml
4646# Coverage
4747coverage /*
4848
49- bin /*
5049log /*
5150storage /*
Original file line number Diff line number Diff line change 11# Chore Schedule
22
3- ![ Build badge ] ( https://img.shields.io /badge/build-passing-brightgreen.svg )
3+ [ ![ Test ] ( https://github.com/truggeri/chore-schedule/actions/workflows/ruby.yml /badge.svg )] ( https://github.com/truggeri/chore-schedule/actions/workflows/ruby.yml )
44![ Coverage badge] ( https://img.shields.io/badge/coverage-92%25-brightgreen.svg )
55
66An app for making and keeping a chore schedule. See it hosted at [ https://choreplan.truggeri.com ] ( https://choreplan.truggeri.com )
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env ruby
2+ ENV [ 'BUNDLE_GEMFILE' ] ||= File . expand_path ( '../Gemfile' , __dir__ )
3+ load Gem . bin_path ( 'bundler' , 'bundle' )
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env ruby
2+ APP_PATH = File . expand_path ( '../config/application' , __dir__ )
3+ require_relative '../config/boot'
4+ require 'rails/commands'
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env ruby
2+ require_relative '../config/boot'
3+ require 'rake'
4+ Rake . application . run
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env ruby
2+ require 'fileutils'
3+ include FileUtils
4+
5+ # path to your application root.
6+ APP_ROOT = File . expand_path ( '..' , __dir__ )
7+
8+ def system! ( *args )
9+ system ( *args ) || abort ( "\n == Command #{ args } failed ==" )
10+ end
11+
12+ chdir APP_ROOT do
13+ # This script is a starting point to setup your application.
14+ # Add necessary setup steps to this file.
15+
16+ puts '== Installing dependencies =='
17+ system! 'gem install bundler --conservative'
18+ system ( 'bundle check' ) || system! ( 'bundle install' )
19+
20+ # Install JavaScript dependencies if using Yarn
21+ # system('bin/yarn')
22+
23+ # puts "\n== Copying sample files =="
24+ # unless File.exist?('config/database.yml')
25+ # cp 'config/database.yml.sample', 'config/database.yml'
26+ # end
27+
28+ puts "\n == Preparing database =="
29+ system! 'bin/rails db:setup'
30+
31+ puts "\n == Removing old logs and tempfiles =="
32+ system! 'bin/rails log:clear tmp:clear'
33+
34+ puts "\n == Restarting application server =="
35+ system! 'bin/rails restart'
36+ end
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env ruby
2+ require 'fileutils'
3+ include FileUtils
4+
5+ # path to your application root.
6+ APP_ROOT = File . expand_path ( '..' , __dir__ )
7+
8+ def system! ( *args )
9+ system ( *args ) || abort ( "\n == Command #{ args } failed ==" )
10+ end
11+
12+ chdir APP_ROOT do
13+ # This script is a way to update your development environment automatically.
14+ # Add necessary update steps to this file.
15+
16+ puts '== Installing dependencies =='
17+ system! 'gem install bundler --conservative'
18+ system ( 'bundle check' ) || system! ( 'bundle install' )
19+
20+ # Install JavaScript dependencies if using Yarn
21+ # system('bin/yarn')
22+
23+ puts "\n == Updating database =="
24+ system! 'bin/rails db:migrate'
25+
26+ puts "\n == Removing old logs and tempfiles =="
27+ system! 'bin/rails log:clear tmp:clear'
28+
29+ puts "\n == Restarting application server =="
30+ system! 'bin/rails restart'
31+ end
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env ruby
2+ APP_ROOT = File . expand_path ( '..' , __dir__ )
3+ Dir . chdir ( APP_ROOT ) do
4+ begin
5+ exec "yarnpkg" , *ARGV
6+ rescue Errno ::ENOENT
7+ $stderr. puts "Yarn executable was not detected in the system."
8+ $stderr. puts "Download Yarn at https://yarnpkg.com/en/docs/install"
9+ exit 1
10+ end
11+ end
You can’t perform that action at this time.
0 commit comments