--- version: 2.1 commands: run_with_languages: description: "Run the given command in an environment that includes relevant langauges in the PATH" parameters: command: type: string description: "What command to execute" label: type: string description: "What to label the run" default: <> steps: - run: name: <> command: | export PATH="${HOME}/.pyenv/bin:${PATH}" export PATH="${HOME}/.rbenv/bin:${HOME}/.rbenv/shims:${PATH}" export PATH="${HOME}/project/node_modules/.bin:${PATH}" eval "$(pyenv init --path)" eval "$(pyenv virtualenv-init -)" eval "$(rbenv init -)" export BUNDLE_PATH=vendor/bundle <> environment: # https://app.circleci.com/pipelines/github/apiology/cookiecutter-pypackage/4/workflows/29074dc8-944c-4600-8aaa-5116575fed90/jobs/4 "LC_ALL": "C.UTF-8" "LANG": "C.UTF-8" set_up_environment: description: "Install source environment" steps: - checkout - run: | sed -E -e 's/punchlist \([[:digit:]]+.[[:digit:]]+.[[:digit:]]+\)/punchlist (0.1.0)/g' \ Gemfile.lock > Gemfile.lock.deversioned - restore_cache: key: gems-v2-{{ checksum "Gemfile.lock.deversioned" }} - restore_cache: key: wheels-v1-3.12.1-{{ checksum "requirements_dev.txt" }} - run: name: Initialize packages command: | export BUNDLE_PATH=vendor/bundle './fix.sh' - run: name: Verify Gemfile.lock command: | if ! git diff --exit-code Gemfile.lock then >&2 echo "Please resolve changes to Gemfile.lock after bundle install to avoid caching difficulties" exit 1 fi - save_cache: key: gems-v2-{{ checksum "Gemfile.lock.deversioned" }} paths: - "vendor/bundle" - save_cache: key: wheels-v1-3.12.1-{{ checksum "requirements_dev.txt" }} paths: - "/home/circleci/.cache/pip/wheels" - "/home/circleci/.pyenv/versions/3.12.1/envs/punchlist-3.12.1" - "/home/circleci/.pyenv/versions/punchlist-3.12.1" - run: name: Download new circleci tool command: | curl -fLSs \ https://raw.githubusercontent.com/CircleCI-Public/circleci-cli/master/install.sh | sudo bash overcommit: description: "Run overcommit" steps: - set_up_environment - run_with_languages: label: Run overcommit command: | # Coax overcommit into working git config --global user.email "test@test.test" git config --global user.name "Test Test" bundle exec overcommit --sign bundle exec overcommit --sign pre-commit bundle exec overcommit --run jobs: overcommit: working_directory: ~/punchlist docker: - image: apiology/circleci-ruby:latest steps: - when: condition: equal: [<< pipeline.git.branch >>, "main"] steps: - overcommit - unless: condition: equal: [<< pipeline.git.branch >>, "main"] steps: - run: echo "overcommit only runs on main branch" build: working_directory: ~/punchlist docker: - image: apiology/circleci-ruby:latest steps: - set_up_environment - run_with_languages: label: test command: make citest cicoverage # This seemed to shave 5ish% of the build time off when added resource_class: large workflows: version: 2 weekly: triggers: - schedule: cron: "0 0 * * 6" filters: branches: only: - main jobs: - build - overcommit overcommit: jobs: - overcommit build: jobs: - build