Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
4c4a63d
rename for easier development + add db analysis scripts
andreas16700 Oct 19, 2025
4190fd7
update server for multiple testmon data entries
andreas16700 Oct 20, 2025
9d20c20
update gitignore
andreas16700 Oct 20, 2025
d5ddaaa
test deployment
andreas16700 Oct 20, 2025
fe8cbc6
actually test deployment
andreas16700 Oct 20, 2025
10b4b1a
add verbosity
andreas16700 Oct 20, 2025
1dd91c1
ignore comments for checksum
andreas16700 Oct 20, 2025
626ffeb
fix pathing for visualizer
andreas16700 Oct 20, 2025
ddcd4b6
excl
andreas16700 Oct 20, 2025
9032d57
add fingerprints demo
andreas16700 Oct 21, 2025
fb98b26
migration to react frontend
bilgehanAkcan Nov 1, 2025
7819e19
add react build dist folder
bilgehanAkcan Nov 1, 2025
08d80f4
bug fix and refactoring
bilgehanAkcan Nov 2, 2025
aa4ded4
fix assets route
bilgehanAkcan Nov 2, 2025
176cf5b
add js files to dist
bilgehanAkcan Nov 2, 2025
06c0791
app.py reverted
bilgehanAkcan Nov 2, 2025
93ff07f
bug fix
bilgehanAkcan Nov 2, 2025
c271830
build fail fix
bilgehanAkcan Nov 2, 2025
051ca29
bug fix
bilgehanAkcan Nov 2, 2025
1f75eaa
created endpoints in flusk for get and upload test preferences. Test …
emirhoca Nov 4, 2025
f895bb9
npm run bulild applied
emirhoca Nov 4, 2025
6bc577a
Merge branch 'frontend' into main
emirhoca Nov 4, 2025
92feb8c
test management fixed
emirhoca Nov 4, 2025
ecd3ffe
another try
emirhoca Nov 4, 2025
2a45203
another try
emirhoca Nov 4, 2025
5207941
Merge pull request #2
emirhoca Nov 4, 2025
af903b7
Revert "test management fixed"
emirhoca Nov 4, 2025
ac1c3b4
Merge pull request #3 from andreas16700/revert-2-frontend
emirhoca Nov 4, 2025
d0cca10
fix bugs
emirhoca Nov 4, 2025
7996d87
fix build bug
emirhoca Nov 4, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
147 changes: 147 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,147 @@
name: Deploy Testmon Server

on:
push:
branches: [main]
workflow_dispatch:

env:
APP_REPO_PATH: /Users/andreasloizides/pytest-testmon/ez-viz # ⬅️ change if needed
DEPLOY_STATE_DIR: /Users/andreasloizides/pytest-testmon/ez-viz.deploy-state
PM2_NAME: testmon-server # ⬅️ matches your PM2 app name
VENV_DIR: /Users/andreasloizides/pytest-testmon/ez-viz/.venv # ⬅️ your venv path
HEALTH_URL: http://127.0.0.1:8004/health

jobs:
deploy:
runs-on: self-hosted
defaults:
run:
working-directory: ${{ env.APP_REPO_PATH }}

steps:
- name: Update repository
run: |
echo "🔄 Updating repository..."
git fetch origin
git reset --hard origin/main
git clean -fd

- name: Ensure deploy state dir
run: mkdir -p "${{ env.DEPLOY_STATE_DIR }}"

- name: Detect backend changes since last success
id: changes
shell: bash
run: |
set -euo pipefail
CURRENT_COMMIT=$(git rev-parse HEAD)
LAST_SUCCESS_FILE="${{ env.DEPLOY_STATE_DIR }}/backend-success"
LAST_SUCCESS=""
if [[ -f "$LAST_SUCCESS_FILE" ]]; then
LAST_SUCCESS=$(cat "$LAST_SUCCESS_FILE" || true)
fi

# Patterns that affect backend runtime
# - python, gunicorn/pm2/ecosystem/configs, templates/static for Flask
CHANGED_FILES=""
if [[ -z "$LAST_SUCCESS" ]]; then
echo "No previous successful deploy; treating as changed."
CHANGED_FILES="(first deploy)"
else
CHANGED_FILES=$(git diff --name-only "$LAST_SUCCESS" "$CURRENT_COMMIT" | \
grep -E '\.(py)$|^requirements\.txt$|^ecosystem\.config\.(cjs|js)$|^app\.py$|^templates/|^static/' || true)
fi

if [[ -n "$CHANGED_FILES" ]]; then
echo "backend=true" >> "$GITHUB_OUTPUT"
echo "Changed files:"
echo "$CHANGED_FILES" | sed 's/^/ - /'
else
echo "backend=false" >> "$GITHUB_OUTPUT"
echo "📊 No backend changes since last successful deployment"
fi

# Did requirements.txt change?
if [[ -z "$LAST_SUCCESS" ]]; then
echo "deps=true" >> "$GITHUB_OUTPUT"
else
if git diff --name-only "$LAST_SUCCESS" "$CURRENT_COMMIT" | grep -q '^requirements\.txt$'; then
echo "deps=true" >> "$GITHUB_OUTPUT"
else
echo "deps=false" >> "$GITHUB_OUTPUT"
fi
fi

- name: Prepare venv & deps (if needed)
if: steps.changes.outputs.backend == 'true'
shell: bash
run: |
set -euo pipefail
# create venv if missing
if [[ ! -d "${{ env.VENV_DIR }}" ]]; then
echo "🐍 Creating venv at ${{ env.VENV_DIR }}"
python3 -m venv "${{ env.VENV_DIR }}"
fi
source "${{ env.VENV_DIR }}/bin/activate"
python -m pip install --upgrade pip >/dev/null

if [[ "${{ steps.changes.outputs.deps }}" == "true" ]]; then
echo "📦 requirements.txt changed (or first deploy) — installing…"
pip install -r requirements.txt --quiet
else
echo "📦 requirements.txt unchanged — skipping pip install"
fi

- name: PM2 start or graceful reload
if: steps.changes.outputs.backend == 'true'
shell: bash
run: |
set -euo pipefail
PM2_BIN=$(command -v pm2)
if [[ -z "$PM2_BIN" ]]; then
echo "pm2 not found in PATH"; exit 1
fi

# If process exists -> reload; else start from ecosystem file
if pm2 describe "${{ env.PM2_NAME }}" >/dev/null 2>&1; then
echo "🔄 Reloading ${{ env.PM2_NAME }} ..."
pm2 reload "${{ env.PM2_NAME }}" --update-env
else
echo "▶️ Starting ${{ env.PM2_NAME }} from ecosystem file..."
# You can keep your ecosystem at repo root
pm2 start ecosystem.config.cjs --only "${{ env.PM2_NAME }}"
fi

pm2 save

- name: Health check
if: steps.changes.outputs.backend == 'true'
shell: bash
run: |
set -euo pipefail
MAX_WAIT=60
SLEEP=2
ELAPSED=0
echo "🔍 Checking ${{ env.HEALTH_URL }}"
while true; do
CODE=$(curl -s -o /dev/null -w "%{http_code}" --max-time 2 "${{ env.HEALTH_URL }}" || echo "000")
if [[ "$CODE" == "200" ]]; then
echo "✅ Healthy"
break
fi
if (( ELAPSED >= MAX_WAIT )); then
echo "❌ Health check failed after ${MAX_WAIT}s (last HTTP ${CODE})"
pm2 status "${{ env.PM2_NAME }}" || true
pm2 logs "${{ env.PM2_NAME }}" --lines 80 --nostream || true
exit 1
fi
sleep "$SLEEP"
ELAPSED=$((ELAPSED+SLEEP))
done

- name: Mark backend success
if: steps.changes.outputs.backend == 'true' && success()
run: |
git rev-parse HEAD > "${{ env.DEPLOY_STATE_DIR }}/backend-success"
echo "✅ Deployment marker updated"
12 changes: 11 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
venv/
.venv/
*.py[cod]

# C extensions
*.so

# the dreaded DS_Store
**/*.DS_Store

# state used by runner to note last successful deployment
**/ez-viz.deploy-state/

#testmon data files managed by the server

testmon-data/

# Packages
*.egg
*.egg-info
Expand Down Expand Up @@ -36,7 +47,6 @@ nosetests.xml
.pydevproject

# Any hidden files
.*
/htmlcov/
/tags
/tests/
Expand Down
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions .idea/pytest-testmon.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading