Cannot run Edge function test in CI
Describe the bug This blog article describes how to run Deno test : https://github.com/supabase/supabase/blob/master/apps/docs/content/guides/functions/unit-test.mdx
On my side, when I reproduce it, the serve function never releases the shell and the next step cannot be executed.
To Reproduce
Follow the exact step of the doc, also it seems the doc speak about folder supabase/tests but in the image just after it's supabase/functions/tests
Expected behavior The example in the doc should work and run the test properly
Screenshots
I had to cancel the job after 6 min as it will just max out the GitHub action timeout
Link of the run:
https://github.com/Cap-go/capgo/actions/runs/9051465646/job/24868015866
I did a PR to resolve the doc issue: https://github.com/supabase/supabase/pull/26211
i managed to make test work on CI with this step:
- uses: JarvusInnovations/background-action@v1
name: Bootstrap Edge server
with:
run: supabase functions serve &
wait-on: |
http-get://127.0.0.1:54321/functions/v1/ok
# IMPORTANT: to use environment variables in wait-on, you must use this form: ${{ env.VAR }}
# See wait-on section below for all resource types and prefixes
tail: true # true = stderr,stdout
# This will allow you to monitor the progress live
log-output-resume: stderr
# Eliminates previously output stderr log entries from post-run output
wait-for: 1m
log-output: stderr,stdout # same as true
log-output-if: failure
# failure = exit-early or timeout
working-directory: .
With a custom function, ok who direct respond. Action who did pass here: https://github.com/Cap-go/capgo/actions/runs/9051894658/job/24868953981
Thanks for contributing the docs update. Alternatively, you can also use supabase start in CI for testing functions.
@sweatybridge how do i set env var for the edge function then?
Ok, I found I can set the env with $ENV. But I see my test failing in GitHub action, where in local it works properly. One weird thing is the test are taking in GitHub action very long time to run when in local all run under one sec. https://github.com/Cap-go/capgo/actions/runs/9522755417/job/26252929906#logs
@riderx did you get this working?