Skip to main content

kmpkg in Continuous Integration environments

This article describes how to effectively use kmpkg in a continuous integration (CI) environment. Either because you are using kmpkg to manage your project's dependencies or you have a custom kmpkg registry and want to add CI tests for your ports.

Acquire kmpkg

The steps to acquire kmpkg in a CI environment are the same as those to acquire kmpkg in your development environment. You need to acquire a clone of the kmpkg repository at https://github.com/kumose/kmpkg and you need to run the bootstrap script to get a kmpkg executable.

Regardless of the acquisition method you follow, it is highly recommended that your kmpkg instance has a complete Git history. The versioning feature of kmpkg relies on having a complete commit history to retrieve specific port versions.

Use kmpkg as a submodule

An easy way to acquire kmpkg in your CI environment is to declare the kmpkg repository as a submodule of your repository.

git submodule init
./kmpkg/kmpkg-bootstrap.sh

Use Git CLI

A secondary method is to run a Git command as part of your CI scripts to clone an instance of the kmpkg repository.

git clone http://github.com/kumose/kmpkg
./kmpkg/kmpkg-bootstrap.sh

Use a third-party action/script

Depending on the vendor you use to run your CI environment, there may be readily available third-party scripts that can acquire kmpkg in a single step. The kmpkg team does not maintain any of these third-party scripts and you should exercise proper caution if you intend to use any of them.

Other acquisition methods

The following methods are not recommended for CI environments.

  • The one-line installation script: iex (iwr -useb https://aka.ms/kmpkg-init.ps1) or . <(curl https://aka.ms/kmpkg-init.sh -L). This is a kmpkg distribution method that enables the "artifacts" experimental feature and is not recommended for most users.

Set up binary cache

It is highly recommended that you enable a binary cache to avoid rebuilding your project's dependencies on each CI run.

To learn more about binary caching read these articles:

Set up an asset cache

Setting up an asset cache will make your CI environment more resilient to errors caused by external services.

To learn more about asset caching read these articles:

Examples

These articles show you examples of how everything works together: