Merge "Remove detox in favor of tox --parallel"
[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 Sonar
9 -----------
10
11 Sonar job which runs cmake && make then publishes to Sonar.
12
13 This job purposely runs on the master branch as there are configuration needed
14 to support multi-branch.
15
16 :Template Names:
17
18     - {project-name}-cmake-sonar
19     - gerrit-cmake-sonar
20     - github-cmake-sonar
21
22 :Comment Trigger: run-sonar
23
24 :Required parameters:
25
26     :build-node: The node to run build on.
27     :jenkins-ssh-credential: Credential to use for SSH. (Configure in
28         defaults.yaml)
29     :sonar-scanner-version: Version of sonar-scanner to install.
30     :sonarcloud-project-key: SonarCloud project key.
31     :sonarcloud-project-organization: SonarCloud project organization.
32     :sonarcloud-api-token: SonarCloud API Token.
33
34 :Optional parameters:
35
36     :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
37     :build-timeout: Timeout in minutes before aborting build. (default: 60)
38     :cmake-opts: Parameters to pass to cmake. (default: '')
39     :cron: Cron schedule when to trigger the job. This parameter also
40         supports multiline input via YAML pipe | character in cases where
41         one may want to provide more than 1 cron timer.  (default: '@daily')
42     :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
43     :install-prefix: CMAKE_INSTALL_PREFIX to use for install.
44         (default: $BUILD_DIR/output)
45     :make-opts: Parameters to pass to make. (default: '')
46     :pre-build: Shell script to run before performing build. Useful for
47         setting up dependencies. (default: '')
48     :submodule-recursive: Whether to checkout submodules recursively.
49         (default: true)
50     :submodule-timeout: Timeout (in minutes) for checkout operation.
51         (default: 10)
52     :submodule-disable: Disable submodule checkout operation.
53         (default: false)
54
55     :gerrit_sonar_triggers: Override Gerrit Triggers.
56
57 CMake Stage
58 -----------
59
60 Stage job which runs cmake && make && make install and then packages the
61 project into a tar.xz tarball to produce a release candidate.
62
63 :Template Names:
64
65     - {project-name}-cmake-stage-{stream}
66     - gerrit-cmake-stage
67     - github-cmake-stage
68
69 :Comment Trigger: stage-release
70
71 :Required parameters:
72
73     :build-node: The node to run build on.
74     :jenkins-ssh-credential: Credential to use for SSH.
75         (Configure in defaults.yaml)
76     :nexus-group-id: The Maven style Group ID for the namespace of the project
77         in Nexus.
78     :staging-profile-id: The unique Nexus Staging Profile ID for the project.
79         Contact your infra admin if you do not know it.
80
81 :Optional parameters:
82
83     :branch: Git branch to fetch for the build. (default: master)
84     :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
85     :build-dir: Directory to build the project in. (default: $WORKSPACE/target)
86     :build-timeout: Timeout in minutes before aborting build. (default: 60)
87     :cmake-opts: Parameters to pass to cmake. (default: '')
88     :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
89     :install-prefix: CMAKE_INSTALL_PREFIX to use for install.
90         (default: $BUILD_DIR/output)
91     :make-opts: Parameters to pass to make. (default: '')
92     :pre-build: Shell script to run before performing build. Useful for
93         setting up dependencies. (default: '')
94     :stream: Keyword that to represent a release code-name.
95         Often the same as the branch. (default: master)
96     :submodule-recursive: Whether to checkout submodules recursively.
97         (default: true)
98     :submodule-timeout: Timeout (in minutes) for checkout operation.
99         (default: 10)
100     :submodule-disable: Disable submodule checkout operation.
101         (default: false)
102     :version: (default: '') Project version to stage release as. There are 2
103         methods for using this value:
104
105         1) Defined explicitly here.
106         2) Leave this value blank and set /tmp/artifact_version
107
108         Use method 2 in conjunction with 'pre-build' configuration to
109         generate the artifact_version automatically from files in the
110         project's repository. For example with pre-build script:
111
112         .. code-block:: bash
113
114            #!/bin/bash
115            MAJOR_VERSION="$(grep 'set(OCIO_VERSION_MAJOR' CMakeLists.txt | awk '{{print $NF}}' | awk -F')' '{{print $1}}')"
116            MINOR_VERSION="$(grep 'set(OCIO_VERSION_MINOR' CMakeLists.txt | awk '{{print $NF}}' | awk -F')' '{{print $1}}')"
117            PATCH_VERSION="$(grep 'set(OCIO_VERSION_PATCH' CMakeLists.txt | awk '{{print $NF}}' | awk -F')' '{{print $1}}')"
118            echo "${{MAJOR_VERSION}}.${{MINOR_VERSION}}.${{PATCH_VERSION}}" > /tmp/artifact_version
119
120 CMake Verify
121 ------------
122
123 Verify job which runs cmake && make && make install to test a project build..
124
125 :Template Names:
126
127     - {project-name}-cmake-verify-{stream}
128     - gerrit-cmake-verify
129     - github-cmake-verify
130
131 :Comment Trigger: recheck|reverify
132
133 :Required parameters:
134
135     :build-node: The node to run build on.
136     :jenkins-ssh-credential: Credential to use for SSH.
137         (Configure in defaults.yaml)
138
139 :Optional parameters:
140
141     :branch: Git branch to fetch for the build. (default: master)
142     :build-days-to-keep: Days to keep build logs in Jenkins. (default: 7)
143     :build-dir: Directory to build the project in. (default: $WORKSPACE/target)
144     :build-timeout: Timeout in minutes before aborting build. (default: 60)
145     :cmake-opts: Parameters to pass to cmake. (default: '')
146     :git-url: URL clone project from. (default: $GIT_URL/$PROJECT)
147     :install-prefix: CMAKE_INSTALL_PREFIX to use for install.
148         (default: $BUILD_DIR/output)
149     :make-opts: Parameters to pass to make. (default: '')
150     :pre-build: Shell script to run before performing build. Useful for
151         setting up dependencies. (default: '')
152     :stream: Keyword that to represent a release code-name.
153         Often the same as the branch. (default: master)
154     :submodule-recursive: Whether to checkout submodules recursively.
155         (default: true)
156     :submodule-timeout: Timeout (in minutes) for checkout operation.
157         (default: 10)
158     :submodule-disable: Disable submodule checkout operation.
159         (default: false)
160
161     :gerrit_verify_triggers: Override Gerrit Triggers.
162     :gerrit_trigger_file_paths: Override file paths which to filter which file
163         modifications will trigger a build.