Home

Automated testing using GitHub Actions

Run your tests when you or your team make changes.


You can use the Supabase CLI to run automated tests.

Testing your database#

After you have created unit tests for your database, you can use the GitHub Action to run the tests.

Inside your repository, create a new file inside the .github/workflows folder called database-tests.yml. Copy this snippet inside the file, and the action will run whenever a new PR is created:

1
name: 'database-tests'
2
on:
3
pull_request:
4
5
jobs:
6
build:
7
runs-on: ubuntu-latest
8
steps:
9
- uses: actions/checkout@v3
10
- uses: supabase/setup-cli@v1
11
with:
12
version: latest
13
- run: supabase db start
14
- run: supabase test db

Testing your Edge Functions#

After you have created unit tests for your Edge Functions, you can use the GitHub Action to run the tests.

Inside your repository, create a new file inside the .github/workflows folder called functions-tests.yml. Copy this snippet inside the file, and the action will run whenever a new PR is created:

1
name: 'functions-tests'
2
on:
3
pull_request:
4
5
jobs:
6
build:
7
runs-on: ubuntu-latest
8
steps:
9
- uses: actions/checkout@v3
10
- uses: supabase/setup-cli@v1
11
with:
12
version: latest
13
- uses: denoland/setup-deno@v2
14
with:
15
deno-version: latest
16
- run: supabase start
17
- run: deno test --allow-all deno-test.ts --env-file .env.local

More resources#