Use TypeDB in GitHub Actions
This tutorial shows you how to get a running instance of TypeDB into your GitHub Actions CI pipeline using the TypeDB GitHub Action.
Step 1. Install and run TypeDB
We install and run TypeDB using the typedb/setup-typedb GitHub Action, specifying the typedb_version to use as required.
name: TypeDB
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup TypeDB
uses: typedb/setup-typedb@1.0.0
with:
typedb_version: 3.5.1
Step 2. Arguments
The TypeDB GitHub Action supports a number of arguments for configuring TypeDB as required.
| Argument | Description | Default | Value |
|---|---|---|---|
|
The version of TypeDB to use |
latest |
A TypeDB version (e.g. |
|
TypeDB’s port for gRPC connections |
1729 |
Valid port number |
|
TypeDB’s port for HTTP connections |
8000 |
Valid port number |
|
Additional arguments to pass to TypeDB |
Usage example: Set up a database
Once the setup-typedb step has been run in a job,
there’ll be a TypeDB instance running for that job.
You’ll also have access to the TypeDB Console CLI,
which you could use for tasks such as loading schema and data to run tests against:
name: TypeDB
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup TypeDB
uses: typedb/setup-typedb@1.0.0
with:
typedb_version: 3.5.1
- name: Create and initialise database
run: |
typedb console --address=localhost:1729 --tls-disabled \
--username=admin --password=password \
--command="database create-init test-db path/to/schema.tql path/to/data.tql"
Step 3. Commit and push
Once your workflow file is set up, you can run it by committing and pushing to GitHub:
git add .github/workflows/workflow.yml
git commit -m "Add TypeDB workflow"
git push
Step 4. View the workflow run
Once your workflow is set up, you can view the workflow run in the "Actions" tab of your repository on GitHub.