You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: jekyll/_cci2/hello-world.md
+63-34Lines changed: 63 additions & 34 deletions
Original file line number
Diff line number
Diff line change
@@ -7,60 +7,89 @@ categories: [getting-started]
7
7
order: 4
8
8
---
9
9
10
-
This document describes how to get started with a basic build of your Linux, Android, or macOS project on CircleCI 2.x after you [sign up]({{ site.baseurl }}/2.0/first-steps/).
10
+
This document describes how to get started with a basic build of your Linux, Android, Windows, or macOS project on CircleCI 2.x after you [sign up]({{ site.baseurl }}/2.0/first-steps/).
11
11
12
-
## Use the Hello-Build Orb
12
+
## Echo Hello World on Linux
13
+
14
+
This example adds a job called `build` that spins up a container running a the [pre-built CircleCI Docker image for Node]({{ site.baseurl }}/2.0/circleci-images/#nodejs). Then, it runs a simple `echo` command. To get started, complete the following steps:
13
15
14
16
1. Create a directory called `.circleci` in the root directory of your local GitHub or Bitbucket code repository.
15
17
16
-
2. Add a [`config.yml`]({{ site.baseurl }}/2.0/configuration-reference/) file in the `.circleci` directory with the following lines that import the [`hello-build` orb](https://circleci.com/orbs/registry/orb/circleci/hello-build).
18
+
1. Create a [`config.yml`]({{ site.baseurl }}/2.0/configuration-reference/) file with the following lines:
17
19
18
-
```yaml
19
-
version: 2.1
20
+
```yaml
21
+
version: 2
22
+
jobs:
23
+
10000
build-linux:
24
+
docker: # use the docker executor type; machine and macos executors are also supported
25
+
- image: circleci/node:4.8.2 # the primary container, where your job's commands are run
26
+
steps:
27
+
- checkout # check out the code in the project directory
28
+
- run: echo "hello world" # run the `echo` command
29
+
```
20
30
21
-
orbs:
22
-
hello: circleci/hello-build@0.0.7 # uses the circleci/buildpack-deps Docker image
31
+
1. Commit and push the changes.
32
+
33
+
1. Go to the Projects page in the CircleCI app, click the **Add Projects** button, then click
34
+
the **Set Up Project** button next to your project. If you don't see your project, make sure you have selected the associated Org. See the Org Switching section below for tips.
35
+
36
+
3. Click the **Start Building** button to trigger your first build.
37
+
38
+
The Workflows page appears with your `build` job and prints `Hello World` to the console.
39
+
40
+
**Note:** 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.
41
+
42
+
CircleCI runs each [job]({{site.baseurl}}/2.0/glossary/#job) in a separate [container]({{site.baseurl}}/2.0/glossary/#container) or VM. That is, each time your job runs, CircleCI spins up a container or VM to run the job in.
43
+
44
+
Refer to the [Node.js - JavaScript Tutorial]({{site.baseurl}}/2.0/language-javascript/) for a sample project.
45
+
46
+
## Hello World for Android
47
+
48
+
Using the basic ideas from the Linux example above, you can add a job that uses the `docker` executor with a pre-built Android image in the same `config.yml` file as follows:
23
49
24
-
workflows:
25
-
"Hello Workflow":
26
-
jobs:
27
-
- hello/hello-build
28
50
```
51
+
jobs:
52
+
build-android:
53
+
docker:
54
+
- image: circleci/android:api-25-alpha
55
+
```
56
+
57
+
See the [Android Language Guide]({{site.baseurl}}/2.0/language-android/) for details and a sample project.
58
+
59
+
## Hello World for macOS
60
+
61
+
Using the basics from the Linux and Android examples above, you can add a job that uses the `macos` executor and a supported version of Xcode as follows:
62
+<
8000
/span>
63
+
```
64
+
jobs: # a basic unit of work in a run
65
+
build-macos: # runs not using `Workflows` must have a `build` job as entry point
66
+
macos: # indicate that we are using the macOS executor
67
+
xcode: "10.0.0"# indicate our selected version of Xcode
68
+
```
29
69
30
-
Commit and push the changes to trigger a build. If this is your first project on
31
-
CircleCI, go to the Projects page, click the **Add Projects** button, then click
32
-
the **Set Up Project** button next to your project. You may also click **Start
33
-
Building** to manually trigger your first build.
70
+
Refer to the [Hello World on MacOS]({{site.baseurl}}/2.0/hello-world-macos) document for more information and a sample project.
34
71
35
-
## Echo Hello World with a `build` Job
72
+
## Hello World for Windows
36
73
37
-
Add a job called `build` that uses the Docker executor to spin up a Node container and runs a simple `echo` command:
74
+
Using the basics from the Linux, Android, and macOS examples above, you can add a job that uses the `win/vs2019` executor (Windows Server 2019) by adding the `orb:` key in the same `.circleci/config.yml` file as follows:
38
75
39
-
1. Add following lines to your `.circleci/config.yml` file. For Docker executors, replace `node:4.8.2` with any [Docker image]({{ site.baseurl }}/2.0/circleci-images/) you want:
76
+
```
77
+
orbs:
78
+
win: circleci/windows@1.0.0
40
79
41
-
```yaml
42
-
version: 2
43
80
jobs:
44
81
build:
45
-
docker: # use the docker executor type; machine and macos executors are also supported
46
-
- image: circleci/node:4.8.2 # the primary container, where your job's commands are run
82
+
executor: win/vs2019
47
83
steps:
48
-
- checkout # check out the code in the project directory
49
-
- run: echo "hello world" # run the `echo` command
84
+
- checkout
85
+
- run: Write-Host 'Hello, Windows'
50
86
```
51
87
52
-
CircleCI runs each [job]({{site.baseurl}}/2.0/glossary/#job) in a separate [container]({{site.baseurl}}/2.0/glossary/#container) or VM. That is, each time your job runs, CircleCI spins up a container or VM to run the job in.
53
-
54
-
**Note**: For `macos` and `windows` executors, some setup is different. Please refer to our [Hello World on Windows]({{site.baseurl}}/2.0/hello-world-windows) and [Hello World on MacOS]({{site.baseurl}}/2.0/hello-world-macos) documents for more information.
55
-
56
-
Commit and push the changes to trigger a build. If this is your first project on
57
-
CircleCI, go to the Projects page, click the **Add Projects** button, then click
58
-
the **Set Up Project** button next to your project. You may also click **Start
59
-
Building** to manually trigger your first build.
88
+
**Note**: For Windows builds, some setup and prerequisites are different. Please refer to our [Hello World on Windows]({{site.baseurl}}/2.0/hello-world-windows).
60
89
61
-
CircleCI checks out your code, prints "Hello World", and posts a green build to the Job page, adding a green checkmark on your commit in GitHub or Bitbucket.
90
+
### More About Using and Authoring Orbs
62
91
63
-
**Note:** 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.
92
+
Orbs are a great way to simplify your config or re-use config across your projects, by referencing packages of config in the [CircleCI Orbs Registry](https://circleci.com/orbs/registry).
0 commit comments