WORK IN PROGRESS
This document describes a draft proposal for NuttX continuous integration.
Part of the info in this document is related to threads in the dev@nuttx.apache.org mailing list. Some related threads by subject are the following:
nxstyle)The goals of continuous integration are the following:
In general, other common practices should be considered as goals too.
To some extension, the following table should give a hint about what to include in each situation:
| Case | Maximum duration | Commit message format & code style | Build of nuttx and/or apps | Minimal testing | Full testing |
|---|---|---|---|---|---|
| Rebase from master in local developer environment | ~1-5 minutes | always | always | optional | not recommended |
| Prepare local code for pull request | ~1 hour | always | always | recommended | optional |
| Continuous integration triggered by a pull request update | ~2-3 hours | always | always | always | optional |
| Nightly build | ~12 hours | always | always | always | always |
The pipeline term is used here in a loose way. It means whatever arrange of tools and scripts to execute the CI. Specifically it does not restrict to the Jenkins CI pipelines.
In principle, all the code for the pipeline should be stored in the separate repository, so that the main NuttX code is not "contaminated" by it (see thread "Test repository" in dev@nuttx.apache.org mail list). Currently the repository to use is: https://github.com/apache/incubator-nuttx-testing
The continuous integration pipeline consist in the following steps and substeps.
Each one of these steps should be usually reflected by a step in the pipeline of the chosen CI tool, so that its UI allows easy identification of the step. They also should have easy access to
This step will basically check that the commit is well formed and that the source code follows the NuttX coding standards.
The intention is to discard as early as possible that the code is not fulfilling the coding standards. Building and testing stages are way more costly in resources, so it would be wasteful to test all the pipeline just to discover that the code is not acceptable to start with.
The output of this step will be a report that will include all the detected problems, so that the contributor could address them all: in this case it should not fail-fast until all the errors are detected. For example, if 2 files have been modified, the tool should not stop after finding one error in one of the files. The idea of fail-fast is to save resources, but in this case, the compute resource wasted is minimal, and the weight of the "contributor's time resource" is higher.
Proposed tools:
nxstyle: this is a tool available under tools/nxstyle.c in incubator-nuttx repository.This step will check that source code can be build in all or at least the main architectures.
Proposed tools:
tools/testbuild.sh in incubator-nuttx repositoryIn principle not all the architectures should be tested, so at least one configuration for minimal test and another for full one is expected.
The output of this step should be any artifact that could be used by the test step. They should be complete enough to be able to be downloaded and successfully tested on local developer environment, if desired.
Currently no static code analysis tests are done in NuttX, so this will kind of tests are out of the scope for the initial CI pipeline.
These tests should test individual functions, like simple API calls, etc.
Some of them are under testing/ directory in incubator-nuttx-apps repository.
It seems most of the current test available in NuttX are in this category, despite this classification could be discussed. Most of them are under testing/ directory in incubator-nuttx-apps repository.
These tests should test NuttX integration with external and third-parties code.
Currently no integration tests are done in NuttX (to be checked), so this will kind of tests are out of the scope for the initial CI pipeline.
Currently no performance test are done in NuttX, so this will kind of tests are out of the scope for the initial CI pipeline.
These tests should gather the coverage reports of previous test steps, and generate a report about the coverage (absolute and relative to the just code in the contribution (GIT commit) under test).
Currently no coverage output is generated in previous tests, so this will kind of tests are out of the scope for the initial CI pipeline.
Current proposal for implementation is to generate a Jenkins pipeline job, called nuttx.
The execution will consist on a Jenkins Pipeline defined by the contents of Jenkinsfile file in the root the ci-configuration branch of incubator-nuttx-testing repository (see https://jenkins.io/doc/book/pipeline/getting-started/#defining-a-pipeline-in-scm).
The triggers of the pipeline will be:
incubator-nuttx repositoryincubator-nuttx-apps repositoryincubator-nuttx-testing repositoryWARNING: the special branch in incubator-nuttx-testing repository, called ci-configuration, will have a special functionality as explained before, and must not be used as trigger source. This branch will not trigger any automated job from its pull request. Instead, it should be tested using another Jenkins pipeline job, called nuttx-testing-ci-configuration, that should be triggered manually by Apache NuttX committers with enough privileges. This will allow to test in a more controlled way the changes in the pipeline itself.
The jobs in the pipeline will have the following filesystem as part of their environment:
nuttx/ will contain the contents of the master branch (or release/topic branch) of incubator-nuttx repository, or the trigger commit, in case it belongs to that repository.apps/ will contain the contents of the master branch (or release/topic branch) of incubator-nuttx-apps repository, or the trigger commit, in case it belongs to that repository.testing/ will contain the contents of the master branch (or release/topic branch) of incubator-nuttx-testing repository, or the trigger commit, in case it belongs to that repository.Here is a draft of what could be the pipeline script:
|
|---|
This is a TODO list with questions and issues to discuss: