Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 0 additions & 39 deletions .github/workflows/lint-and-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,25 +10,6 @@ on:
jobs:
lint_and_test:
runs-on: ubuntu-latest

services:
postgres:
image: postgres:latest
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: secret
POSTGRES_DB: project
options: >-
--health-cmd "pg_isready -U postgres"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432

env:
DATABASE_URL: postgresql://postgres:secret@localhost:5432/project

steps:
- name: Checkout repo
uses: actions/checkout@v6
Expand All @@ -47,23 +28,3 @@ jobs:
- name: Run lint ✅
run: pnpm lint

- name: Run unit tests ✅
run: pnpm test

# - name: Setup database
# run: |
# sudo apt-get update
# sudo apt-get install -y postgresql-client

# until pg_isready -h localhost -p 5432 -U postgres; do
# echo "Waiting for Pg..."
# sleep 2
# done

# PGPASSWORD=secret psql -h localhost -U postgres -d project -c "CREATE EXTENSION fuzzystrmatch;"

- name: Run db:migration 🆙
run: pnpm db:migrate:up

- name: Run integration tests ✅
run: pnpm test:integration
8 changes: 4 additions & 4 deletions src/app/services/docker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export class DockerService {
try {
output = JSON.parse(result.stdout)
} catch (e) {
throw new Error(`Failed to parse script output: Invalid JSON response`)
throw new Error(`Failed to parse script output: Invalid JSON response`, { cause: e })
}

return {
Expand Down Expand Up @@ -76,7 +76,7 @@ export class DockerService {
try {
output = JSON.parse(result.stdout)
} catch (e) {
throw new Error(`Failed to parse script output: Invalid JSON response`)
throw new Error(`Failed to parse script output: Invalid JSON response`, { cause: e })
}

return {
Expand All @@ -99,7 +99,7 @@ export class DockerService {
try {
inspect = JSON.parse(result.stdout)
} catch (e) {
throw new Error(`Failed to parse container data: Invalid JSON response`)
throw new Error(`Failed to parse container data: Invalid JSON response`, { cause: e })
}
const status = inspect.State.Status

Expand Down Expand Up @@ -145,7 +145,7 @@ export class DockerService {
try {
container = JSON.parse(line)
} catch (e) {
throw new Error(`Failed to parse container data: Invalid JSON response`)
throw new Error(`Failed to parse container data: Invalid JSON response`, { cause: e })
}
return {
id: container.ID.substring(0, 12),
Expand Down
3 changes: 2 additions & 1 deletion src/lib/middleware/auth.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Context, Next } from 'hono';
import { timingSafeEqual as cryptoTimingSafeEqual } from 'crypto';

function timingSafeEqual(a: string, b: string): boolean {
if (a.length !== b.length) {
Expand All @@ -9,7 +10,7 @@ function timingSafeEqual(a: string, b: string): boolean {
const bufferB = Buffer.from(b, 'utf8');

try {
return require('crypto').timingSafeEqual(bufferA, bufferB);
return cryptoTimingSafeEqual(bufferA, bufferB);
} catch {
return false;
}
Expand Down