version: 2.1 orbs: ruby: circleci/ruby@0.1.2 executors: ruby: parameters: tag: type: string default: "latest" docker: - image: ruby:<< parameters.tag >> environment: BUNDLE_PATH: vendor/bundle BUNDLE_JOBS: 4 working_directory: ~/app commands: &commands bundle_install: parameters: ruby-version: type: string steps: - checkout - restore_cache: keys: - gem-cache-v1-<< parameters.ruby-version >>-{{ arch }}-{{ .Branch }}-{{ checksum "Gemfile.lock" }} - gem-cache-v1-<< parameters.ruby-version >>-{{ arch }}-{{ .Branch }} - gem-cache-v1 - run: gem i bundler && bundle install --path vendor/bundle --jobs 100 && bundle clean - save_cache: key: gem-cache-v1-<< parameters.ruby-version >>-{{ arch }}-{{ .Branch }}-{{ checksum "Gemfile.lock" }} paths: - vendor/bundle jobs: syntax_check: parameters: ruby-version: type: string executor: name: ruby tag: << parameters.ruby-version >> steps: - checkout - run: ruby -cw project_template/app.rb - run: ruby -cw project_template/web.rb - run: ruby -ryaml -e 'puts YAML.load_file("./project_template/setting.yml")["setting"]' > /tmp/content_of_setting.rb && ruby -cw /tmp/content_of_setting.rb bundle_install: parameters: ruby-version: type: string executor: name: ruby tag: << parameters.ruby-version >> steps: - bundle_install: ruby-version: << parameters.ruby-version >> lint: parameters: ruby-version: type: string executor: name: ruby tag: << parameters.ruby-version >> steps: - bundle_install: ruby-version: << parameters.ruby-version >> - run: bundle exec rubocop -P type_check: parameters: ruby-version: type: string executor: name: ruby tag: << parameters.ruby-version >> steps: - bundle_install: ruby-version: << parameters.ruby-version >> - run: bundle exec steep check rspec: parameters: ruby-version: type: string executor: name: ruby tag: << parameters.ruby-version >> steps: - bundle_install: ruby-version: << parameters.ruby-version >> - run: bundle exec rspec build_jobs: &build_jobs - syntax_check: matrix: parameters: ruby-version: - "2.7" - "3.0.1" - "3.0.2" - "3.1.1" - bundle_install: matrix: parameters: ruby-version: - "2.7" - "3.0.1" - "3.0.2" - "3.1.1" - lint: matrix: parameters: ruby-version: - "2.7" - "3.0.1" - "3.0.2" - "3.1.1" requires: - bundle_install - type_check: matrix: parameters: ruby-version: - "2.7" # - "3.0.1" # たまにSEGVするので - "3.0.2" - "3.1.1" requires: - bundle_install - rspec: matrix: parameters: ruby-version: - "2.7" - "3.0.1" - "3.0.2" - "3.1.1" requires: - bundle_install workflows: version: 2 build: jobs: *build_jobs