Skip to content

Commit 1776a57

Browse files
authored
chore(ci): move tests to infra directory (#269)
* chore(ci): move tests to infra directory * chore(ci): update containers to exclude names * chore(ci): update the coveralls carryforward property * chore(ci): change name of finish_tests job
1 parent 7e9429f commit 1776a57

File tree

7 files changed

+24
-13
lines changed

7 files changed

+24
-13
lines changed

.github/workflows/ci.yml

+5-2
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,13 @@ jobs:
3636
with:
3737
version: latest
3838

39+
- name: Start Supabase local development setup
40+
run: supabase start --workdir infra -x studio,inbucket,edge-runtime,logflare,vector,supavisor,imgproxy,storage-api
41+
3942
- name: Run Tests
4043
run: make run_tests
4144

4245
- name: Upload coverage to Coveralls
43-
if: ${{ matrix.python-version }} == "3.12"
4446
uses: coverallsapp/github-action@v2
4547
with:
4648
github-token: ${{ secrets.GITHUB_TOKEN }}
@@ -49,6 +51,7 @@ jobs:
4951

5052
finish_tests:
5153
needs: test
54+
name: Upload tests coveralls results
5255
if: ${{ always() }}
5356
runs-on: ubuntu-latest
5457
steps:
@@ -57,7 +60,7 @@ jobs:
5760
with:
5861
github-token: ${{ secrets.GITHUB_TOKEN }}
5962
parallel-finished: true
60-
carryforward: "run-3.9,run-3.10,run-3.11,run-3.12,run-3.13"
63+
carryforward: "run-ubuntu-latest-3.9,run-ubuntu-latest-3.10,run-ubuntu-latest-3.11,run-ubuntu-latest-3.12,run-ubuntu-latest-3.13"
6164

6265
release-please:
6366
needs: test

Makefile

+11-7
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,18 @@ tests: install tests_only tests_pre_commit
1010
tests_pre_commit:
1111
poetry run pre-commit run --all-files
1212

13+
run_infra:
14+
npx supabase start --workdir infra -x studio,inbucket,edge-runtime,logflare,vector,supavisor,imgproxy,storage-api
15+
16+
stop_infra:
17+
npx supabase --workdir infra stop
18+
1319
run_tests: tests
1420

15-
setup_test_infra:
16-
supabase start --workdir tests
17-
supabase db reset --workdir tests
18-
supabase status --workdir tests -o env > tests/.env \
19-
--override-name auth.anon_key=SUPABASE_ANON_KEY \
20-
--override-name api.url=SUPABASE_URL
21+
local_tests: run_infra sleep tests
2122

22-
tests_only: setup_test_infra
23+
tests_only:
2324
poetry run pytest --cov=./ --cov-report=xml --cov-report=html -vv
25+
26+
sleep:
27+
sleep 2
File renamed without changes.
File renamed without changes.
File renamed without changes.

tests/test_presence.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,17 @@
1010

1111
load_dotenv()
1212

13+
URL = os.getenv("SUPABASE_URL") or "http://127.0.0.1:54321"
14+
ANON_KEY = (
15+
os.getenv("SUPABASE_ANON_KEY")
16+
or "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZS1kZW1vIiwicm9sZSI6ImFub24iLCJleHAiOjE5ODM4MTI5OTZ9.CRXP1A7WOeoJeXxjNni43kdQwgnWNReilDMblYTn_I0"
17+
)
18+
1319

1420
@pytest.fixture
1521
def socket() -> AsyncRealtimeClient:
16-
url = os.getenv("SUPABASE_URL")
17-
url = f"{url}/realtime/v1"
18-
key = os.getenv("SUPABASE_ANON_KEY")
19-
return AsyncRealtimeClient(url, key)
22+
url = f"{URL}/realtime/v1"
23+
return AsyncRealtimeClient(url, ANON_KEY)
2024

2125

2226
@pytest.mark.asyncio

0 commit comments

Comments
 (0)