//
//  Licensed to the Apache Software Foundation (ASF) under one or more
//  contributor license agreements.  See the NOTICE file distributed with
//  this work for additional information regarding copyright ownership.
//  The ASF licenses this file to You under the Apache License, Version 2.0
//  (the "License"); you may not use this file except in compliance with
//  the License.  You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
//  Unless required by applicable law or agreed to in writing, software
//  distributed under the License is distributed on an "AS IS" BASIS,
//  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//  See the License for the specific language governing permissions and
//  limitations under the License.
//
:imagesdir: ../images/

== Continuous Integration

We are currently using Apache's `Jenkins` as single CI system.

- Apache's Jenkins at: https://ci-builds.apache.org/job/PLC4X/

However we might add Travis for automatically building and testing Pull-Requests in the near future.

Hereby Apache Jenkins' clearly is responsible for running the full testsuite with all integration-tests.
Also only jobs on Apache Jenkins are allowed to publish SNAPSHOT versions of the Maven artifacts to `Apaches Nexus` at: https://repository.apache.org.

=== Structure of the Jenkins Pipeline build

We are using the Jenkins `multi-branch pipeline plugin` to automatically setup build for branches based upon the build definition in the `Jenkinsfile` in the root of the project.

In general it builds the `develop` branch and all branches starting with the prefix `feature/`.
However when building the `develop` branch some additional steps are performed.

When building `develop` the build not only builds the project itself and runs all tests, it also runs the `sonarcloud` analysis, deploys the artifacts built to the `Apache Nexus` as well as generates and deploys the website.

The general structure of the build is as follows:

[blockdiag,developers-ci-pipeline,svg]
....
{
  Start [shape = beginpoint];
  Initialization [label = "Initialization"];
  Cleanup [label = "Cleanup"];
  Checkout [color = "#068D9D", textcolor="#FFFFFF"];
  Build [label = "Build"];
  BuildDevelop [label = "Build develop"];
  CodeQuality [label = "Code Quality"];
  Deploy [label = "Deploy"];
  BuildSite [label = "Build Site"];
  StageSite [label = "Stage site"];
  DeploySite [label = "Deploy site"];
  Finish [shape = endpoint];

  Start -> Initialization -> Cleanup -> Checkout;
  Checkout -> Build [label = "feature branch"];
  Build -> Finish;
  Checkout -> BuildDevelop [label = "develop"];
  BuildDevelop -> CodeQuality -> Deploy -> BuildSite -> StageSite -> DeploySite; -> Finish;
}
....