potassium 6.2.0 → 6.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 11bd2c43f5af6d71fc6b3b148ba69cd8189d4b22a144c0b9f83f1b051115e214
4
- data.tar.gz: dd6d6bd437bb406738f9f76e0e7b5742a305d1948001eaa1c79056bc8b30b91a
3
+ metadata.gz: f6e930d3ad3b2989b3fd4e3675da60f6dec57089d0eba9eabe4d1bccbcae68de
4
+ data.tar.gz: 50ca1761257ba7f22d0724a3f1996a703d39dfefab842d4198cc99f7392741d0
5
5
  SHA512:
6
- metadata.gz: 436ed38de1d2189cab51d2f2be5f59190ff2a1a6729554ce28374b373ee440ffac606dddb368bcff5dfc31dfb29d5c467465ec2676cbe13d2d08928f5629ef35
7
- data.tar.gz: 17eb691dcad577143b4218d78da12bbe5f66256a0213d5d1f70d05b5ef53343e83e0ac87e511df05197b7e90668eddb0fc2feea260a77b01590e6d2b36715a9c
6
+ metadata.gz: 7044e4cfce08ab3cca65a7dbc30ec8be951ab478f368067955a8435bac40fe4c769f0a8b2b38828ab93614c0eeac8fe67d68c1f59ae3d8317b424c848e639c33
7
+ data.tar.gz: c699ee1eedb6b15512acbbdb6b53bab2e98b65e7aab413d398d47042e58e1c16ee8b786394674d6b07ba93f248a51f4da7bf366eaf184d0a13e4527d99647fe5
data/.circleci/config.yml CHANGED
@@ -76,9 +76,32 @@ jobs:
76
76
  cat tmp/files_to_lint | grep -E '.+\.(rb)$' | xargs bundle exec rubocop --force-exclusion \
77
77
  | ./bin/reviewdog -reporter=github-pr-review -f=rubocop
78
78
 
79
+ deploy:
80
+ executor: ruby-executor
81
+ steps:
82
+ - setup
83
+
84
+ - run:
85
+ name: Setup rubygems
86
+ command: bash .circleci/setup-rubygems.sh
87
+
88
+ - run:
89
+ name: Publish to rubygems
90
+ command: |
91
+ gem build potassium.gemspec
92
+ version_tag=$(git describe --tags)
93
+ gem push potassium-${version_tag#v}.gem
94
+
79
95
  workflows:
80
96
  test_and_lint:
81
97
  jobs:
82
98
  - test
83
99
  - lint:
84
100
  context: org-global
101
+ - deploy:
102
+ context: org-global
103
+ filters:
104
+ tags:
105
+ only: /.*/
106
+ branches:
107
+ ignore: /.*/
@@ -0,0 +1,3 @@
1
+ mkdir ~/.gem
2
+ echo -e "---\r\n:rubygems_api_key: $RUBYGEMS_API_KEY" > ~/.gem/credentials
3
+ chmod 0600 /home/circleci/.gem/credentials
data/CHANGELOG.md CHANGED
@@ -2,6 +2,18 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 6.3.0
6
+
7
+ Features:
8
+ - Add `monitoring` recipe with scout gem [#353](https://github.com/platanus/potassium/pull/353)
9
+ - Change CircleCI config to use cache in tests, and remove old cibuild flow [#366](https://github.com/platanus/potassium/pull/366)
10
+
11
+ Fixes:
12
+ - Explicitly install project specified node version in CircleCI build [#352](https://github.com/platanus/potassium/pull/352)
13
+ - Fixes `tailwindCSS@^2` incompatibility with `postcss@^7` [#356](https://github.com/platanus/potassium/pull/356)
14
+ - Update marcel gem (shrine's mime type analyzer) to avoid mimemagic dependency [#357](https://github.com/platanus/potassium/pull/357)
15
+ - Explicitly set the frontend test environment to `jsdom` [#367](https://github.com/platanus/potassium/pull/367)
16
+
5
17
  ## 6.2.0
6
18
 
7
19
  Features:
data/README.md CHANGED
@@ -52,6 +52,7 @@ Potassium Rails apps includes the following gems and technologies:
52
52
  taking too long
53
53
  - [Tzinfo-Data](https://github.com/tzinfo/tzinfo-data) for updating timezone information
54
54
  - [Faker](https://github.com/stympy/faker) for creating development data
55
+ - [Scout](https://github.com/scoutapp/scout_apm_ruby) for monitoring performance
55
56
 
56
57
  The following optional integrations are also added:
57
58
 
@@ -154,6 +155,15 @@ It's important to remember that `bin/potassium_test create`:
154
155
  - Can receive the same options as `potassium create`
155
156
  - Runs with options with a default value. This is to avoid the "asking part" of the creation process. You need to enable what you want to test like this: `$ bin/potassium_test create --clockwork`
156
157
 
158
+ ## Publishing
159
+ On master branch.
160
+
161
+ 1. Change `VERSION` in `lib/potassium/version.rb`
162
+ 2. Change `Unreleased` title to current version in `CHANGELOG.md`
163
+ 3. Commit new release. For example: `Releasing v6.3.0`
164
+ 4. Create tag. For example: `git tag v6.3.0`
165
+ 5. Push tag: `git push origin v6.3.0`
166
+
157
167
  ## Contributing
158
168
 
159
169
  If you want to add functionality please go to
@@ -1,34 +1,37 @@
1
- version: 2
2
- jobs:
3
- test:
4
- working_directory: ~/app
5
-
1
+ version: 2.1
2
+
3
+ ruby-image: &ruby-image circleci/ruby:<%= ruby_version %>
4
+ <%- if selected?(:database, :postgresql) -%>
5
+ postgres-image: &postgres-image postgres:<%= Potassium::POSTGRES_VERSION %>
6
+ <%- end -%>
7
+ <%- if selected?(:background_processor) -%>
8
+ redis-image: &redis-image redis
9
+ <%- end -%>
10
+ env-vars: &env-vars
11
+ BUNDLE_JOBS: 4
12
+ BUNDLE_PATH: vendor/bundle
13
+ RAILS_ENV: test
14
+
15
+ executors:
16
+ test-executor:
6
17
  docker:
7
- - image: platanus/compose:1.22.0
8
-
9
- steps:
10
- - checkout
11
- - setup_remote_docker
12
-
13
- - run: docker info
14
- - run: docker-compose -f docker-compose.ci.yml pull
15
- - run: docker-compose -f docker-compose.ci.yml build test
16
- - run: bin/cibuild services
17
- - run: bin/cibuild deps
18
-
19
- - run: bin/cibuild db
20
- - run: bin/cibuild tests
21
- <% if selected?(:front_end, :vue) %>
22
- - run: bin/cibuild js_tests
23
- <% end %>
24
-
25
- lint:
18
+ - image: *ruby-image
19
+ environment: *env-vars
20
+ <%- if selected?(:database, :postgresql) -%>
21
+ - image: *postgres-image
22
+ <%- end -%>
23
+ <%- if selected?(:background_processor) -%>
24
+ - image: *redis-image
25
+ <%- end -%>
26
+
27
+ lint-executor:
26
28
  docker:
27
- - image: circleci/ruby:2.7-node
28
- environment:
29
- BUNDLE_JOBS: 4
30
- BUNDLE_RETRY: 3
31
- BUNDLE_PATH: vendor/bundle
29
+ - image: *ruby-image
30
+ environment: *env-vars
31
+
32
+ commands:
33
+ setup:
34
+ description: checkout code, restore cache, install dependencies, save cache
32
35
  steps:
33
36
  - checkout
34
37
 
@@ -49,20 +52,67 @@ jobs:
49
52
  gem install bundler:$BUNDLER_VERSION
50
53
  bundle _$(echo $BUNDLER_VERSION)_ install
51
54
 
55
+ - run:
56
+ name: Install yarn dependencies
57
+ command: |
58
+ curl -sL https://deb.nodesource.com/setup_$(cat .node-version).x | sudo -E bash -
59
+ sudo apt-get install -y nodejs
60
+ curl -o- -sL https://yarnpkg.com/install.sh | bash
61
+ sudo ln -s $HOME/.yarn/bin/yarn /usr/local/bin/yarn
62
+ yarn install --frozen-lockfile
63
+
52
64
  - save_cache:
53
65
  key: bundle-dependencies-{{ checksum "Gemfile.lock" }}
54
66
  paths:
55
67
  - vendor/bundle
56
68
 
57
- - run:
58
- name: Install yarn dependencies
59
- command: yarn install --frozen-lockfile
60
-
61
69
  - save_cache:
62
70
  key: yarn-dependencies-{{ checksum "yarn.lock" }}
63
71
  paths:
64
72
  - node_modules
65
73
 
74
+ jobs:
75
+ test:
76
+ executor: test-executor
77
+ steps:
78
+ - setup
79
+
80
+ <%- if selected?(:background_processor) -%>
81
+ - run:
82
+ name: Wait for redis service
83
+ command: dockerize -wait tcp://localhost:6379 -timeout 1m
84
+ <%- end -%>
85
+ <%- if selected?(:database, :postgresql) -%>
86
+ - run:
87
+ name: Wait for postgres service
88
+ command: dockerize -wait tcp://localhost:5432 -timeout 1m
89
+
90
+ - run:
91
+ name: Setup database
92
+ command: bundle exec rails db:create db:schema:load
93
+ <%- end -%>
94
+
95
+ - run:
96
+ name: Run rspec
97
+ command: |
98
+ RSPEC_JUNIT_ARGS="-r rspec_junit_formatter -f RspecJunitFormatter -o test_results/rspec.xml"
99
+ RSPEC_FORMAT_ARGS="-f progress --no-color -p 10"
100
+ bundle exec rspec spec $RSPEC_FORMAT_ARGS $RSPEC_JUNIT_ARGS
101
+
102
+ <%- if selected?(:front_end, :vue) -%>
103
+ - run:
104
+ name: Run jest
105
+ command: yarn run test
106
+ <%- end -%>
107
+
108
+ - store_test_results:
109
+ path: test_results
110
+
111
+ lint:
112
+ executor: lint-executor
113
+ steps:
114
+ - setup
115
+
66
116
  - run:
67
117
  name: Install reviewdog
68
118
  command: |
@@ -94,7 +144,6 @@ jobs:
94
144
  | ./bin/reviewdog -reporter=github-pr-review -f=stylelint
95
145
 
96
146
  workflows:
97
- version: 2
98
147
  test_and_lint:
99
148
  jobs:
100
149
  - test
@@ -42,10 +42,7 @@ readme:
42
42
  The project is setup to run tests
43
43
  in [CircleCI](https://circleci.com/gh/platanus/<%= get(:dasherized_app_name) %>/tree/master)
44
44
 
45
- You can also run the test locally simulating the production environment using docker.
46
- Just make sure you have docker installed and run:
47
-
48
- bin/cibuild
45
+ You can also run the test locally simulating the production environment using [CircleCI's method](https://circleci.com/docs/2.0/local-cli/).
49
46
  deployment:
50
47
  title: "Deployment"
51
48
  body: |
@@ -7,6 +7,10 @@ module TemplateHelpers
7
7
  "#{Potassium::NODE_VERSION}.x"
8
8
  end
9
9
 
10
+ def ruby_version
11
+ Semantic::Version.new(Potassium::RUBY_VERSION).instance_eval { "#{major}.#{minor}" }
12
+ end
13
+
10
14
  def load_recipe(recipe_name)
11
15
  @recipes ||= {}
12
16
  @recipes[recipe_name] ||= get_recipe_class(recipe_name.to_sym).new(self)
@@ -1,50 +1,20 @@
1
1
  class Recipes::Ci < Rails::AppBuilder
2
2
  def create
3
- copy_file '../assets/Dockerfile.ci', 'Dockerfile.ci'
4
3
  template '../assets/.circleci/config.yml.erb', '.circleci/config.yml'
5
4
 
6
- template '../assets/bin/cibuild.erb', 'bin/cibuild'
7
- run "chmod a+x bin/cibuild"
8
-
9
- copy_file '../assets/docker-compose.ci.yml', 'docker-compose.ci.yml'
10
-
11
5
  gather_gems(:test) do
12
- gather_gem 'rspec_junit_formatter', '0.2.2'
13
- end
14
-
15
- compose = DockerHelpers.new('docker-compose.ci.yml')
16
-
17
- if selected?(:database, :mysql)
18
- srv =
19
- <<~YAML
20
- image: mysql:#{Potassium::MYSQL_VERSION}
21
- environment:
22
- MYSQL_ALLOW_EMPTY_PASSWORD: 'true'
23
- YAML
24
- compose.add_service("mysql", srv)
25
- compose.add_link('test', 'mysql')
26
- compose.add_env('test', 'MYSQL_HOST', 'mysql')
27
- compose.add_env('test', 'MYSQL_PORT', '3306')
28
-
29
- elsif selected?(:database, :postgresql)
30
- srv =
31
- <<~YAML
32
- image: "postgres:#{Potassium::POSTGRES_VERSION}"
33
- environment:
34
- POSTGRES_USER: postgres
35
- POSTGRES_PASSWORD: ''
36
- YAML
37
- compose.add_service("postgresql", srv)
38
- compose.add_link('test', 'postgresql')
39
- compose.add_env('test', 'DB_USER', 'postgres')
40
- compose.add_env('test', 'DB_HOST', 'postgresql')
41
- compose.add_env('test', 'DB_PORT', '5432')
6
+ gather_gem 'rspec_junit_formatter', '~> 0.4'
42
7
  end
43
8
 
44
- compose.add_volume('test_data')
45
-
46
9
  add_readme_header :ci
47
-
48
10
  application 'config.assets.js_compressor = :uglifier', env: 'test'
49
11
  end
12
+
13
+ def install
14
+ create
15
+ end
16
+
17
+ def installed?
18
+ file_exist?('.circleci/config.yml')
19
+ end
50
20
  end
@@ -39,7 +39,7 @@ class Recipes::FileStorage < Rails::AppBuilder
39
39
 
40
40
  def add_shrine
41
41
  gather_gem('shrine', '~> 3.0')
42
- gather_gem('marcel', '~> 0.3.3')
42
+ gather_gem('marcel', '~> 1.0')
43
43
  copy_file('../assets/config/shrine.rb', 'config/initializers/shrine.rb', force: true)
44
44
  copy_file('../assets/app/uploaders/image_uploader.rb', 'app/uploaders/image_uploader.rb')
45
45
  copy_file('../assets/app/uploaders/base_uploader.rb', 'app/uploaders/base_uploader.rb')
@@ -69,7 +69,8 @@ class Recipes::FrontEnd < Rails::AppBuilder
69
69
  end
70
70
 
71
71
  def setup_tailwind
72
- run 'bin/yarn add tailwindcss'
72
+ run "bin/yarn add tailwindcss@#{Potassium::TAILWINDCSS}"
73
+ specify_autoprefixer_postcss_compatibility_versions
73
74
  setup_client_css
74
75
  remove_server_css_requires
75
76
  setup_tailwind_requirements
@@ -147,6 +148,10 @@ class Recipes::FrontEnd < Rails::AppBuilder
147
148
  JS
148
149
  end
149
150
 
151
+ def specify_autoprefixer_postcss_compatibility_versions
152
+ run 'bin/yarn -D add postcss@^7 autoprefixer@^9'
153
+ end
154
+
150
155
  def setup_client_css
151
156
  application_css = 'app/javascript/css/application.css'
152
157
  create_file application_css, "", force: true
@@ -264,7 +269,8 @@ class Recipes::FrontEnd < Rails::AppBuilder
264
269
  },
265
270
  "snapshotSerializers": [
266
271
  "<rootDir>/node_modules/jest-serializer-vue"
267
- ]
272
+ ],
273
+ "testEnvironment": "jsdom"
268
274
  }
269
275
  }
270
276
  end
@@ -0,0 +1,5 @@
1
+ class Recipes::Monitoring < Rails::AppBuilder
2
+ def create
3
+ gather_gem('scout_apm')
4
+ end
5
+ end
@@ -59,6 +59,7 @@ run_action(:recipe_loading) do
59
59
  create :i18n
60
60
  create :pry
61
61
  create :better_errors
62
+ create :monitoring
62
63
  create :devise
63
64
  create :admin
64
65
  create :vue_admin
@@ -1,5 +1,5 @@
1
1
  module Potassium
2
- VERSION = "6.2.0"
2
+ VERSION = "6.3.0"
3
3
  RUBY_VERSION = "2.7.0"
4
4
  RAILS_VERSION = "~> 6.0.2"
5
5
  RUBOCOP_VERSION = "~> 1.9"
@@ -7,4 +7,5 @@ module Potassium
7
7
  POSTGRES_VERSION = "11.3"
8
8
  MYSQL_VERSION = "5.7"
9
9
  NODE_VERSION = "12"
10
+ TAILWINDCSS = "npm:@tailwindcss/postcss7-compat"
10
11
  end
@@ -1,14 +1,17 @@
1
1
  require "spec_helper"
2
2
  require "rubocop"
3
3
 
4
- RSpec.describe "A new project" do
4
+ RSpec.describe 'CI' do
5
5
  before(:all) do
6
6
  drop_dummy_database
7
7
  remove_project_directory
8
- create_dummy_project("heroku" => true)
8
+ create_dummy_project
9
9
  end
10
10
 
11
- it "correctly runs continous integration" do
12
- expect { on_project { `bin/cibuild` } }.to_not output.to_stderr
11
+ it "correctly bundles the config file" do
12
+ yml_path = "#{project_path}/.circleci/config.yml"
13
+ content = IO.read(yml_path)
14
+ expect(File.exist?(yml_path)).to be true
15
+ expect(content).to include('circleci/ruby', 'cache', 'rspec', 'reviewdog')
13
16
  end
14
17
  end
@@ -22,6 +22,12 @@ RSpec.describe "Front end" do
22
22
  expect(File).not_to exist(application_css_path)
23
23
  end
24
24
 
25
+ def expect_to_have_tailwind_compatibility_build
26
+ expect(node_modules_file).to include("\"tailwindcss\": \"npm:@tailwindcss/postcss7-compat\"")
27
+ expect(node_modules_file).to include("\"autoprefixer\": \"^9\"")
28
+ expect(node_modules_file).to include("\"postcss\": \"^7\"")
29
+ end
30
+
25
31
  context "with vue" do
26
32
  before(:all) do
27
33
  remove_project_directory
@@ -55,6 +61,10 @@ RSpec.describe "Front end" do
55
61
  expect(tailwind_config_file).to include('module.exports')
56
62
  end
57
63
 
64
+ it 'includes correct packages for tailwind, postcss and autoprefixer compatibility build' do
65
+ expect_to_have_tailwind_compatibility_build
66
+ end
67
+
58
68
  context "with graphql" do
59
69
  before(:all) do
60
70
  remove_project_directory
@@ -84,5 +94,9 @@ RSpec.describe "Front end" do
84
94
  it "creates application_js_file for tailwind without vue" do
85
95
  expect(application_js_file).to include("import '../css/application.css';")
86
96
  end
97
+
98
+ it 'includes correct packages for tailwind, postcss and autoprefixer compatibility build' do
99
+ expect_to_have_tailwind_compatibility_build
100
+ end
87
101
  end
88
102
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: potassium
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.2.0
4
+ version: 6.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - juliogarciag
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-15 00:00:00.000000000 Z
11
+ date: 2021-06-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -244,6 +244,7 @@ extensions: []
244
244
  extra_rdoc_files: []
245
245
  files:
246
246
  - ".circleci/config.yml"
247
+ - ".circleci/setup-rubygems.sh"
247
248
  - ".editorconfig"
248
249
  - ".gitignore"
249
250
  - ".node-version"
@@ -270,7 +271,6 @@ files:
270
271
  - lib/potassium/assets/.pryrc
271
272
  - lib/potassium/assets/.rubocop.yml
272
273
  - lib/potassium/assets/.stylelintrc.json
273
- - lib/potassium/assets/Dockerfile.ci
274
274
  - lib/potassium/assets/Makefile.erb
275
275
  - lib/potassium/assets/Procfile
276
276
  - lib/potassium/assets/README.md.erb
@@ -300,7 +300,6 @@ files:
300
300
  - lib/potassium/assets/app/uploaders/image_uploader.rb
301
301
  - lib/potassium/assets/app/views/shared/_gtm_body.html.erb
302
302
  - lib/potassium/assets/app/views/shared/_gtm_head.html.erb
303
- - lib/potassium/assets/bin/cibuild.erb
304
303
  - lib/potassium/assets/bin/release
305
304
  - lib/potassium/assets/bin/setup.erb
306
305
  - lib/potassium/assets/bin/setup_heroku.erb
@@ -314,7 +313,6 @@ files:
314
313
  - lib/potassium/assets/config/sentry.rb.erb
315
314
  - lib/potassium/assets/config/shrine.rb
316
315
  - lib/potassium/assets/config/storage.yml
317
- - lib/potassium/assets/docker-compose.ci.yml
318
316
  - lib/potassium/assets/docker-compose.yml
319
317
  - lib/potassium/assets/es-CL.yml
320
318
  - lib/potassium/assets/lib/tasks/auto_annotate_models.rake
@@ -372,6 +370,7 @@ files:
372
370
  - lib/potassium/recipes/i18n.rb
373
371
  - lib/potassium/recipes/listen.rb
374
372
  - lib/potassium/recipes/mailer.rb
373
+ - lib/potassium/recipes/monitoring.rb
375
374
  - lib/potassium/recipes/node.rb
376
375
  - lib/potassium/recipes/power_types.rb
377
376
  - lib/potassium/recipes/pry.rb
@@ -430,7 +429,7 @@ homepage: https://github.com/platanus/potassium
430
429
  licenses:
431
430
  - MIT
432
431
  metadata: {}
433
- post_install_message:
432
+ post_install_message:
434
433
  rdoc_options: []
435
434
  require_paths:
436
435
  - lib
@@ -446,7 +445,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
446
445
  version: '0'
447
446
  requirements: []
448
447
  rubygems_version: 3.1.2
449
- signing_key:
448
+ signing_key:
450
449
  specification_version: 4
451
450
  summary: An application generator from Platanus
452
451
  test_files:
@@ -1,6 +0,0 @@
1
- FROM platanus/ruby:2.7
2
-
3
- RUN mkdir /app
4
- WORKDIR /app
5
-
6
- ADD . /app
@@ -1,117 +0,0 @@
1
- #!/usr/bin/env bash
2
- trap "exit" SIGINT SIGTERM
3
-
4
- command -v docker >/dev/null 2>&1 && docker info >/dev/null || {
5
- printf >&2 "\e[31mI require docker but it's not installed. Aborting.\e[0m\n"; exit 1;
6
- }
7
-
8
- DOCKER_COMPOSE_ARGS="-f docker-compose.ci.yml"
9
-
10
- # Build Image
11
- build(){
12
- docker-compose $DOCKER_COMPOSE_ARGS build test
13
- }
14
-
15
- # Wait services to be ready
16
- wait_services(){
17
- function test_service {
18
- docker-compose $DOCKER_COMPOSE_ARGS run --rm test sh -c "nc -z $1 $2"
19
- }
20
-
21
- count=0
22
- # Chain tests together by using &&
23
- until (
24
- <% if(selected?(:database, :mysql) || selected?(:database, :postgresql))-%>
25
- test_service '$DB_HOST' '$DB_PORT' && \
26
- <% end-%>
27
- echo "Services ready"
28
- )
29
- do
30
- ((count++))
31
- if [ $count -gt 50 ]
32
- then
33
- echo "Services didn't become ready in time"
34
- exit 1
35
- else
36
- echo "Waiting for services to become ready..."
37
- fi
38
- sleep 0.5
39
- done
40
- }
41
-
42
- # Prepare dependencies
43
- dependencies(){
44
- docker-compose $DOCKER_COMPOSE_ARGS run --rm test bundle install
45
- }
46
-
47
- <% if selected?(:front_end, :vue) %>
48
- yarn_dependencies(){
49
- docker-compose $DOCKER_COMPOSE_ARGS run --rm test yarn install
50
- }
51
- <% end %>
52
-
53
- assets() {
54
- docker-compose $DOCKER_COMPOSE_ARGS run --rm test /bin/bash -c "bin/setup && bundle exec rake assets:precompile"
55
- }
56
-
57
- # Prepare database
58
- database(){
59
- docker-compose $DOCKER_COMPOSE_ARGS run --rm test bundle exec rake db:create db:schema:load
60
- }
61
-
62
- # Run the specs
63
- tests(){
64
- [ -n "$CI" ] && {
65
- RSPEC_JUNIT_ARGS="-r rspec_junit_formatter --format RspecJunitFormatter -o $HOME/.rspec_reports/junit.xml"
66
- RSPEC_FORMAT_ARGS="--format progress --no-color"
67
- }
68
- docker-compose $DOCKER_COMPOSE_ARGS run --rm test bundle exec rspec spec $RSPEC_FORMAT_ARGS $RSPEC_JUNIT_ARGS
69
- }
70
-
71
- <% if selected?(:front_end, :vue) %>
72
- js_tests(){
73
- docker-compose $DOCKER_COMPOSE_ARGS run --rm test yarn run test
74
- }
75
- <% end %>
76
-
77
- # Run the complete ci build
78
- no_ci(){
79
- build
80
- wait_services
81
- dependencies
82
- assets
83
- database
84
- tests
85
- }
86
-
87
- case "$1" in
88
- "")
89
- no_ci
90
- ;;
91
- "services")
92
- wait_services
93
- ;;
94
- "deps"|"dependencies")
95
- dependencies <% if selected?(:front_end, :vue) %>&& yarn_dependencies<% end %>
96
- ;;
97
- "assets")
98
- assets
99
- ;;
100
- "db"|"database")
101
- database
102
- ;;
103
- <% if selected?(:front_end, :vue) %>
104
- "js_tests")
105
- js_tests
106
- ;;
107
- <% end %>
108
- "specs"|"tests")
109
- tests
110
- ;;
111
- "build")
112
- build
113
- ;;
114
- *)
115
- echo "Usage: cibuild [services|deps|assets|db|specs|build]"
116
- ;;
117
- esac
@@ -1,12 +0,0 @@
1
- version: '3.4'
2
-
3
- services:
4
- test:
5
- build:
6
- context: "."
7
- dockerfile: Dockerfile.ci
8
- volumes:
9
- - "test_data:/usr/local/bundle"
10
- - "./node_modules:/app/node_modules"
11
- environment:
12
- RACK_ENV: test