Skip to content

chore: plant the seeds for EdgeHog’s journey #1

chore: plant the seeds for EdgeHog’s journey

chore: plant the seeds for EdgeHog’s journey #1

Workflow file for this run

name: Test
on:
push:
branches: [main, gh-pages]
pull_request:
branches: [main]
# Cancel previous runs of the same workflow
concurrency:
group: test-${{ github.ref }}
cancel-in-progress: true
env:
POSTGRESQL_VERSION: 17
TIMESCALEDB_VERSION: "pg17"
jobs:
# Test with Bun (primary test runner)
test-bun:
name: Test (Bun ${{ matrix.bun-version }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
bun-version: ["1.3", "latest"]
exclude:
# Skip some combinations to save CI time
- os: macos-latest
bun-version: "1.3"
- os: macos-latest
bun-version: "latest"
services:
postgres:
image: timescale/timescaledb-ha:pg17
env:
POSTGRES_DB: edgehog_test
POSTGRES_HOST_AUTH_METHOD: trust
options: >-
--health-cmd "pg_isready -U postgres"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v4
- name: Install PostgreSQL client
run: |
if [ "${{ matrix.os }}" = "ubuntu-latest" ]; then
sudo apt-get update && sudo apt-get install -y postgresql-client-17
elif [ "${{ matrix.os }}" = "macos-latest" ]; then
brew install libpq@17
fi
- uses: oven-sh/setup-bun@v2
with: { bun-version: "${{ matrix.bun-version }}" }
- run: bun install --frozen-lockfile
- run: bun run build
- name: Verify build artifacts
run: |
if [ ! -d "packages/db/dist" ]; then
echo "❌ @edgehog/db dist/ directory not created"
ls -la packages/db/ 2>/dev/null || echo "packages/db directory listing failed"
exit 1
fi
echo "✅ Build artifacts verified"
ls -la packages/db/dist/ | head -20
- run: bun test
env:
DATABASE_URL: postgresql://postgres@localhost:5432/edgehog_test
TEST_DATABASE_URL: postgresql://postgres@localhost:5432/edgehog_test
- uses: actions/upload-artifact@v4
if: always()
with:
name: bun-test-results-${{ matrix.os }}-${{ matrix.bun-version }}
path: |
coverage/
test-results/
if-no-files-found: ignore
# Test Node.js compatibility
test-node:
name: Test (Node ${{ matrix.node-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
node-version: [22]
services:
postgres:
image: timescale/timescaledb-ha:pg17
env:
POSTGRES_DB: edgehog_test
POSTGRES_HOST_AUTH_METHOD: trust
options: >-
--health-cmd "pg_isready -U postgres"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v4
- name: Install PostgreSQL client
run: sudo apt-get update && sudo apt-get install -y postgresql-client-17
- uses: actions/setup-node@v4
with: { node-version: "${{ matrix.node-version }}" }
- uses: oven-sh/setup-bun@v2
- run: bun install --frozen-lockfile
- run: bun run build
- name: Verify build artifacts
run: |
if [ ! -d "packages/db/dist" ]; then
echo "❌ @edgehog/db dist/ directory not created"
ls -la packages/db/ 2>/dev/null || echo "packages/db directory listing failed"
exit 1
fi
echo "✅ Build artifacts verified"
ls -la packages/db/dist/ | head -20
- run: bun test --grep "Node.js"
env:
DATABASE_URL: postgresql://postgres@localhost:5432/edgehog_test
TEST_DATABASE_URL: postgresql://postgres@localhost:5432/edgehog_test
- name: Validate package exports (Node.js)
run: |
node --input-type=module -e "
import('@edgehog/db').then(m => {
if (m.getMigrationFiles) {
console.log('✓ @edgehog/db exports work in Node.js');
} else {
throw new Error('Missing exports');
}
}).catch(e => {
console.error('✗ Failed to import @edgehog/db in Node.js');
process.exit(1);
});
"
# Test Deno compatibility (optional but recommended)
test-deno:
name: Test (Deno)
runs-on: ubuntu-latest
services:
postgres:
image: timescale/timescaledb-ha:pg17
env:
POSTGRES_DB: edgehog_test
POSTGRES_HOST_AUTH_METHOD: trust
options: >-
--health-cmd "pg_isready -U postgres"
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v4
- name: Install PostgreSQL client
run: sudo apt-get update && sudo apt-get install -y postgresql-client-17
- uses: denoland/setup-deno@v2
with: { deno-version: lts }
- uses: oven-sh/setup-bun@v2
- run: bun install --frozen-lockfile
- run: bun run build
- name: Verify build artifacts
run: |
if [ ! -d "packages/db/dist" ]; then
echo "❌ @edgehog/db dist/ directory not created"
ls -la packages/db/ 2>/dev/null || echo "packages/db directory listing failed"
exit 1
fi
echo "✅ Build artifacts verified"
ls -la packages/db/dist/ | head -20
- run: bun test --grep "Deno"
env:
DATABASE_URL: postgresql://postgres@localhost:5432/edgehog_test
TEST_DATABASE_URL: postgresql://postgres@localhost:5432/edgehog_test
# Summary status check
test-results:
name: Test Results
runs-on: ubuntu-latest
needs: [test-bun, test-node, test-deno]
if: always()
steps:
- name: Check test results
run: |
echo "## Test Results Summary" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "- Bun: ${{ needs.test-bun.result }}" >> $GITHUB_STEP_SUMMARY
echo "- Node.js: ${{ needs.test-node.result }}" >> $GITHUB_STEP_SUMMARY
echo "- Deno: ${{ needs.test-deno.result }}" >> $GITHUB_STEP_SUMMARY
if [[ "${{ needs.test-bun.result }}" != "success" || "${{ needs.test-node.result }}" != "success" || "${{ needs.test-deno.result }}" != "success" ]]; then
exit 1
fi