Home Explore Blog Models CI



docker

content/manuals/extensions/extensions-sdk/dev/continuous-integration.md
73a6dbab753070484fcda53b9ed009eb15b2259ceb1e29260000000300000b84
---
title: Continuous Integration (CI)
description: Automatically test and validate your extension.
keywords: Docker, Extensions, sdk, CI, test, regression
aliases: 
 - /desktop/extensions-sdk/dev/continuous-integration/
weight: 20
---

In order to help validate your extension and ensure it's functional, the Extension SDK provides tools to help you setup continuous integration for your extension.

> [!IMPORTANT]
>
> The [Docker Desktop Action](https://github.com/docker/desktop-action) and the [extension-test-helper library](https://www.npmjs.com/package/@docker/extension-test-helper) are both [experimental](https://docs.docker.com/release-lifecycle/#experimental).

## Setup CI environment with GitHub Actions

You need Docker Desktop to be able to install and validate your extension.
You can start Docker Desktop in GitHub Actions using the [Docker Desktop Action](https://github.com/docker/desktop-action), by adding the following to a workflow file:

```yaml
steps:
  - id: start_desktop
    uses: docker/desktop-action/start@v0.1.0
```

> [!NOTE]
>
> This action supports only Github Action macOS runners at the moment. You need to specify `runs-on: macOS-latest` for your end to end tests.

Once the step has executed, the next steps use Docker Desktop and the Docker CLI to install and test the extension.

## Validating your extension with Puppeteer

Once Docker Desktop starts in CI, you can build, install, and validate your extension with Jest and Puppeteer.

First, build and install the extension from your test:

```ts
import { DesktopUI } from "@docker/extension-test-helper";
import { exec as originalExec } from "child_process";
import * as util from "util";

export const exec = util.promisify(originalExec);

// keep a handle on the app to stop it at the end of tests
let dashboard: DesktopUI;

beforeAll(async () => {
  await exec(`docker build -t my/extension:latest .`, {
    cwd: "my-extension-src-root",
  });

  await exec(`docker extension install -f my/extension:latest`);
});
```

Then open the Docker Desktop Dashboard and run some tests in your extension's UI:

```ts
describe("Test my extension", () => {
  test("should be functional", async () => {
    dashboard = await DesktopUI.start();

    const eFrame = await dashboard.navigateToExtension("my/extension");

    // use puppeteer APIs to manipulate the UI, click on buttons, expect visual display and validate your extension
    await eFrame.waitForSelector("#someElementId");
  });
});
```

Finally, close the Docker Desktop Dashboard and uninstall your extension:

```ts
afterAll(async () => {
  dashboard?.stop();
  await exec(`docker extension uninstall my/extension`);
});
```

## What's next

- Build an [advanced frontend](/manuals/extensions/extensions-sdk/build/frontend-extension-tutorial.md) extension.
- Learn more about extensions [architecture](../architecture/_index.md).
- Learn how to [publish your extension](../extensions/_index.md).

Chunks
f463f231 (1st chunk of `content/manuals/extensions/extensions-sdk/dev/continuous-integration.md`)
Title: Setting up Continuous Integration (CI) for Docker Extensions
Summary
The Extension SDK provides tools to help set up continuous integration for Docker extensions. This involves using the Docker Desktop Action in GitHub Actions to start Docker Desktop, then building, installing, and validating the extension with Jest and Puppeteer. The Docker Desktop Action and extension-test-helper library are experimental. The process includes building and installing the extension, opening the Docker Desktop Dashboard, running UI tests, and finally, closing the Dashboard and uninstalling the extension. The guide suggests further learning on building advanced frontend extensions, understanding extension architecture, and publishing extensions.