Skip to content

Commit

Permalink
feat: add test for adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
tony-stark-eth committed Sep 27, 2024
1 parent 804e7ae commit 2a758af
Show file tree
Hide file tree
Showing 8 changed files with 1,396 additions and 30 deletions.
85 changes: 85 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: CI
on:
workflow_dispatch:
pull_request:
types:
- opened
- reopened
- synchronize
paths-ignore:
- '.github/**'
- '!.github/workflows/ci.yaml'
- '.gitignore'
- '**.md'

push:
branches:
- main
- release@*
paths-ignore:
- '.github/**'
- '!.github/workflows/ci.yaml'
- '.gitignore'
- '**.md'

concurrency:
# Documentation suggests ${{ github.head_ref }}, but that's only available on pull_request/pull_request_target triggers, so using ${{ github.ref }}.
# On main, we want all builds to complete even if merging happens faster to make it easier to discover at which point something broke.
group: ci-${{ github.ref_name == 'main' && format('ci-main-{0}', github.sha) || format('ci-{0}', github.ref) }}
cancel-in-progress: true

permissions:
contents: read
id-token: write

jobs:
code-style:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Check Out
uses: actions/checkout@v4

- name: Use Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20

- name: Enable corepack
run: |
corepack enable
corepack prepare pnpm@latest --activate
- name: Install deps
run: pnpm install --frozen-lockfile

- name: Run Code Style Check
run: pnpm run lint

tests:
runs-on: ubuntu-latest
timeout-minutes: 25
steps:
- name: Check Out
uses: actions/checkout@v4

- name: Use Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20

- name: Enable corepack
run: |
corepack enable
corepack prepare pnpm@latest --activate
- name: Install deps
run: pnpm install --frozen-lockfile

- name: Start Docker Compose Services
shell: bash
run: |
docker compose up -d --no-build --no-deps --quiet-pull --wait
- name: Run Test Suite
run: pnpm run test
15 changes: 15 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
services:
database:
image: postgres
restart: always
environment:
POSTGRES_USER: ${DATABASE_USER:-lucia}
POSTGRES_PASSWORD: ${DATABASE_PASSWORD:-lucia}
POSTGRES_DB: ${DATABASE_NAME:-lucia}
ports:
- "5432:5432"
volumes:
- database:/var/lib/postgresql/data -
volumes:
database:
driver: local
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
".": "./dist/index.js"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"test": "tsx tests/mikro-orm-postgres.ts",
"build": "pnpm run lint:fix && tsc && tsc-alias",
"release": "pnpm run lint:fix && release-it",
"lint": "pnpm run lint:base -- .",
Expand Down Expand Up @@ -44,7 +44,9 @@
},
"devDependencies": {
"@eslint/js": "^9.11.1",
"@mikro-orm/core": "^6.3.10",
"@lucia-auth/adapter-test": "^5.0.1",
"@mikro-orm/core": "^6.3.11",
"@mikro-orm/postgresql": "^6.3.11",
"@stylistic/eslint-plugin": "^2.8.0",
"@types/eslint__js": "^8.42.3",
"@types/node": "^22.7.1",
Expand All @@ -54,6 +56,7 @@
"release-it": "^17.6.0",
"release-it-pnpm": "^4.6.3",
"tsc-alias": "^1.8.10",
"tsx": "^4.19.1",
"typescript": "^5.6.2",
"typescript-eslint": "^8.7.0"
},
Expand Down
Loading

0 comments on commit 2a758af

Please sign in to comment.