Hello world

Language Icon 1 month ago · 8 min read
Cloud Server v4+
Contribute Go to Code

This page provides configuration examples to get started with a basic pipeline using any execution environment.

Prerequisites

  • A CircleCI account connected to your code. You can sign up for free.

  • A code repository you want to build on CircleCI.

  • Follow the Create a Project guide to connect your repository to CircleCI. You can then use the examples below to configure a basic pipeline using any execution environment.

Using Docker? Authenticating Docker pulls from image registries is recommended when using the Docker execution environment. Authenticated pulls allow access to private Docker images, and may also grant higher rate limits, depending on your registry provider. For further information see Using Docker authenticated pulls.

Echo hello world

These examples adds a job called hello-job that prints hello world to the console.

  • Docker

  • Linux VM

  • macOS

  • Windows

  • GPU

  • Arm VM

The job hello-job spins up a container running a pre-built CircleCI Docker image for Node. Refer to Using the Docker execution environment page for more information.

version: 2.1

jobs:
  hello-job:
    docker:
      - image: cimg/node:17.2.0 # the primary container, where your job's commands are run
    steps:
      - checkout # check out the code in the project directory
      - run: echo "hello world" # run the `echo` command

workflows:
  my-workflow:
    jobs:
      - hello-job

The job hello-job spins up a Linux vir†ual machine running a Ubuntu machine image. Refer to Using the Linux VM execution environment page for more information.

version: 2.1

jobs:
  hello-job:
    machine:
      image: ubuntu-2204:2022.07.1
    steps:
      - checkout # check out the code in the project directory
      - run: echo "hello world" # run the `echo` command

workflows:
  my-workflow:
    jobs:
      - hello-job

The job hello-job spins up a macOS virtual machine running the specified Xcode version. Refer to Using the macOS execution environment page for more information.

version: 2.1

jobs:
  hello-job:
    macos:
      xcode: 15.4.0
    resource_class: m2pro.medium
    steps:
      - checkout # check out the code in the project directory
      - run: echo "hello world" # run the `echo` command

workflows:
  my-workflow:
    jobs:
      - hello-job

The job hello-job spins up a Windows virtual machine using the default executor specified by the Windows orb. Refer to Using the Windows execution environment page for more information.

version: 2.1

orbs:
  win: circleci/windows@5.0.0 # The Windows orb gives you everything you need to start using the Windows executor.

jobs:
  hello-job:
    executor:
      name: win/default # executor type
      size: "medium" # resource class, can be "medium", "large", "xlarge", "2xlarge", defaults to "medium" if not specified

    steps:
      # Commands are run in a Windows virtual machine environment
      - checkout
      - run: Write-Host 'Hello, Windows'

workflows:
  my-workflow:
    jobs:
      - hello-job
The GPU execution environment is available on the Scale Plan.

The job hello-job spins up a GPU-enabled virtual machine using the machine executor. GPU images are available for Windows and Linux. Refer to Using the GPU execution environment page for more information.

version: 2.1

jobs:
  hello-job:
    machine:
      image: linux-cuda-12:default
      resource_class: gpu.nvidia.medium
    steps:
      - checkout # check out the code in the project directory
      - run: echo "hello world" # run the `echo` command

workflows:
  my-workflow:
    jobs:
      - hello-job

The job hello-job spins up an [Arm (Linux) virtual machine] using the machine executor. Refer to Using the Arm VM execution environment page for more information.

version: 2.1

jobs:
  hello-job:
    machine:
      image: ubuntu-2004:202101-01
    resource_class: arm.medium
    steps:
      - checkout # check out the code in the project directory
      - run: echo "hello world" # run the `echo` command

workflows:
  my-workflow:
    jobs:
      - hello-job
Screenshot showing hello world in the job step output
If you get a No Config Found error, it may be that you used .yaml file extension. Be sure to use .yml file extension to resolve this error.

Echo hello world on CircleCI server

To build in a macOS execution environment on server use Self-Hosted Runner.

These examples add a job called hello-job that prints hello world to the console.

  • Docker

  • Linux VM

  • Windows

  • Arm

The job hello-job spins up a container running a pre-built CircleCI Docker image for Node. Refer to Using the Docker execution environment page for more information.

version: 2.1

jobs:
  hello-job:
    docker:
      - image: cimg/node:17.2.0 # the primary container, where your job's commands are run
    steps:
      - checkout # check out the code in the project directory
      - run: echo "hello world" # run the `echo` command

workflows:
  my-workflow:
    jobs:
      - hello-job

The job hello-job spins up a Linux vir†ual machine running a Ubuntu machine image. Refer to Using the Linux VM execution environment page for more information.

version: 2.1

jobs:
  hello-job:
    machine: true
    steps:
      - checkout # check out the code in the project directory
      - run: echo "hello world" # run the `echo` command

workflows:
  my-workflow:
    jobs:
      - hello-job

The job hello-job spins up a Windows virtual machine using the default executor specified by the Windows orb. Refer to Using the Windows execution environment page for more information.

version: 2.1

jobs:
  hello-job:
    machine:
      image: windows-default

    steps:
      # Commands are run in a Windows virtual machine environment
      - checkout
      - run: Write-Host 'Hello, Windows'

workflows:
  my-workflow:
    jobs:
      - hello-job

The job hello-job spins up an Arm (Ubuntu 22.04) virtual machine. Refer to Using the Arm VM execution environment page for more information.

version: 2.1

jobs:
  hello-job:
    machine:
      image: arm-default
    resource_class: arm.medium
    steps:
      - checkout # check out the code in the project directory
      - run: echo "hello world" # run the `echo` command

workflows:
  my-workflow:
    jobs:
      - hello-job
Screenshot showing hello world in the job step output
If you get a No Config Found error, it may be that you used .yaml file extension. Be sure to use .yml file extension to resolve this error.

Next steps

  • See the Concepts page for a summary of CircleCI-specific concepts.

  • Refer to the Workflows page for examples of orchestrating job runs with concurrent, sequential, scheduled, and manual approval workflows.

  • Find complete reference information for all keys and execution environments in the CircleCI Configuration Reference.