Github Actions

GitHub Actions is an automation platform built in to GitHub.com that makes it easy to automate code quality on your github repos. There are a number of integrations that make using TestBox inside GitHub Actions simple, speedy and powerful so you can get back to writing code.
- FREE for public repositories
- 2,000 minutes for private repos
- Can reuse workflows, i.e. for a standard
test.yml
workflow in both builds and PR testing - Can schedule workflow runs
Testing your application with TestBox in GitHub Actions (GHA) begins a
workflow.yml
file at the root of a .github/workflows/
directory. You can name this file anything you like - I'd suggest build.yml
or test.yml
- but if it is not a valid Yaml file the GHA workflow will fail.This file should start with some GHA metadata to dictate when and how the workflow should run:
# .github/workflows/tests.yml
name: Test
on:
push:
branches:
- main
- master
- development
This will run the workflow on each commit to the
master
or main
branch. Next, specify a workflow job to execute:jobs:
tests:
name: Tests
runs-on: ubuntu-latest
steps:
- # All job steps go here
Under the
jobs.tests.steps
is where we will place each sequential testing step. First, we need to check out the repository code and install Java and CommandBox: - name: Checkout Repository
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup Java
uses: actions/setup-java@v2
with:
distribution: "adopt"
java-version: "11"
- name: Setup CommandBox
uses: Ortus-Solutions/setup-commandbox@main
If we need to install dependencies, we would do that now:
- name: Install dependencies
run: box install
And finally, we can start a CFML server of our choice using CommandBox, before using the
testbox run
command to run our test suite: - name: Start server
run: box server start [email protected] --noSaveSettings
- name: Run TestBox Tests
run: box testbox run
If you are using a testing matrix to test against multiple CFML engines, replace[email protected]
with${{ matrix.cfengine }}
. See an example here
The full example would look something like this:
# .github/workflows/tests.yml
name: Test
on:
push:
branches:
- main
- master
- development
jobs:
tests:
name: Tests
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Setup Java
uses: actions/setup-java@v2
with:
distribution: "adopt"
java-version: "11"
- name: Setup CommandBox
uses: Ortus-Solutions/setup-commandbox@main