Algorithmia CI/CD
ActionsVerified
An algorithmia github Action to test and deploy github backed Algorithmia.com algorithms. When attached as a workflow for an Algorithmia algorithm, can automatically deploy new versions when provided tests pass.
For this action to function, the github action actions/checkout
must be called before this action, as we search for key files in your algorithm repository for simplicity.
An example workflow is below -- or you can take a look at a full algorithm example or this step-by-step tutorial.
inputs:
api_key:
description: 'Your algorithm management capable Algorithmia API key'
required: true
api_address:
description: 'The API address for the Algorithmia Cluster you wish to connect to'
required: false
default: 'https://api.algorithmia.com'
version_schema:
description: 'identifier to describe how to promote this release'
required: false
default: "minor"
path:
description: 'directory name for the local project stored in /github/workspace due to an "actions/checkout" command'
required: true
api_key - (required) - An Algorithmia api key that has execute access for the algorithm you wish to test, has full access for algorithms. read more about that [here](https://algorithmia.com/developers/platform/customizing-api-keys)
api_address - (optional) - The Algorithmia API cluster address you wish to connect to, if using a private cluster; please provide the correct path to your environment.
version_schema - (optional) - The [semantic version](https://semver.org/) parameter that will get incremented whenever this action gets triggered. May be "Major", "Minor", or "Revision"
path - (required) - The workspace path variable provided to the actions/checkout@v2 of the current job
Your Algorithm naturally contains a algorithmia.conf
file which we parse to gather the algorithm name from, however a new file called TEST_CASES.json
is required.
The required schema of this json file is shown below:
Your test cases should follow the following json schema
[
{
"case_name": String,
"input": Any,
"expected_output": Any,
"type": String,
"tree": List
},
...
]
input
(required) - the raw input that will be passed into the algorithm. Typically this will be a json dictionary, json list, or a primitive type (like a string).expected_output
(required) - What we are comparing against the result of your algorithm, which can be scoped in conjunction with settingtree
. For typesGREATER_OR_EQUAL
andLESS_OR_EQUAL
this must be a number value. For typesNO_EXCEPTION
andEXCEPTION
this field is optional.type
(optional) - defines the type of matching that can be done, options includeEXACT_MATCH
,GREATER_OR_EQUAL
,LESS_OR_EQUAL
,NO_EXCEPTION
andEXCEPTION
. Defaults toEXACT_MATCH
tree
(optional) - A list defining the json keys we should traverse in order to find the value you wish to compare against withexpected_output
.
[
{
"case_name": "image_classifier_accuracy",
"input": {"image_data": [...]},
"expected_output": 0.7,
"type": "GREATER_OR_EQUAL",
"tree": ["accuracy"],
}
]
Below is the standard algorithm CI workflow we recommend you use to take advantage of our CI/CD system. If you have any questions or comments please feel free to create an issue.
# This is an example using the Algorithmia CI action
name: CI
# Controls when the action will run. Triggers the workflow on push or pull request
# In this instance we're triggering this workflow whenever a push to master is performed.
on:
push:
branches: [master]
jobs:
# This workflow only contains a single job, however if you'd like you can split this processing across multiple jobs.
algorithmia-ci:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2.0.0
with:
ref: ${{github.sha}}
path: algorithm
- name: Algorithmia CI
uses: algorithmiaio/algorithmia-ci-action@v1.2.4
with:
# Your master Algorithmia API key
api_key: ${{ secrets.mgmt_api_key }}
# The API address for the Algorithmia Cluster you wish to connect to
api_address: https://api.algorithmia.com
# identifier to describe how to promote this release ('major', 'minor', 'revision')
version_schema: revision
# the path variable you defined in the actions/checkout action triggered before this one.
path: algorithm
Algorithmia CI/CD is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.