This document describes how to configure your project to run on CircleCI 2.0.
- If this will be your very first CircleCI project, complete the steps in the Sign Up & Try CircleCI document.
Create a directory called
.circleciin the root directory of your local GitHub or Bitbucket code repository.
- Create a
config.ymlfile in the
.circlecidirectory with the following lines, replacing
<language>:<version TAG>with your programming language and version number. See the CircleCI Images doc for a complete list of languages and versions.
version: 2 jobs: build: docker: - image: circleci/<language>:<version TAG> steps: - checkout - run: echo "hello world"
The first image listed defines the execution environment for your build. The primary container, where your 2.0 build commands run, is created from this image. The steps check out the code in the project directory and run the
Commit and push the changes. If you were already using CircleCI 1.0, a build is triggered on 2.0, and a 2.0 icon appears on the Builds page.
- If this is your first project on CircleCI, go to the Projects page, click the Add Projects button and then click the Build Project button next to your project.
CircleCI checks out your code, prints “Hello World”, and posts a green build to the Builds page adding a green checkmark on your commit in GitHub or Bitbucket! If the job fails, you are notified in email of the failure with a log of the failing command, exit code, and output with a red X on the commit in GitHub or Bitbucket.
You automatically follow any new project that you push to, subscribing you to email notifications and adding the project to your dashboard. You can also manually follow or stop following a project by selecting your org on the Projects page in the CircleCI app, clicking the Add Projects button, and then clicking the button next to the project you want to follow or stop following.
Validate Every Configuration Change
To catch CircleCI config errors as you build your full
config.yml file, it is possible create a git pre-commit hook to validate
~/circleci/config.yml that, when pushing to git, will run the
circleci config validate command that is available to every build.