--- 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 -)" 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/checkoff \([[:digit:]]+.[[:digit:]]+.[[:digit:]]+\)/checkoff (0.1.0)/g' \ Gemfile.lock > Gemfile.lock.deversioned - restore_cache: key: gems-v4-{{ checksum "Gemfile.lock.deversioned" }} - 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-v4-{{ checksum "Gemfile.lock.deversioned" }} paths: - "vendor/bundle" - 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: docker: - image: apiology/circleci: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: ~/checkoff docker: - image: apiology/circleci:latest steps: - set_up_environment - run_with_languages: label: Run tests command: | make test # https://github.com/bluelabsio/records-mover/blob/master/Makefile#L25 git status --porcelain coverage/.last_run.json test -z "$(git status --porcelain coverage/.last_run.json)" workflows: version: 2 weekly: triggers: - schedule: cron: "0 0 * * 6" filters: branches: only: - main jobs: - build overcommit: jobs: - overcommit build: jobs: - build