Move precompile step to build stage (#7235)

This commit is contained in:
Yamagishi Kazutoshi 2018-04-23 16:16:26 +09:00 committed by Eugen Rochko
parent 0758b00bfd
commit 3bf6da1ffc

View File

@ -23,6 +23,13 @@ aliases:
paths: paths:
- ./mastodon/ - ./mastodon/
- &restore_ruby_dependencies
restore_cache:
keys:
- v2-ruby-dependencies-{{ checksum "/tmp/.ruby-version" }}-{{ checksum "Gemfile.lock" }}
- v2-ruby-dependencies-{{ checksum "/tmp/.ruby-version" }}-
- v2-ruby-dependencies--
- &install_steps - &install_steps
steps: steps:
- checkout - checkout
@ -54,26 +61,14 @@ aliases:
- *install_system_dependencies - *install_system_dependencies
- run: ruby -e 'puts RUBY_VERSION' | tee /tmp/.ruby-version - run: ruby -e 'puts RUBY_VERSION' | tee /tmp/.ruby-version
- restore_cache: - *restore_ruby_dependencies
keys:
- v1-ruby-dependencies-{{ checksum "/tmp/.ruby-version" }}-{{ checksum "Gemfile.lock" }}
- v1-ruby-dependencies-{{ checksum "/tmp/.ruby-version" }}-
- v1-ruby-dependencies--
- run: bundle install --clean --jobs 16 --path ./vendor/bundle/ --retry 3 --with pam_authentication --without development production - run: bundle install --clean --jobs 16 --path ./vendor/bundle/ --retry 3 --with pam_authentication --without development production
- save_cache: - save_cache:
key: v1-ruby-dependencies-{{ checksum "/tmp/.ruby-version" }}-{{ checksum "Gemfile.lock" }} key: v2-ruby-dependencies-{{ checksum "/tmp/.ruby-version" }}-{{ checksum "Gemfile.lock" }}
paths: paths:
- ./.bundle/
- ./vendor/bundle/ - ./vendor/bundle/
- run:
name: Precompile Assets
command: |
if [ ! -d ./public/assets/ -o ! -d ./public/packs-test/ ]; then
./bin/rails assets:precompile
fi
- *persist_to_workspace
- &test_steps - &test_steps
steps: steps:
- *attach_workspace - *attach_workspace
@ -81,6 +76,15 @@ aliases:
- *install_system_dependencies - *install_system_dependencies
- run: sudo apt-get install -y ffmpeg - run: sudo apt-get install -y ffmpeg
- run: ruby -e 'puts RUBY_VERSION' | tee /tmp/.ruby-version
- *restore_ruby_dependencies
- restore_cache:
keys:
- precompiled-assets-{{ .Branch }}-{{ .Revision }}
- precompiled-assets-{{ .Branch }}-
- precompiled-assets--
- run: - run:
name: Prepare Tests name: Prepare Tests
command: ./bin/rails parallel:create parallel:load_schema parallel:prepare command: ./bin/rails parallel:create parallel:load_schema parallel:prepare
@ -104,6 +108,20 @@ jobs:
environment: *ruby_environment environment: *ruby_environment
<<: *install_ruby_dependencies <<: *install_ruby_dependencies
build:
<<: *defaults
steps:
- *attach_workspace
- *install_system_dependencies
- run: ruby -e 'puts RUBY_VERSION' | tee /tmp/.ruby-version
- *restore_ruby_dependencies
- run: ./bin/rails assets:precompile
- save_cache:
key: precompiled-assets-{{ .Branch }}-{{ .Revision }}
paths:
- ./public/assets
- ./public/packs-test/
test-ruby2.5: test-ruby2.5:
<<: *defaults <<: *defaults
docker: docker:
@ -138,6 +156,8 @@ jobs:
<<: *defaults <<: *defaults
steps: steps:
- *attach_workspace - *attach_workspace
- run: ruby -e 'puts RUBY_VERSION' | tee /tmp/.ruby-version
- *restore_ruby_dependencies
- run: bundle exec i18n-tasks check-normalized - run: bundle exec i18n-tasks check-normalized
- run: bundle exec i18n-tasks unused - run: bundle exec i18n-tasks unused
@ -150,14 +170,19 @@ workflows:
requires: requires:
- install - install
- install-ruby2.4: - install-ruby2.4:
requires:
- install
- build:
requires: requires:
- install-ruby2.5 - install-ruby2.5
- test-ruby2.5: - test-ruby2.5:
requires: requires:
- install-ruby2.5 - install-ruby2.5
- build
- test-ruby2.4: - test-ruby2.4:
requires: requires:
- install-ruby2.4 - install-ruby2.4
- build
- test-webui: - test-webui:
requires: requires:
- install - install