Add CMake Stage job
[releng/global-jjb.git] / docs / jjb / lf-c-cpp-jobs.rst
1 ##########
2 C/C++ Jobs
3 ##########
4
5 Job Templates
6 =============
7
8 CMake Stage
9 -----------
10
11 Stage job which runs cmake && make && make install and then packages the
12 project into a tar.xz tarball to produce a release candidate.
13
14 :Template Names:
15
16     - {project-name}-cmake-stage-{stream}
17     - gerrit-cmake-stage
18     - github-cmake-stage
19
20 :Comment Trigger: stage-release
21
22 :Required parameters:
23
24     :build-node: The node to run build on.
25     :jenkins-ssh-credential: Credential to use for SSH.
26         (Configure in defaults.yaml)
27     :nexus-group-id: The Maven style Group ID for the namespace of the project
28         in Nexus.
29     :staging-profile-id: The unique Nexus Staging Profile ID for the project.
30         Contact your infra admin if you do not know it.
31
32 :Optional parameters:
33
34     :branch: Git branch to fetch for the build. (default: master)
35     :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
36     :build-dir: Directory to build the project in. (default: $WORKSPACE/target)
37     :build-timeout: Timeout in minutes before aborting build. (default: 60)
38     :cmake-opts: Parameters to pass to cmake. (default: '')
39     :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
40     :install-prefix: CMAKE_INSTALL_PREFIX to use for install.
41         (default: $BUILD_DIR/output)
42
43         .. code-block:: bash
44            :caption: Example
45
46            install-prefix: |
47                #!/bin/bash
48                echo "Hello World."
49
50     :make-opts: Parameters to pass to make. (default: '')
51     :pre-build: Shell script to run before performing build. Useful for
52         setting up dependencies. (default: '')
53     :stream: Keyword that to represent a release code-name.
54         Often the same as the branch. (default: master)
55     :submodule-recursive: Whether to checkout submodules recursively.
56         (default: true)
57     :version: (default: '') Project version to stage release as. There are 2
58         methods for using this value:
59
60         1) Defined explicitly here.
61         2) Leave this value blank and set /tmp/artifact_version
62
63         Use method 2 in conjunction with 'pre-build' configuration to
64         generate the artifact_version automatically from files in the
65         project's repository. For example with pre-build script:
66
67         .. code-block:: bash
68
69            #!/bin/bash
70            MAJOR_VERSION="$(grep 'set(OCIO_VERSION_MAJOR' CMakeLists.txt | awk '{{print $NF}}' | awk -F')' '{{print $1}}')"
71            MINOR_VERSION="$(grep 'set(OCIO_VERSION_MINOR' CMakeLists.txt | awk '{{print $NF}}' | awk -F')' '{{print $1}}')"
72            PATCH_VERSION="$(grep 'set(OCIO_VERSION_PATCH' CMakeLists.txt | awk '{{print $NF}}' | awk -F')' '{{print $1}}')"
73            echo "${{MAJOR_VERSION}}.${{MINOR_VERSION}}.${{PATCH_VERSION}}" > /tmp/artifact_version
74
75 CMake Verify
76 ------------
77
78 Verify job which runs cmake && make && make install to test a project build..
79
80 :Template Names:
81
82     - {project-name}-cmake-verify-{stream}
83     - gerrit-cmake-verify
84     - github-cmake-verify
85
86 :Comment Trigger: recheck|reverify
87
88 :Required parameters:
89
90     :build-node: The node to run build on.
91     :jenkins-ssh-credential: Credential to use for SSH.
92         (Configure in defaults.yaml)
93
94 :Optional parameters:
95
96     :branch: Git branch to fetch for the build. (default: master)
97     :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
98     :build-dir: Directory to build the project in. (default: $WORKSPACE/target)
99     :build-timeout: Timeout in minutes before aborting build. (default: 60)
100     :cmake-opts: Parameters to pass to cmake. (default: '')
101     :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
102     :install-prefix: CMAKE_INSTALL_PREFIX to use for install.
103         (default: $BUILD_DIR/output)
104
105         .. code-block:: bash
106            :caption: Example
107
108            install-prefix: |
109                #!/bin/bash
110                echo "Hello World."
111
112     :make-opts: Parameters to pass to make. (default: '')
113     :pre-build: Shell script to run before performing build. Useful for
114         setting up dependencies. (default: '')
115     :stream: Keyword that to represent a release code-name.
116         Often the same as the branch. (default: master)
117     :submodule-recursive: Whether to checkout submodules recursively.
118         (default: true)
119
120     :gerrit_verify_triggers: Override Gerrit Triggers.
121     :gerrit_trigger_file_paths: Override file paths which to filter which file
122         modifications will trigger a build.