Buildless + GitHub Actions
Using Buildless to accelerate CI on GitHub
You can now use Buildless inside your Github Actions CI using the buildless/setup
action. The action will install the CLI tools and Agent by default. You can choose to start the agent or keep it stopped until you need it for your build.
Setup/Installation
Firstly, add the buildless/setup
action to your workflow:
steps:
- name: "Setup: Buildless"
uses: buildless/[email protected]
- name: "Setup: Buildless"
uses: buildless/[email protected]
with:
version: latest
os: linux
arch: amd64
agent: true
apikey: ${{ env.BUILDLESS_APIKEY || secrets.BUILDLESS_APIKEY }}
token: ${{ env.GITHUB_TOKEN }}
export_path: true
Make sure to use the latest release
Optionally, you can set various configuration values. Here's a full example of the default configuration, which is effectively the same as above:
Remember to set your API key
The best way to set your API key is with a Repository Secret. Set
BUILDLESS_APIKEY
to your key and it should show up in your action assecrets.BUILDLESS_APIKEY
.
Authorizing your Github Actions CI
Buildless in Github Actions is best used with Buildless Cloud. Otherwise, there's nowhere to store your persistent cache, and no ability to share your cache with your local machine.
Follow the instructions below to setup your API key for build caching with CI.
Your API key
If you're logged in, click here to see your API keys.
-
Obtain a Buildless API key. All users, orgs, and projects have their own API key.
-
Navigate to your Actions secrets. Within the repo you want to enable for caching, go to the Settings tab. In the left column, under the heading Security, click the Secrets and variables menu, then click Actions:
-
Create a Repository Secret. Click the button to the right side, New repository secret, and fill in the name and key value:
-
Map your secret as needed. Use your secret in your workflow. Buildless applications will automatically pick up your API key as long as it is set in your environment.
For most workflow types, it's enough to map the secret and move on. It will surface in two ways:${{ secrets.BUILDLESS_APIKEY }}
: Direct mapping on thesecrets
context${{ env.BUILDLESS_APIKEY }}
: Env-based access
For certain workflow types, like Reusable Workflows, you may need to take the extra step of passing the API key to the sub-workflow.
Configuration
The Buildless Setup action can be configured to start the agent when it starts up. You can specify a specific version to install, and there are several other configuration options available.
Option | Type | Default | Description |
---|---|---|---|
version | string | latest | Version to install; defaults to latest |
os | string | (Current) | OS to target; defaults to current platform |
arch | string | (Current) | Arch to target; defaults to current platform |
agent | boolean | true | Install and start the Buildless Agent |
apikey | string | ${{ env.BUILDLESS_APIKEY }} | Explicitly set a Buildless API key |
token | string | ${{ env.GITHUB_TOKEN }} | GitHub token to use for fetching assets |
export_path | boolean | true | Whether to install Buildless onto the PATH |
Options for os
(support varies)
darwin
,mac
,macos
windows
,win32
linux
Options for arch
(support varies)
amd64
,x64
,x86_64
arm64
,aarch64
Supported Platforms
At this time, all runners on Github are supported, as are self-hosted runners, on any of the following platforms:
- Darwin (amd64 or arm64)
- Linux (amd64)
- Windows (amd64)
Updated about 1 year ago