db(couchdb): auto-provision databases on startup for production strategy; add TokenService with CouchDB-backed token storage and localStorage fallback; switch OAuth to unified config for client IDs and redirect URI; express Request typing for req.user; align exportAsEnvVars with show-config expectations; remove Vite importmap from index.html; prefer babel-jest over ts-jest; remove duplicate uuid mocking from Jest config
This commit is contained in:
81
.github/workflows/test-integration.yml
vendored
Normal file
81
.github/workflows/test-integration.yml
vendored
Normal file
@@ -0,0 +1,81 @@
|
||||
name: Integration Tests (CouchDB)
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
pull_request:
|
||||
branches: [main, develop]
|
||||
paths:
|
||||
- 'meds/**'
|
||||
push:
|
||||
branches: [main, develop]
|
||||
paths:
|
||||
- 'meds/**'
|
||||
|
||||
jobs:
|
||||
integration-tests:
|
||||
name: Run integration tests with CouchDB
|
||||
# Optional: run only when manually dispatched or when repo variable enables it
|
||||
if: ${{ github.event_name == 'workflow_dispatch' || vars.RUN_COUCHDB_INTEGRATION == 'true' }}
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 25
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
services:
|
||||
couchdb:
|
||||
image: couchdb:3
|
||||
ports:
|
||||
- 5984:5984
|
||||
env:
|
||||
COUCHDB_USER: admin
|
||||
COUCHDB_PASSWORD: password
|
||||
|
||||
env:
|
||||
# Point integration tests at the service container
|
||||
VITE_COUCHDB_URL: ${{ vars.VITE_COUCHDB_URL != '' && vars.VITE_COUCHDB_URL || 'http://couchdb:5984' }}
|
||||
VITE_COUCHDB_USER: ${{ vars.VITE_COUCHDB_USER != '' && vars.VITE_COUCHDB_USER || 'admin' }}
|
||||
VITE_COUCHDB_PASSWORD: ${{ secrets.VITE_COUCHDB_PASSWORD != '' && secrets.VITE_COUCHDB_PASSWORD || 'password' }}
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Bun
|
||||
uses: oven-sh/setup-bun@v1
|
||||
with:
|
||||
bun-version: latest
|
||||
|
||||
- name: Install dependencies
|
||||
working-directory: meds
|
||||
run: bun install --frozen-lockfile
|
||||
|
||||
- name: Wait for CouchDB to be ready
|
||||
run: |
|
||||
echo "Waiting for CouchDB at ${VITE_COUCHDB_URL} ..."
|
||||
for i in {1..60}; do
|
||||
if curl -fsS "${VITE_COUCHDB_URL}/" >/dev/null 2>&1; then
|
||||
echo "CouchDB is up!"
|
||||
break
|
||||
else
|
||||
echo "Attempt $i: CouchDB not ready, retrying..."
|
||||
sleep 2
|
||||
fi
|
||||
done
|
||||
echo "Checking authentication and DB listing..."
|
||||
curl -fsS -u "${VITE_COUCHDB_USER}:${VITE_COUCHDB_PASSWORD}" "${VITE_COUCHDB_URL}/_all_dbs" >/dev/null
|
||||
|
||||
- name: Run integration tests
|
||||
working-directory: meds
|
||||
env:
|
||||
# Ensure tests target CouchDB and not the mock
|
||||
USE_MOCK_DB: 'false'
|
||||
run: bun run test:integration
|
||||
|
||||
- name: Upload Jest coverage (if present)
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: jest-coverage
|
||||
path: |
|
||||
meds/coverage
|
||||
if-no-files-found: ignore
|
||||
Reference in New Issue
Block a user