Skip to main content

Circle CI

Circle CI is a service that allows you to run automated workflows in response to events that are triggered in a repository. You can use Circle CI to automate tasks such as building, testing, and deploying your code.

This guide will show you how to use Circle CI to create and test on your AVH devices.

Prerequisites

To use Circle CI with AVH, you will need:

  • An AVH account
  • A code repository
  • An AVH API token
  • A Circle CI account connected to the repository

Create an AVH API token

To use Circle CI with AVH, you will need to create an AVH API token, which you can do in our Web UI.

Create a repository

To use Circle CI with AVH, you will need to create a repository in the code repository service of your choice. For example, GitLab, GitHub, Bitbucket, etc.

Add your environment variables

To use Circle CI with AVH, you will need to add your AVH API token and Project ID to your Circle CI environment variables.

To do this, go to your repository's settings in Circle CI and add the following environment variables:

  • CORELLIUM_API_TOKEN: Your AVH API token
  • CORELLIUM_PROJECT: Your AVH project ID

Create a Circle CI workflow

To use Circle CI with AVH, you will need to create a Circle CI workflow. You can do this by creating a file called .circleci/config.yml in your repository.

The following example workflow will run the following steps every push:

  1. Create a device (an Android running 14.0.0)
  2. Show the installed apps
  3. List the device's files
  4. Stop the device
  5. Delete the device

Let's go!

version: 2.1

orbs:
node: circleci/node@5.1.0

jobs:
test:
docker:
- image: cimg/base:stable
steps:
- checkout

- node/install:
node-version: '16.13'

- run:
name: Install AVH CLI
command: npm install -g @corellium/corellium-cli

- run:
name: Login to AVH
command: corellium login --apitoken ${CORELLIUM_API_TOKEN} --endpoint https://app.avh.corellium.com

- run:
name: Create device
# The `true` argument will wait for the device to be ready before continuing, which is useful for CI.
# We'll store the device ID in an environment variable so we can use it later.
command: |
id=$(corellium instance create ranchu 14.0.0 ${CORELLIUM_PROJECT} true)
echo "export INSTANCE_ID=$id" >> $BASH_ENV

- run:
name: List apps
# This may take a few minutes to finish as the device restores.
command: corellium agent apps --project ${CORELLIUM_PROJECT} --instance ${INSTANCE_ID}

- run:
name: List files
command: corellium agent files --project ${CORELLIUM_PROJECT} --instance ${INSTANCE_ID}

- run:
name: Stop device
# The `true` argument will wait for the device to be fully stopped before continuing, which is useful for CI.
command: corellium instance stop ${INSTANCE_ID} true

- run:
name: Delete device
command: corellium instance delete ${INSTANCE_ID}

workflows:
test-workflow:
jobs:
- test