/magit-ci

Add a CI section to magit buffer showing the current status of builds linked to remote origins

Primary LanguageEmacs Lisp

Magit-ci is an extension for magit that polls build pipelines and reports their status in the magit buffer.

Currently it only supports Google Cloudbuild and Github Actions*.

*Github action support is currently experimental and lacks certain features like viewing individual build steps

Configuring the builds source

The build source for magit-ci to use can be configured by setting the magit-ci-source variable.

e.g. (setq magit-ci-source magit-ci-gcloud-source) for google cloudbuild and (setq magit-ci-source magit-ci-gh-actions-source) for github actions

Configuring branches watched

Builds are polled but only the current branch is displayed in order to cut down on the noise in the buffer.

However, if you would like to always watch other branches (such as 'main' for production deploys), add the branches to the magit-ci-extra-branches alist

(setq magit-ci-extra-branches '("main"))

Custom build providers

New build providers can be added through the magit-ci-defsource macro.

By providing a :command-builder, a function accepts the name of the current branch and returns a list of command 'parts' that will be passed to async-start-process

and a :response-parser, a function that accepts a string of the output generated by executing the command constructed by the :command-builder, and converts them to the structured ci-build class.

eg:

(magit-ci-defsource "custom-thing" #'custom-thing-cmd-builder #'custom-thing-build-parser)

The output of above will be a new function magit-ci-custom-thing-source, which can then be used as a build source by customising the magit-ci-source variable

(setq magit-ci-source magit-ci-custom-thing-source)