feat(ci): enhance installer smoke tests for macOS and Linux with improved readiness checks
This commit is contained in:
126
.github/workflows/ci.yml
vendored
126
.github/workflows/ci.yml
vendored
@@ -144,9 +144,11 @@ jobs:
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-latest
|
||||
run_smoke_tests: true
|
||||
run_linux_smoke_tests: true
|
||||
run_macos_local_smoke_test: false
|
||||
- os: macos-latest
|
||||
run_smoke_tests: false
|
||||
run_linux_smoke_tests: false
|
||||
run_macos_local_smoke_test: true
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
@@ -155,8 +157,52 @@ jobs:
|
||||
- name: Validate installer shell syntax
|
||||
run: bash -n install.sh
|
||||
|
||||
- name: Set up Python for macOS installer smoke test
|
||||
if: ${{ matrix.run_macos_local_smoke_test }}
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.12"
|
||||
|
||||
- name: Install uv for macOS installer smoke test
|
||||
if: ${{ matrix.run_macos_local_smoke_test }}
|
||||
run: python -m pip install --upgrade pip uv
|
||||
|
||||
- name: Set up Node for macOS installer smoke test
|
||||
if: ${{ matrix.run_macos_local_smoke_test }}
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "22"
|
||||
|
||||
- name: Start PostgreSQL for macOS installer smoke test
|
||||
if: ${{ matrix.run_macos_local_smoke_test }}
|
||||
run: |
|
||||
brew install postgresql@16
|
||||
PG_BIN="$(brew --prefix postgresql@16)/bin"
|
||||
"$PG_BIN/initdb" -D "$RUNNER_TEMP/pgdata"
|
||||
"$PG_BIN/pg_ctl" -D "$RUNNER_TEMP/pgdata" -l "$RUNNER_TEMP/postgres.log" -o "-p 55432" start
|
||||
"$PG_BIN/createdb" -p 55432 mission_control
|
||||
|
||||
- name: Installer smoke test (macOS local mode + external db)
|
||||
if: ${{ matrix.run_macos_local_smoke_test }}
|
||||
run: |
|
||||
PGUSER="$(whoami)"
|
||||
./install.sh \
|
||||
--mode local \
|
||||
--backend-port 18002 \
|
||||
--frontend-port 13002 \
|
||||
--public-host localhost \
|
||||
--api-url http://localhost:18002 \
|
||||
--token-mode generate \
|
||||
--db-mode external \
|
||||
--database-url "postgresql+psycopg://${PGUSER}@localhost:55432/mission_control" \
|
||||
--start-services no
|
||||
test -f .env
|
||||
test -f backend/.env
|
||||
test -f frontend/.env
|
||||
test -f frontend/.next/BUILD_ID
|
||||
|
||||
- name: Installer smoke test (docker mode)
|
||||
if: ${{ matrix.run_smoke_tests }}
|
||||
if: ${{ matrix.run_linux_smoke_tests }}
|
||||
run: |
|
||||
./install.sh \
|
||||
--mode docker \
|
||||
@@ -165,16 +211,39 @@ jobs:
|
||||
--public-host localhost \
|
||||
--api-url http://localhost:18000 \
|
||||
--token-mode generate
|
||||
curl -fsS http://127.0.0.1:18000/healthz >/dev/null
|
||||
curl -fsS http://127.0.0.1:13000 >/dev/null
|
||||
|
||||
backend_ready=0
|
||||
for _ in {1..120}; do
|
||||
if curl -fsS http://127.0.0.1:18000/healthz >/dev/null; then
|
||||
backend_ready=1
|
||||
break
|
||||
fi
|
||||
sleep 2
|
||||
done
|
||||
|
||||
frontend_ready=0
|
||||
for _ in {1..120}; do
|
||||
if curl -fsS http://127.0.0.1:13000 >/dev/null; then
|
||||
frontend_ready=1
|
||||
break
|
||||
fi
|
||||
sleep 2
|
||||
done
|
||||
|
||||
if [ "$backend_ready" -ne 1 ] || [ "$frontend_ready" -ne 1 ]; then
|
||||
echo "Installer docker smoke readiness failed: backend_ready=$backend_ready frontend_ready=$frontend_ready"
|
||||
docker compose -f compose.yml --env-file .env ps || true
|
||||
docker compose -f compose.yml --env-file .env logs --no-color --tail=200 backend db redis frontend webhook-worker || true
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Cleanup docker stack after docker mode
|
||||
if: ${{ always() && matrix.run_smoke_tests }}
|
||||
if: ${{ always() && matrix.run_linux_smoke_tests }}
|
||||
run: |
|
||||
docker compose -f compose.yml --env-file .env down -v --remove-orphans || true
|
||||
|
||||
- name: Installer smoke test (local mode)
|
||||
if: ${{ matrix.run_smoke_tests }}
|
||||
if: ${{ matrix.run_linux_smoke_tests }}
|
||||
run: |
|
||||
./install.sh \
|
||||
--mode local \
|
||||
@@ -185,16 +254,53 @@ jobs:
|
||||
--token-mode generate \
|
||||
--db-mode docker \
|
||||
--start-services yes
|
||||
curl -fsS http://127.0.0.1:18001/healthz >/dev/null
|
||||
curl -fsS http://127.0.0.1:13001 >/dev/null
|
||||
|
||||
backend_ready=0
|
||||
for _ in {1..120}; do
|
||||
if curl -fsS http://127.0.0.1:18001/healthz >/dev/null; then
|
||||
backend_ready=1
|
||||
break
|
||||
fi
|
||||
sleep 2
|
||||
done
|
||||
|
||||
frontend_ready=0
|
||||
for _ in {1..120}; do
|
||||
if curl -fsS http://127.0.0.1:13001 >/dev/null; then
|
||||
frontend_ready=1
|
||||
break
|
||||
fi
|
||||
sleep 2
|
||||
done
|
||||
|
||||
if [ "$backend_ready" -ne 1 ] || [ "$frontend_ready" -ne 1 ]; then
|
||||
echo "Installer local smoke readiness failed: backend_ready=$backend_ready frontend_ready=$frontend_ready"
|
||||
if [ -f .install-logs/backend.log ]; then
|
||||
echo "----- backend log (tail) -----"
|
||||
tail -n 200 .install-logs/backend.log || true
|
||||
fi
|
||||
if [ -f .install-logs/frontend.log ]; then
|
||||
echo "----- frontend log (tail) -----"
|
||||
tail -n 200 .install-logs/frontend.log || true
|
||||
fi
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Cleanup local processes and docker resources
|
||||
if: ${{ always() && matrix.run_smoke_tests }}
|
||||
if: ${{ always() && matrix.run_linux_smoke_tests }}
|
||||
run: |
|
||||
if [ -f .install-logs/backend.pid ]; then kill "$(cat .install-logs/backend.pid)" || true; fi
|
||||
if [ -f .install-logs/frontend.pid ]; then kill "$(cat .install-logs/frontend.pid)" || true; fi
|
||||
docker compose -f compose.yml --env-file .env down -v --remove-orphans || true
|
||||
|
||||
- name: Cleanup macOS PostgreSQL
|
||||
if: ${{ always() && matrix.run_macos_local_smoke_test }}
|
||||
run: |
|
||||
PG_BIN="$(brew --prefix postgresql@16)/bin"
|
||||
if [ -d "$RUNNER_TEMP/pgdata" ]; then
|
||||
"$PG_BIN/pg_ctl" -D "$RUNNER_TEMP/pgdata" -m fast stop || true
|
||||
fi
|
||||
|
||||
e2e:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [check]
|
||||
|
||||
Reference in New Issue
Block a user