Skip to content

Instantly share code, notes, and snippets.

@davesque
Last active April 26, 2018 22:02
Show Gist options
  • Save davesque/75a872032585e79b9281ed6769381314 to your computer and use it in GitHub Desktop.
Save davesque/75a872032585e79b9281ed6769381314 to your computer and use it in GitHub Desktop.
Circle CI migration steps

Migration to Circle CI

  • Update .circleci/config.yaml:
 common: &common
   working_directory: ~/repo
   steps:
     - checkout
+    - run:
+        name: merge pull request base
+        command: |
+          if [[ -n "${CIRCLE_PR_NUMBER}" ]]; then
+            PR_INFO_URL=https://api.github.com/repos/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME/pulls/$CIRCLE_PR_NUMBER
+
+            PR_BASE_BRANCH=$(curl -L "$PR_INFO_URL" | python -c 'import json, sys; obj = json.load(sys.stdin); sys.stdout.write(obj["base"]["ref"])')
+            git fetch origin +"$PR_BASE_BRANCH":circleci/pr-base
+
+            # We need these config values or git complains when creating the
+            # merge commit
+            git config --global user.name "Circle CI"
+            git config --global user.email "[email protected]"
+
+            git merge --no-edit circleci/pr-base
+          fi
     - restore_cache:
         keys:
           - cache-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }}-{{ checksum "tox.ini" }}
     - run:
         name: install dependencies
         command: pip install --user tox
     - run:
         name: run tox
         command: ~/.local/bin/tox
     - save_cache:
         paths:
           - .tox
           - ~/.cache/pip
           - ~/.local
           - ./eggs
         key: cache-{{ .Environment.CIRCLE_JOB }}-{{ checksum "setup.py" }}-{{ checksum "tox.ini" }}
  • Update badge in README:
[![Build Status](https://circleci.com/gh/ethereum/<repo name>.svg?style=shield)](https://circleci.com/gh/ethereum/<repo name>)
  • Disable Travis CI:
    • Remove .travis.yml from project repo:
      git rm .travis.yml
      ...
      
    • On travis-ci.org, click on project link to open project:
    • Select "Settings" from options menu:
    • Activate "Build only if .travis.yml is present" option (might also need to deactivate "Build pushed pull requests" option):
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment