Skip to content

Commit e667186

Browse files
author
Mattia Roccoberton
committed
Update CircleCI config for cache and specs
1 parent 131f145 commit e667186

5 files changed

Lines changed: 130 additions & 4 deletions

File tree

.circleci/config.yml

Lines changed: 42 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,49 @@ orbs:
55
jobs:
66
build:
77
docker:
8-
- image: circleci/ruby:2.6.3-stretch-node
8+
- image: circleci/ruby:2.6.6-node
9+
environment:
10+
RAILS_ENV: test
11+
PGHOST: 127.0.0.1
12+
PGUSER: root
13+
- image: circleci/postgres:9.6.15-alpine
14+
environment:
15+
POSTGRES_USER: root
16+
POSTGRES_DB: circle-test_test
917
executor: ruby/default
1018
steps:
1119
- checkout
20+
- restore_cache:
21+
key: gem-cache-{{ checksum "active_storage_db.gemspec" }}
1222
- run:
13-
name: Which bundler?
14-
command: bundle -v
15-
- ruby/bundle-install
23+
name: Setup Bundler
24+
command: gem install bundler
25+
- run:
26+
name: Bundle Install
27+
command: bundle install --path vendor/bundle
28+
- save_cache:
29+
key: gem-cache-{{ checksum "active_storage_db.gemspec" }}
30+
paths: vendor/bundle
31+
- run:
32+
name: PostgreSQL DB Setup
33+
command: |
34+
DB=postgresql bin/rails db:reset
35+
- run:
36+
name: Run PostgreSQL Specs
37+
command: |
38+
DB=postgresql bin/rspec \
39+
--profile 10 \
40+
--format RspecJunitFormatter \
41+
--out test_results/rspec.xml \
42+
--format progress \
43+
$(circleci tests glob "spec/**/*_spec.rb")
44+
- store_test_results:
45+
path: test_results
46+
47+
triggers:
48+
- schedule:
49+
cron: "0 8 * * 0"
50+
filters:
51+
branches:
52+
only:
53+
- master

active_storage_db.gemspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ Gem::Specification.new do |spec|
3636
spec.add_development_dependency 'mysql2', '~> 0.5.3'
3737
spec.add_development_dependency 'pg', '~> 1.2.3'
3838
spec.add_development_dependency 'pry', '~> 0.13.1'
39+
spec.add_development_dependency 'rspec_junit_formatter', '~> 0.4.1'
3940
spec.add_development_dependency 'rspec-rails', '~> 4.0.1'
4041
spec.add_development_dependency 'rubocop', '~> 0.89.0'
4142
spec.add_development_dependency 'selenium-webdriver', '~> 3.142.7'

bin/rake

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
3+
4+
#
5+
# This file was generated by Bundler.
6+
#
7+
# The application 'rake' is installed as part of a gem, and
8+
# this file is here to facilitate running it.
9+
#
10+
11+
require "pathname"
12+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13+
Pathname.new(__FILE__).realpath)
14+
15+
bundle_binstub = File.expand_path("../bundle", __FILE__)
16+
17+
if File.file?(bundle_binstub)
18+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19+
load(bundle_binstub)
20+
else
21+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23+
end
24+
end
25+
26+
require "rubygems"
27+
require "bundler/setup"
28+
29+
load Gem.bin_path("rake", "rake")

bin/rspec

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
3+
4+
#
5+
# This file was generated by Bundler.
6+
#
7+
# The application 'rspec' is installed as part of a gem, and
8+
# this file is here to facilitate running it.
9+
#
10+
11+
require "pathname"
12+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13+
Pathname.new(__FILE__).realpath)
14+
15+
bundle_binstub = File.expand_path("../bundle", __FILE__)
16+
17+
if File.file?(bundle_binstub)
18+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19+
load(bundle_binstub)
20+
else
21+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23+
end
24+
end
25+
26+
require "rubygems"
27+
require "bundler/setup"
28+
29+
load Gem.bin_path("rspec-core", "rspec")

bin/rubocop

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/usr/bin/env ruby
2+
# frozen_string_literal: true
3+
4+
#
5+
# This file was generated by Bundler.
6+
#
7+
# The application 'rubocop' is installed as part of a gem, and
8+
# this file is here to facilitate running it.
9+
#
10+
11+
require "pathname"
12+
ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile",
13+
Pathname.new(__FILE__).realpath)
14+
15+
bundle_binstub = File.expand_path("../bundle", __FILE__)
16+
17+
if File.file?(bundle_binstub)
18+
if File.read(bundle_binstub, 300) =~ /This file was generated by Bundler/
19+
load(bundle_binstub)
20+
else
21+
abort("Your `bin/bundle` was not generated by Bundler, so this binstub cannot run.
22+
Replace `bin/bundle` by running `bundle binstubs bundler --force`, then run this command again.")
23+
end
24+
end
25+
26+
require "rubygems"
27+
require "bundler/setup"
28+
29+
load Gem.bin_path("rubocop", "rubocop")

0 commit comments

Comments
 (0)