workflow_job events from GitHub and automatically launches your job.
This tutorial assumes that you have a Python project containing unit tests and a GitHub Actions workflow that runs those unit tests using
pytest.Prerequisites
- A Blaxel account and workspace
- A GitHub repository containing a Python project with tests
- The Blaxel CLI (
bl) installed and authenticated
1. Create the Dockerfile
The Dockerfile defines the micro-VM filesystem. A good starting point is thecatthehacker Ubuntu image, which includes most tools found on GitHub-hosted runners. Here is an example for a Python test runner:
RUN, COPY, and ENV instructions. When you are ready to use a different image, edit the Dockerfile and redeploy.
2. Create the entrypoint script
The Dockerfile references an entrypoint script (start.sh) that starts Docker, fetches the JIT config from Blaxel and starts the GitHub Actions runner:
3. Create blaxel.toml
The blaxel.toml file defines the job configuration. This example uses ephemeral volumes and targets the GitHub repositories this runner is allowed to serve:
repositories field lists the GitHub repositories this runner is allowed to pick up jobs from. The format is owner/repo.
4. Deploy the job
Deploy the job to Blaxel:Due to the large size of the image, the build process can take up to 40 minutes in some cases.
5. Install the Blaxel GitHub App
- Log in to the Blaxel Console.
- Navigate to Hosting > Jobs >
<your-job-name>> Settings. - Scroll to the GitHub Runner section. It should show as Active.
- Click Edit, then click +.
- Follow the instructions to authorize and install the Blaxel GitHub App on the repository.
- Select the repository and click Save.
6. Redeploy the job
7. Use the runner in your GitHub Actions workflow
In any GitHub Actions workflow, setruns-on to <workspace>/<job-name> to target your Blaxel runner:
Resources
Jobs reference
Learn more about Blaxel Jobs and configuration options.
blaxel.toml reference
Full reference for all
blaxel.toml fields.