git
push. This can then be
pushed to Openlayer to run tests under any conditions you’d like.
This approach is useful for developers who want full control over their CI/CD pipeline,
as well as GitHub Enterprise Server users, who can’t leverage Openlayer’s built-in git
integration. It’s also useful for users whose execution runtime
may not be supported by Openlayer.
You can view a full example
here
or follow this guide to get started.
Generating Outputs
You can generate your AI system’s outputs locally (or in GitHub Actions) without giving Openlayer access to the source code through the Openlayer CLIopenlayer batch
command.
This will generate outputs and expect them to be placed in your model’s outputDirectory
folder conforming the the Batch Output specification.
openlayer batch
allows you to generate your AI system’s outputs within your own CI
setup, either on GitHub Actions or your own CI, and upload only the artifacts
(and not the source code) to Openlayer to create a new project version.
Configuring GitHub Actions for Openlayer
The CLIopenlayer push
command will upload the artifacts in your working directory (
skipping everything in .openlayerignore
) to Openlayer. Openlayer will auto
detect that your outputs have already been created and go straight to computing
your metrics and running your tests.
Let’s create our Action with a new file called .github/workflows/openlayer.yaml
openlayer push
will wait for the results and cause the Action to fail if
any of your tests failed.
Let’s add the required values from Openlayer as secrets in GitHub
- Retrieve your Openlayer API key
- Install the Openlayer CLI and run
openlayer login
- Inside your folder, run
openlayer link
to create a new Openlayer project - Inside the generated
.openlayer
folder, save theprojectId
from theconfig.json
- Inside GitHub, add
OPENLAYER_API_KEY
,OPENLAYER_PROJECT_ID
and anything else you need to generate your outputs as secrets
Testing Openlayer + your AI with GitHub Actions
Now that your Openlayer AI system is configured with GitHub Actions, you can try out the workflow:- Create a new pull request in your GitHub repository
- Merge the pull request into your main branch
- GitHub Actions will recognize the change and use the Openlayer CLI to push your AI
- The Action passes or fails based on the results of your tests