Self-Serve
Run Tusk-generated tests on a GitHub Actions runner
Before you begin, make sure that you meet these requirements:
- Use GitHub for version control (GitLab not currently supported for self-serve)
- Use Python, JavaScript, or TypeScript in your repo
- Have GitHub
admin
access to manage secrets or variables for your repo
Overview
To surface meaningful and validated tests, Tusk needs to execute the tests it generates against your commit with your specific project’s dependencies.
Most engineering teams already have existing CI pipelines for running their unit test suites, most commonly with GitHub Actions.
Our self-serve flow allows you to provision a GitHub Actions runner as an ephemeral sandbox, enabling you to piggyback off of your existing workflow setup and granting you greater control over the configuration.
Using Tusk via self-serve will accrue GitHub Actions minutes for your organization. GitHub provides a generous amount of free minutes but a single Tusk test generation run can cost $0.16-0.32 depending on which runner you use. More on GitHub Actions billing here.
Set-Up Instructions
Go to Repos page
In Settings > Repos, click Setup test environment under the synced repo that you would like to set up a test environment for.
You’ll be directed to the wizard for setting up a test environment. Click Begin setup.
Configure your test environment
Start by selecting whether the repo you’re setting a test environment for is a monorepo or not. If it is a monorepo, include the application directory in the field that appears.
Then, choose your primary programming language and unit testing framework.
Next, provide the file paths of the workflows for running your unit test suite and linting/formatting checks. Tusk uses this to generate an accurate workflow file for running its tests.
Create the Tusk GitHub workflow
Pick between using the Tusk template for the GitHub Actions workflow file (Option 1) or creating the workflow file manually (Option 2).
We recommend going with Option 1 and clicking Create PR with template to use Tusk’s tailored workflow file.
Modify the Tusk GitHub workflow file
If you chose Option 1, click the URL to view the PR for the Tusk GitHub workflow. The workflow file will be tailored to your repo according to your configurations in the earlier steps.
Note: You may need to modify the workflow file to customize it to your project (e.g., setup steps, RegEx for matching test files). Refer to the comments in the workflow file itself as a guide for modifying the file. More details in this FAQ.
Create Tusk API key
In the Tusk set-up wizard, create an API key under the “Confirm Tusk API Key” section. Make sure to copy the API key on first creation and add it to your repo’s secrets.
Merge the Tusk GitHub workflow PR
Once you’ve reviewed and approved the Tusk GitHub workflow PR, merge the PR into your default branch.
Select the workflow file
In the Tusk set-up wizard, click Refetch under the “Select workflow” step. Then, select the Tusk GitHub workflow file you just merged. Click Continue.
Verify the Tusk GitHub workflow
Choose the branch to test the Tusk GitHub workflow on and then paste in file paths of existing test files in the repo. We recommend including at least 2 test files (use comma-separated values).
Click Verify workflow to run the test run. You should see Tusk attempt to verify that the workflow runs as expected.
Complete test environment set-up
Click Finalize configuration once the Tusk GitHub workflow passes all steps.
Now, enable seats to start seeing Tusk’s test generation on your PRs. 🎉