Files
Ryan Curtin e30bd30df7 Add more cross-compilation hosts for CI job (#3906)
* Add a first attempt at explicitly using Jenkinsfiles.

* A first attempt...

* Put code in a script block.

* Add first attempt at link check job pipeline.

* Hopefully correct shell block.

* Install git.

* Install packages as root.

* Use custom image that already has dependencies installed.

* Try processing the JUnit results.

* Fix syntax (hopefully).

* Try to get the build to set its status on Github.

* Try and see if I can get the snippet build to run too.

* A first attempt at reviving the static code analysis build.

* Refactor style check job a bit.

* Try to clean up other files and have them set statuses.

* Set status in script blocks.

* Fix directory (this may not fix my problem).

* Should I load in the script step?

* Maybe I can just load it without a name.

* Maybe I have my path wrong.

* Will this work?  Just a test...

* Try using a plugin instead.

* And if I define the function manually at the top?

* Maybe this will fix the load.

* Try to turn unstable into failed.

* Hopefully fix documentation builds.

* Fix script blocks.

* Maybe fix static code analysis job.

* Try to adapt PR number variable.

* First attempt at cross-compilation job.

* Try to fix some syntax.

* Clean workspaces after build.

* Try to put the matrix in the right place.

* Another attempt at the matrix configuration.

* Maybe I have to nest it deeper.

* Maybe I have to clean always?

* What we need is more tabbing.

* Use try/catch to handle failed junit processing.

* Better handling of environment variables.

* Try a differernt approach than try/catch.

* Try to get some more information about ccache.

* Is it possible we could store the ccache at a higher level?

* Maybe I have the variable name wrong.

* Clean the cross-compilation workspace.

* Try mounting the ccache so it can be shared across multiple jobs.

* Always pull images.

* We need to run on the same node.

* Run on only one core.

* Try building in the Docker container in a different way.

* Do I have the order backwards?

* Can I run anything at all in the container?

* The static code analysis job isn't helpful.

* Try to set the user of the docker container.

* Rebuild the Docker container instead.

* Always pull an updated image.

* Download any necessary dependencies too.

* Oops, use the correct CMake options.

* Fix line break in the wrong place.

* Make sure to use the correct architecture.

* We can't use MATCHES, that is a regex.

* Oops, we need to use STREQUAL.

* Bump to an older version since newer versions don't have gfortran.

* Try to run the tests on the target.

* Correct syntax.

* Okay, I'm not allowed to generate a stage name.

* Try cleaning the workspace at the start of the build.

* Okay, so I just can't depend on the workspace cleaning job, wonderful.

* Try and add the passphrase correctly.

* Fix path for memory checks.

* Fix path to test.

* Fix PR number variable.

* Try to fix path for test copying.

* Try to get the PR number correct.

* Try and centralize where the link cache is stored.

* Why is it being printed strangely?

* Is there some weird restriction where this all has to be on one line?

* Always publish the HTML, and fix a link.

* Try to fix SSH host key check.

* Make the reports directory.

* Try to fix file parsing.

* Try to enable ccache.

* Try to set ccache directory correctly.

* Try to get the full pipeline set up correctly for cross-compilation.

* Fix path to test data.

* Allow debug builds when cross-compiling.

* Remember to unpack all the test data!

* Fail tests when the data isn't there.

* Maybe I can use find instead.

* Double escape for backslash?

* What if we just run the test?

* Port Catch2 improvement for junit runner.

See https://github.com/catchorg/Catch2/commit/c29e198eab0ccdb190495397854b937677385e2e.

* Re-enable junit testing (hopefully it will work now).

* Output directly to the xml file.

* Try to clean up regex.

* Try to set IN PROGRESS status.

* Could it be called RUNNING?

* I guess I don't get access to set jobs in progress through this API.

* Fix regex for test name extraction.

* Try to clean up Jenkinsfiles.

* Fix parameter name.

* Maybe fix syntax?

* Does it work without keyword arguments?

* Correctly accept named parameters.

* Abort previous builds to reduce load on Jenkins.

* Use optimization when compiling.

* Fix syntax for abortPrevious.

* Fix missing closing brace...

* Update links in CI documentation and try to fix memory check job.

* Add a few more hosts for testing.

* Document the additional systems.

* Separate build directories for each matrix entry.

* Use safer directory name.

* What directory are we in?

* Try an alternate strategy of setting build names.

* Fix typo.

* Assemble container name.

* Oops, forgot one.

* Oops, fix the last use of  to .

* Fix bad merge.

* Set different page sizes for different systems.

* Try different quotation strategy.

* Make sure the variable actually gets substituted in.

* Quotes, bane of my existence.

* Update Jetson Orin Nano link.

* Try to use CORTEXA72 for the BB-AI again.

* Try to set flags for the Jetson Orin Nano too.

* Remove board names and use architecture names instead.

* Re-add RPI4 as BCM2711.

* Try to get the junit files back using the correct variable.
2025-04-06 12:55:04 +02:00

8.2 KiB

mlpack continuous integration (CI) systems

Every pull request submitted to mlpack goes through a number of automated checks to make sure that all unit tests pass, all code matches the desired style guide, documentation does not contain any broken links, and so on and so forth.

In general, all CI checks need to pass for PRs to be merged, but like any complex project, there are occasionally spurious failures or other unrelated problems.

Also you can see the list of CI infrastructure.

Basic compilation and test jobs

Basic compilation and testing is done on Github Actions. We use Github Actions primarily because of the large number of resources that an mlpack build takes; our own internal resources are thus preserved for more specific usage.

Link: mlpack on Github Actions

  • Builds and tests mlpack for Linux, macOS, and Windows.

  • Also builds and tests all bindings on Linux, and Python bindings on macOS.

  • Builds the R tarball that can be submitted to CRAN and publishes it as an artifact.

  • Configurations for these jobs can be found in the mlpack repository under the .github/ directory.

    • The main file for the build pipeline is .github/workflows/ci.yml.
  • These jobs are most of what's shown in the jobs in a PR.

If your build is failing on Github Actions:

  • Take a look at the build summary and build logs to identify the issue.

  • If the failure is during mlpack_test, look through the test output to find where the actual failed test is.

    • If the failed test is related to your code, you probably have a bug to fix. :)
    • If the failed test does not seem related at all, it could be a spurious error in another test.
    • You can run the test locally with bin/mlpack_test NameOfTest.
    • If the test seems like a random failure, try different random seeds: bin/mlpack_test --rng-seed=X NameOfTest.

Binding tests

Inside of .github/workflows/ci.yml, the bindings are configured and built (depending on the parameters of the matrix build) using a local Github action. Similarly, the binding tests are also run using a local Github action.

  • .github/actions/binding_setup/main.yml defines the steps required to set up the environment for building each type of binding. Sometimes the steps are specific to an OS (e.g. Linux/macOS/Windows).

  • .github/actions/binding_run_tests/main.yml defines the steps to run tests for each binding type. Note that because we want output as junit XML so we can parse it, sometimes we have to do strange things for some languages, and we can't use CTest directly.

Documentation builds

The 'documentation link check' job and 'documentation snippet build' jobs build and tests all documentation, checking:

  • that all Markdown pages build and render properly;
  • that all HTML is valid;
  • that all links referenced in the documentation are valid;
  • that all code examples compile and run.

All of the scripts to perform these builds are located in the scripts/ directory, so that they can be run locally. On CI, these are defined as two Jenkins jobs in .jenkins/doc-link-check/Jenkinsfile and .jenkins/doc-snippet-build/Jenkinsfile.

  • ./scripts/build-docs.sh

    • Builds all documentation in doc/ with the output directory doc/html/.
    • If you browse to doc/html/index.html you can browse locally-built documentation.
    • Checks all HTML links and anchors.
  • ./scripts/test-docs.sh doc/

  • ./scripts/test-docs.sh doc/path/to/file.md

    • Extracts code blocks from documentation and compiles and runs them.
    • Can be run on either all the documentation (with doc/ or directory argument), or a single file.
    • May require CXX, CXXFLAGS, and LDFLAGS environment variables to be set. See the script itself for more details.
    • If run on an individual file, the output of each compiled code snippet will be printed.

When writing new documentation, be sure to test it locally---going back and forth with the link checker job on Jenkins and snippet build job on Jenkins can be very tedious.

Style checks

The style checker job runs on Jenkins and is defined in .jenkins/style-checks/Jenkinsfile.

  • The lint.sh script to check for C++ style issues.

  • If your job failed this check, look at the "Test Result" tab in the Jenkins job. Style issues for each file will be displayed in an expandable block.

  • See also the style guidelines for mlpack.

Cross-compilation checks

The cross-compilation checks run on Jenkins and test cross-compilation of mlpack to a number of low-resource and embedded devices. The job is defined in .jenkins/cross-compilation/Jenkinsfile.

  • The job builds mlpack in a cross-compilation environment, targeting a number of architectures, and then running tests on actual embedded hardware.

  • Any failures seen here that are not seen in other jobs will probably be failures specific to the cross-compilation environment.

  • For the list of targeted devices, see the list of CI infrastructure.

Memory checks

The memory checks run valgrind on any tests that were detected to be changed. This detection is performed via a heuristic and may not always be correct. The job is defined in .jenkins/memory-checks/Jenkinsfile.

If there are any memory issues with the code, this should be reported by a failed memory check job. If you encounter one of these, try compiling with debugging symbols and running valgrind on the affected test, like this:

valgrind --leak-check=full --track-origins=yes bin/mlpack_test "TestName"

List of CI infrastructure

Many physical systems are involved with testing mlpack and are hooked up to Jenkins.

Link: Jenkins (ci.mlpack.org)

  • The 'specialized' build system.

  • Various Jenkins configuration related resources are found in the jenkins-conf repository.

  • The list of workers (individual systems) can be found here.

  • Adding or modifying jobs requires privileges; you can either ask an mlpack maintainer to make changes, or if you are on the Contributors team but still don't have access, ask somewhere and someone will give you access. (Probably #mlpack:matrix.org is the best bet!)

  • A number of embedded devices are available to Jenkins and are used in the cross-compilation job. Each system is named after a main ingredient in a good meal eaten just before receiving the embedded device.