Skip to content

Refactor: Update CI workflow and configuration for PostgreSQL and Cli… #52

Refactor: Update CI workflow and configuration for PostgreSQL and Cli…

Refactor: Update CI workflow and configuration for PostgreSQL and Cli… #52

Workflow file for this run

name: Deployment Stacks
on:
push:
paths:
- 'deploy/**'
pull_request:
paths:
- 'deploy/**'
jobs:
deploy-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Bun
uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Install UV
uses: astral-sh/setup-uv@v3
- name: Install dependencies
run: |
bun install
uv venv
. .venv/bin/activate
- name: Setup config
run: |
cp config.example.yaml config.yaml
bun run build:config
- name: Create Docker network
run: docker network create eda-network || true
- name: Find and process deploy directories
run: |
# Create dirs file
touch $GITHUB_WORKSPACE/deploy_dirs.txt
for dir in deploy/*/; do
if [ -d "$dir" ]; then
echo "Processing $dir"
cd "$dir"
# Generate env from config
bun run export-config.ts > .env
# Start containers
docker compose up -d
# Store directory
echo "${dir%/}" >> $GITHUB_WORKSPACE/deploy_dirs.txt
cd $GITHUB_WORKSPACE
fi
done
- name: Wait for services to be ready
run: sleep 50
- name: Test endpoints
run: |
while IFS= read -r dir; do
echo "Testing endpoints for $dir"
service_name=$(basename "$dir")
port=$(bun run @eda/config getPorts $service_name)
if [ -z "$port" ]; then
echo "No port found for $service_name in config, using default 3000"
port=3000
fi
test_url="http://localhost:${port}/"
echo "Testing URL: $test_url"
curl --fail --retry 3 --retry-delay 5 "$test_url" || {
echo "Failed to reach $test_url for $service_name"
exit 1
}
done < $GITHUB_WORKSPACE/deploy_dirs.txt
- name: Cleanup
if: always()
run: |
if [ -f "$GITHUB_WORKSPACE/deploy_dirs.txt" ]; then
while IFS= read -r dir; do
cd "$dir"
docker compose down
cd $GITHUB_WORKSPACE
done < $GITHUB_WORKSPACE/deploy_dirs.txt
fi