# Ruby CircleCI 2.0 configuration file # # Check https://circleci.com/docs/2.0/language-ruby/ for more details # --- version: 2.1 workflows: version: 2 test: jobs: - lint: filters: branches: ignore: - master - production - staging auto_upgrade_tools: triggers: - schedule: cron: "0 10 1 * *" filters: branches: only: - master jobs: - upgrade_tools jobs: test: docker: # specify the version you desire here - image: circleci/ruby:2.6-node-browsers environment: COVERAGE: true BUNDLE_GEMFILE: Gemfile BUNDLE_WITHOUT: "production:staging:development" BUNDLE_JOBS: 3 BUNDLE_RETRY: 3 BUNDLE_PATH: vendor/bundle RAILS_ENV: test RACK_ENV: test PGHOST: 127.0.0.1 PGUSER: ubuntu DATABASE_URL: postgresql:ubuntu@127.0.0.1/db_test # Specify service dependencies here if necessary # CircleCI maintains a library of pre-built images # documented at https://circleci.com/docs/2.0/circleci-images/ - image: circleci/postgres:alpine-ram environment: POSTGRES_USER: ubuntu POSTGRES_DB: db_test steps: - checkout # Download and cache dependencies - restore_cache: name: Restore Bundler Cache keys: - v1-dependencies-{{ checksum "Gemfile.lock" }} - v1-dependencies- - run: name: Install Bundler Dependencies command: bin/bundle check --path vendor/bundle || bin/bundle install --deployment - save_cache: name: Save Bundler Cache paths: - ./vendor/bundle key: v1-dependencies-{{ checksum "Gemfile.lock" }} - run: bin/rails db:schema:load - run: bin/rails test # collect reports - store_test_results: path: ./test/reports/ - store_artifacts: path: ./coverage lint: docker: - image: circleci/ruby:2.6-stretch-node environment: DISABLE_SPRING: 1 BUNDLE_GEMFILE: Gemfile.tools BUNDLE_JOBS: 3 BUNDLE_RETRY: 3 steps: - checkout - restore_cache: keys: - v1-tools-dependencies-{{ checksum "Gemfile.tools.lock" }}-{{ checksum "yarn.lock" }} - v1-tools-dependencies- - run: name: Install cmake for building pronto dependencies command: sudo apt-get install cmake yamllint python3-setuptools python3-pkg-resources - run: name: Install Bundle Dependencies command: bin/bundle check --path vendor/bundle-tools || bin/bundle install --path vendor/bundle-tools - run: name: Install Node Packages command: bin/yarn - save_cache: key: v1-tools-dependencies-{{ checksum "Gemfile.tools.lock" }}-{{ checksum "yarn.lock" }} paths: - ./vendor/bundle-tools - ./node_modules - run: bin/lint-github-pr upgrade_tools: docker: - image: circleci/ruby:2.6-stretch-node environment: DISABLE_SPRING: 1 BUNDLE_GEMFILE: Gemfile.tools BUNDLE_JOBS: 3 BUNDLE_RETRY: 3 steps: - checkout - run: name: Install Bundler command: | echo 'export BUNDLER_VERSION=$(cat Gemfile.tools.lock | tail -1 | tr -d " ")' >> $BASH_ENV source $BASH_ENV gem install bundler:$BUNDLER_VERSION - run: sudo apt-get install cmake - run: name: Run Gemfile tools update in separate branch command: | ./bin/circleci-auto_upgrade_tools