Skip to content

Commit 91bd99e

Browse files
committed
fix: run tests with orioledb
Signed-off-by: ferhat elmas <elmas.ferhat@gmail.com>
1 parent bb602aa commit 91bd99e

File tree

2 files changed

+96
-70
lines changed

2 files changed

+96
-70
lines changed

.github/workflows/ci.yml

Lines changed: 95 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,10 @@ concurrency:
1515
cancel-in-progress: true
1616

1717
jobs:
18-
test:
19-
name: Test / OS ${{ matrix.platform }} / Node ${{ matrix.node }}
20-
strategy:
21-
fail-fast: false
22-
matrix:
23-
platform: [ubuntu-24.04]
24-
node: ["24"]
25-
26-
runs-on: ${{ matrix.platform }}
27-
timeout-minutes: 15
28-
18+
lint_build:
19+
name: Lint & Build
20+
runs-on: ubuntu-24.04
21+
timeout-minutes: 10
2922
steps:
3023
- uses: actions/checkout@v6
3124
- uses: actions/cache@v5
@@ -37,61 +30,71 @@ jobs:
3730
- name: Set up Node
3831
uses: actions/setup-node@v6
3932
with:
40-
node-version: ${{ matrix.node }}
41-
33+
node-version: "24"
4234
- name: Install dependencies
43-
run: |
44-
npm ci
45-
35+
run: npm ci
4636
- name: Lint
47-
run: |
48-
npm run lint
49-
50-
- name: Builds successfully
51-
run: |
52-
npm run build
53-
37+
run: npm run lint
38+
- name: Build
39+
run: npm run build
40+
41+
test_postgres:
42+
name: Test / Postgres
43+
runs-on: ubuntu-24.04
44+
timeout-minutes: 30
45+
env: &test_env
46+
ANON_KEY: ${{ secrets.ANON_KEY }}
47+
SERVICE_KEY: ${{ secrets.SERVICE_KEY }}
48+
TENANT_ID: ${{ secrets.TENANT_ID }}
49+
REGION: ${{ secrets.REGION }}
50+
GLOBAL_S3_BUCKET: ${{ secrets.GLOBAL_S3_BUCKET }}
51+
PGRST_JWT_SECRET: ${{ secrets.PGRST_JWT_SECRET }}
52+
AUTHENTICATED_KEY: ${{ secrets.AUTHENTICATED_KEY }}
53+
DATABASE_URL: postgresql://postgres:postgres@127.0.0.1/postgres
54+
FILE_SIZE_LIMIT: "52428800"
55+
STORAGE_BACKEND: s3
56+
MULTITENANT_DATABASE_URL: postgresql://postgres:postgres@127.0.0.1:5433/postgres
57+
ADMIN_API_KEYS: apikey
58+
ENABLE_IMAGE_TRANSFORMATION: true
59+
IMGPROXY_URL: http://127.0.0.1:50020
60+
AWS_ACCESS_KEY_ID: supa-storage
61+
AWS_SECRET_ACCESS_KEY: secret1234
62+
AWS_DEFAULT_REGION: ap-southeast-1
63+
GLOBAL_S3_ENDPOINT: http://127.0.0.1:9000
64+
GLOBAL_S3_PROTOCOL: http
65+
GLOBAL_S3_FORCE_PATH_STYLE: true
66+
DB_INSTALL_ROLES: true
67+
PG_QUEUE_ENABLE: false
68+
MULTI_TENANT: false
69+
S3_PROTOCOL_ACCESS_KEY_ID: ${{ secrets.TENANT_ID }}
70+
S3_PROTOCOL_ACCESS_KEY_SECRET: ${{ secrets.SERVICE_KEY }}
71+
VECTOR_S3_BUCKETS: supa-test-local-dev
72+
VECTOR_ENABLED: true
73+
ICEBERG_ENABLED: true
74+
steps:
75+
- uses: actions/checkout@v6
76+
- uses: actions/cache@v5
77+
with:
78+
path: ~/.npm
79+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
80+
restore-keys: |
81+
${{ runner.os }}-node-
82+
- name: Set up Node
83+
uses: actions/setup-node@v6
84+
with:
85+
node-version: "24"
86+
- name: Install dependencies
87+
run: npm ci
5488
- name: Tests pass
5589
run: |
56-
mkdir data && chmod -R 777 data && \
90+
mkdir -p data && chmod -R 777 data && \
5791
npm run test:coverage
58-
env:
59-
ANON_KEY: ${{ secrets.ANON_KEY }}
60-
SERVICE_KEY: ${{ secrets.SERVICE_KEY }}
61-
TENANT_ID: ${{ secrets.TENANT_ID }}
62-
REGION: ${{ secrets.REGION }}
63-
GLOBAL_S3_BUCKET: ${{ secrets.GLOBAL_S3_BUCKET }}
64-
PGRST_JWT_SECRET: ${{ secrets.PGRST_JWT_SECRET }}
65-
AUTHENTICATED_KEY: ${{ secrets.AUTHENTICATED_KEY }}
66-
DATABASE_URL: postgresql://postgres:postgres@127.0.0.1/postgres
67-
FILE_SIZE_LIMIT: "52428800"
68-
STORAGE_BACKEND: s3
69-
MULTITENANT_DATABASE_URL: postgresql://postgres:postgres@127.0.0.1:5433/postgres
70-
ADMIN_API_KEYS: apikey
71-
ENABLE_IMAGE_TRANSFORMATION: true
72-
IMGPROXY_URL: http://127.0.0.1:50020
73-
AWS_ACCESS_KEY_ID: supa-storage
74-
AWS_SECRET_ACCESS_KEY: secret1234
75-
AWS_DEFAULT_REGION: ap-southeast-1
76-
GLOBAL_S3_ENDPOINT: http://127.0.0.1:9000
77-
GLOBAL_S3_PROTOCOL: http
78-
GLOBAL_S3_FORCE_PATH_STYLE: true
79-
DB_INSTALL_ROLES: true
80-
PG_QUEUE_ENABLE: false
81-
MULTI_TENANT: false
82-
S3_PROTOCOL_ACCESS_KEY_ID: ${{ secrets.TENANT_ID }}
83-
S3_PROTOCOL_ACCESS_KEY_SECRET: ${{ secrets.SERVICE_KEY }}
84-
VECTOR_S3_BUCKETS: supa-test-local-dev
85-
VECTOR_ENABLED: true
86-
ICEBERG_ENABLED: true
87-
8892
- name: Upload coverage results to Coveralls
8993
uses: coverallsapp/github-action@5cbfd81b66ca5d10c19b062c04de0199c215fb6e # v2.3.7
9094
with:
9195
github-token: ${{ secrets.GITHUB_TOKEN }}
9296
fail-on-error: false
9397
continue-on-error: true
94-
9598
- name: Verify migration idempotency
9699
run: |
97100
pg_dump "$DATABASE_URL" \
@@ -108,19 +111,41 @@ jobs:
108111
109112
diff before.sql after.sql || (echo 'Schema mismatch!'; exit 1)
110113
111-
env:
112-
PGRST_JWT_SECRET: ${{ secrets.PGRST_JWT_SECRET }}
113-
DATABASE_URL: postgresql://postgres:postgres@127.0.0.1/postgres
114-
DB_INSTALL_ROLES: true
115-
PG_QUEUE_ENABLE: false
116-
MULTI_TENANT: false
117-
118-
- name: Ensure OrioleDB migration compatibility
114+
test_oriole:
115+
name: Test / OrioleDB
116+
runs-on: ubuntu-24.04
117+
timeout-minutes: 30
118+
env: *test_env
119+
steps:
120+
- uses: actions/checkout@v6
121+
- uses: actions/cache@v5
122+
with:
123+
path: ~/.npm
124+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
125+
restore-keys: |
126+
${{ runner.os }}-node-
127+
- name: Set up Node
128+
uses: actions/setup-node@v6
129+
with:
130+
node-version: "24"
131+
- name: Install dependencies
132+
run: npm ci
133+
- name: Tests pass with OrioleDB
119134
run: |
120-
npm run infra:restart:oriole
121-
env:
122-
PGRST_JWT_SECRET: ${{ secrets.PGRST_JWT_SECRET }}
123-
DATABASE_URL: postgresql://postgres:postgres@127.0.0.1/postgres
124-
DB_INSTALL_ROLES: true
125-
PG_QUEUE_ENABLE: false
126-
MULTI_TENANT: false
135+
mkdir -p data && chmod -R 777 data && \
136+
npm run test:oriole
137+
- name: Verify OrioleDB migration idempotency
138+
run: |
139+
pg_dump "$DATABASE_URL" \
140+
--exclude-table-data=storage.migrations \
141+
--restrict-key=test \
142+
> before-oriole.sql
143+
144+
npm run migration:test-idempotency
145+
146+
pg_dump "$DATABASE_URL" \
147+
--exclude-table-data=storage.migrations \
148+
--restrict-key=test \
149+
> after-oriole.sql
150+
151+
diff before-oriole.sql after-oriole.sql || (echo 'Oriole schema mismatch!'; exit 1)

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
"docs:export": "tsx ./src/scripts/export-docs.ts",
1717
"test:dummy-data": "tsx -r dotenv/config ./src/test/db/import-dummy-data.ts",
1818
"test": "npm run infra:restart && npm run test:dummy-data && jest --no-cache --runInBand",
19+
"test:oriole": "npm run infra:restart:oriole && npm run test:dummy-data && jest --no-cache --runInBand --testPathIgnorePatterns=src/test/vectors.test.ts",
1920
"test:coverage": "npm run infra:restart && npm run test:dummy-data && jest --no-cache --runInBand --coverage",
2021
"infra:stop": "docker compose --project-directory . -f ./.docker/docker-compose-infra.yml down --remove-orphans",
2122
"infra:start": "docker compose --project-directory . -f ./.docker/docker-compose-infra.yml up -d && sleep 5 && npm run migration:run",

0 commit comments

Comments
 (0)