Skip to content
112 changes: 69 additions & 43 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,91 +20,117 @@ on:

jobs:
test:
name: Test / OS ${{ matrix.os }} / Node ${{ matrix.node }}
name: Unit + Type Check / Node.js ${{ matrix.node }}
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest]
node: ['20']

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4

- name: Set up Node
uses: actions/setup-node@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}

- name: Run tests
run: |
npm clean-install
npm run test:coverage
- run: npm clean-install

- name: Type Check
run: npm run test:types

- name: Run Unit Tests + Coverage
run: npm run test:coverage

- name: Upload coverage results to Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./test/coverage/lcov.info

integration:
name: Integration / OS ${{ matrix.os }} / Node ${{ matrix.node }} / Deno ${{ matrix.deno }}
deno-tests:
name: Deno Tests / ${{ matrix.deno }}
runs-on: ubuntu-latest
strategy:
matrix:
os: [ubuntu-latest]
node: ['20']
deno: ['1.x', '2.x']

runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v4

- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}

- uses: denoland/setup-deno@v2
with:
deno-version: ${{ matrix.deno }}

- name: Setup Supabase
uses: supabase/setup-cli@v1
- uses: supabase/setup-cli@v1
with:
version: latest

- name: Start Supabase
run: |
supabase start
run: supabase start

- name: Build
- name: Run Deno Tests
run: |
npm clean-install
npm run build
npm pack
cd test/deno
npm install
npm test || npm test

- name: Run integration tests
- name: Run integration and browser tests on Deno 2.x only
if: ${{ matrix.deno == '2.x' }}
run: |
npm run test:integration || npm run test:integration
npm run test:integration:browser

- name: Stop Supabase
run: supabase stop

node-integration:
name: Node Integration
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- uses: supabase/setup-cli@v1
with:
version: latest

- name: Run browser integration tests
- name: Start Supabase
run: supabase start

- name: Run integration tests
run: |
npm run test:integration:browser
npm clean-install
npm run build
npm run test:integration || npm run test:integration

- name: Stop Supabase
run: supabase stop

expo-tests:
name: Expo Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
- uses: supabase/setup-cli@v1
with:
version: latest

- name: Run Deno tests
- name: Start Supabase
run: |
cd test/deno
npm test || npm test
supabase start

- name: Run expo compatibility tests
- name: Build and test expo
run: |
npm clean-install
npm run build
PKG=$(npm pack)
echo "Packed: $PKG"
cd examples/expo-app
npm install "../../$PKG"
npm install
# make sure we're using the version that was just packed above
npm update @supabase/supabase-js
npm run test || npm run test
npm test || npm test

- name: Stop Supabase
run: |
supabase stop
run: supabase stop
1 change: 1 addition & 0 deletions examples/expo-app/jest.setup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
global.WebSocket = require('ws')
21 changes: 11 additions & 10 deletions examples/expo-app/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions examples/expo-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,21 @@
},
"devDependencies": {
"@babel/core": "^7.25.2",
"@testing-library/react-native": "^13.2.0",
"@types/jest": "^29.5.14",
"@types/react": "~19.1.0",
"eslint": "^9.25.0",
"eslint-config-expo": "~9.2.0",
"jest": "~29.7.0",
"jest-expo": "~53.0.5",
"typescript": "~5.8.3",
"@testing-library/react-native": "^13.2.0"
"ws": "^8.18.2"
},
"private": true,
"jest": {
"preset": "jest-expo"
"preset": "jest-expo",
"setupFiles": [
"./jest.setup.js"
]
}
}