From 3bf6da1ffcf8208a0608de7bff6e2155c40e2871 Mon Sep 17 00:00:00 2001 From: Yamagishi Kazutoshi Date: Mon, 23 Apr 2018 16:16:26 +0900 Subject: Move precompile step to build stage (#7235) --- .circleci/config.yml | 55 ++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 40 insertions(+), 15 deletions(-) (limited to '.circleci') diff --git a/.circleci/config.yml b/.circleci/config.yml index c5d6ec9d1..fbaf60aad 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -23,6 +23,13 @@ aliases: paths: - ./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 steps: - checkout @@ -54,26 +61,14 @@ aliases: - *install_system_dependencies - run: ruby -e 'puts RUBY_VERSION' | tee /tmp/.ruby-version - - restore_cache: - keys: - - v1-ruby-dependencies-{{ checksum "/tmp/.ruby-version" }}-{{ checksum "Gemfile.lock" }} - - v1-ruby-dependencies-{{ checksum "/tmp/.ruby-version" }}- - - v1-ruby-dependencies-- + - *restore_ruby_dependencies - run: bundle install --clean --jobs 16 --path ./vendor/bundle/ --retry 3 --with pam_authentication --without development production - 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: + - ./.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 steps: - *attach_workspace @@ -81,6 +76,15 @@ aliases: - *install_system_dependencies - 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: name: Prepare Tests command: ./bin/rails parallel:create parallel:load_schema parallel:prepare @@ -104,6 +108,20 @@ jobs: environment: *ruby_environment <<: *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: <<: *defaults docker: @@ -138,6 +156,8 @@ jobs: <<: *defaults steps: - *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 unused @@ -150,14 +170,19 @@ workflows: requires: - install - install-ruby2.4: + requires: + - install + - build: requires: - install-ruby2.5 - test-ruby2.5: requires: - install-ruby2.5 + - build - test-ruby2.4: requires: - install-ruby2.4 + - build - test-webui: requires: - install -- cgit