Continuous Integration

CI/CD solutions are a common way to manage release builds and testing for serious software projects.

This reference material provides the basics to get arc running in a headless build environment, along with tips to improve the CI experience.

Build dependencies

As described in the normal install instructions, we depend on nodejs and yarn.

  • Linux, your package manager will likely provide node, apt install nodejs or similar.

  • macOS, invoke brew install node.

  • Windows, If your build worker has Chocolatey, invoke choco install nodejs-lts.

Yarn recommends installing via npm after nodejs is installed.

npm install --global yarn

Installing arc

Bash-like shells

This applies to macOS, and the Linux distro's we've tested (Ubuntu, Arch, Solus)

Just run the normal install setup script to download the latest copy of arc from our server.

bash
curl https://install.electricui.com | bash

Otherwise, you can download the arc binary directly from our server:

https://registry.eui.io/arc/latest/arc_latest_linux_amd64.tar.gz
https://registry.eui.io/arc/latest/arc_latest_darwin_amd64.tar.gz

and add it to your PATH by adding an entry into .profile or .bashrc as you see fit.

Alternatively, add it temporarily to your system's PATH by appending it to the current path:

bash
export PATH="$PATH:~/electricui-arc-location"

Windows Powershell

Download arc.exe directly from our server, and add the folder to PATH.

powershell
Invoke-WebRequest -Uri "https://registry.eui.io/arc/latest/arc_latest_windows_amd64.zip" -OutFile "arc_latest_windows_amd64.zip"
expand-archive -path 'arc_latest_windows_amd64.zip' -destinationpath 'electricui-arc'

In following stages of the build job, either invoke the arc executable with a fully resolved location, or add it to your PATH (temporarily, or permanently depending on your build environment).

Here are a few different ways to do this:

powershell
echo "electricui-arc" | Out-File -Append -FilePath $env:Path -Encoding utf8
powershell
$env:Path += ";C:\my-working-directory\electricui-arc"
powershell
[System.Environment]::SetEnvironmentVariable('C:\working-dir\electricui-arc',$Value,[System.EnvironmentVariableTarget]::Process);

Using arc

We offer specific CI/CD accounts and tokens to commercial users.

Before continuing, you need to login to arc with your Electric UI credentials.

Normally this is done by following the prompts after arc login, but this process is non-trivial in a scripted environment. Instead, we suggest using the environment variable support built into arc.

Set the environment variables ARC_EMAIL and ARC_PASSWORD. We recommend storing these strings in your CI solutions secret key tooling to prevent leakage through configuration files or logs.

Checking the build setup

The best way to validate the setup is to run arc info.

The output will display the active version of arc, nodejs and yarn, as well as displaying if a login is active.

Running a production build

In situations where the repository has been pulled into a fresh machine/VM, the project will likely be missing dependencies.

  • Set your working directory to the interface directory in your repo.
  • arc install to fetch the libraries and deps listed in the package.json and electricui.json files.
  • arc build.

This process typically takes 2-4 minutes on a standard low-mid range cloud CI instance, and will typically download about 80-120MB of files.

Build artifacts

The build products will be emitted into the release folder.

Generally the premade .zip is the most useful, though unpacked copies are also available alongside.

End-to-End Tests

The default Electric UI template includes stubs for e2e testing.

This section will be detailed at a later date.

For assistance running e2e tests in a CI environment, get in touch.