Skip to content
Draft
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
58 changes: 58 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Test

on:
pull_request:
branches:
- main

jobs:
test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: 'pip'

- name: Install Python dependencies
run: |
pip install --upgrade pip
pip install -r requirements.txt
pip install -e .

- name: Run linting
run: |
ruff check src/ tests/ scripts/

- name: Run tests
run: |
pytest tests/ -v --cov=src/servermonitoring --cov-report=term-missing --cov-report=xml

- name: Test data generation
run: |
python scripts/build_data.py
ls -la _data/

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2'
bundler-cache: true

- name: Test Jekyll build
run: |
bundle exec jekyll build --verbose
ls -la _site/

- name: Upload coverage reports
uses: codecov/codecov-action@v5
if: always()
with:
files: ./coverage.xml
flags: unittests
name: codecov-umbrella
continue-on-error: true
62 changes: 50 additions & 12 deletions .github/workflows/update-dashboard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,67 @@ on:
- "scripts/**"
- "config/**"
- "requirements.txt"
- "_config.yml"
- "*.md"
- "_includes/**"
- "_layouts/**"

jobs:
build:
build-and-deploy:
runs-on: ubuntu-latest
permissions:
contents: write
pages: write
id-token: write

steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install dependencies
run: pip install -r requirements.txt
- name: Build dashboard
run: python scripts/build_dashboard.py --download-logs
- name: Commit docs
cache: 'pip'

- name: Install Python dependencies
run: |
pip install --upgrade pip
pip install -r requirements.txt
pip install -e .

- name: Download logs
run: python scripts/sync_logs.py
continue-on-error: true

- name: Generate data
run: python scripts/build_data.py

- name: Commit generated data
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add docs
git add _data
if git diff --staged --quiet; then
echo "No changes to commit."
exit 0
echo "No data changes to commit."
else
git commit -m "Update data: $(date -u +%Y-%m-%d)"
git push
fi
git commit -m "Update dashboard"
git push

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2'
bundler-cache: true

- name: Build Jekyll site
run: bundle exec jekyll build

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: _site

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,17 @@ data/logs/
__pycache__/
*.pyc
.DS_Store
.venv/
venv/
_site/
.sass-cache/
.jekyll-cache/
.jekyll-metadata
Gemfile.lock
vendor/
.coverage
htmlcov/
.pytest_cache/
*.egg-info/
dist/
build/
22 changes: 22 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
source "https://rubygems.org"

gem "jekyll", "~> 4.3"
gem "minima", "~> 2.5"

group :jekyll_plugins do
gem "jekyll-feed", "~> 0.12"
end

# Windows and JRuby does not include zoneinfo files, so bundle the tzinfo-data gem
# and associated library.
platforms :mingw, :x64_mingw, :mswin, :jruby do
gem "tzinfo", ">= 1", "< 3"
gem "tzinfo-data"
end

# Performance-booster for watching directories on Windows
gem "wdm", "~> 0.1", :platforms => [:mingw, :x64_mingw, :mswin]

# Lock `http_parser.rb` gem to `v0.6.x` on JRuby builds since newer versions of the gem
# do not have a Java counterpart.
gem "http_parser.rb", "~> 0.6.0", :platforms => [:jruby]
78 changes: 78 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
.PHONY: help setup data test lint format site serve clean

# Default target
help:
@echo "Server Monitoring Dashboard - Makefile targets:"
@echo ""
@echo " make setup - Create virtualenv and install Python dependencies"
@echo " make data - Generate _data/*.json files from logs"
@echo " make test - Run Python unit tests with coverage"
@echo " make lint - Run linting checks (ruff)"
@echo " make format - Auto-format code with ruff"
@echo " make site - Build Jekyll site (requires Ruby/bundler)"
@echo " make serve - Serve Jekyll site locally at http://localhost:4000"
@echo " make clean - Remove build artifacts and generated files"
@echo ""

# Python setup
setup:
@echo "Creating virtual environment..."
python3 -m venv .venv
@echo "Installing dependencies..."
.venv/bin/pip install --upgrade pip
.venv/bin/pip install -r requirements.txt
.venv/bin/pip install -e .
@echo "Setup complete! Activate with: source .venv/bin/activate"

# Generate data
data:
@echo "Generating data files..."
.venv/bin/python scripts/build_data.py
@echo "Data generation complete!"

# Run tests
test:
@echo "Running tests..."
.venv/bin/pytest tests/ -v --cov=src/servermonitoring --cov-report=term-missing

# Lint code
lint:
@echo "Running linting checks..."
.venv/bin/ruff check src/ tests/ scripts/

# Format code
format:
@echo "Formatting code..."
.venv/bin/ruff check --fix src/ tests/ scripts/
.venv/bin/ruff format src/ tests/ scripts/

# Jekyll site build
site:
@echo "Building Jekyll site..."
@if ! command -v bundle >/dev/null 2>&1; then \
echo "Error: bundler not found. Install with: gem install bundler"; \
exit 1; \
fi
bundle install --quiet
bundle exec jekyll build
@echo "Site built to _site/"

# Serve Jekyll locally
serve:
@echo "Starting Jekyll server..."
@if ! command -v bundle >/dev/null 2>&1; then \
echo "Error: bundler not found. Install with: gem install bundler"; \
exit 1; \
fi
bundle install --quiet
bundle exec jekyll serve --livereload

# Clean build artifacts
clean:
@echo "Cleaning build artifacts..."
rm -rf _site .sass-cache .jekyll-cache .jekyll-metadata
rm -rf htmlcov .coverage .pytest_cache
rm -rf src/*.egg-info build dist
find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
find . -type f -name "*.pyc" -delete
@echo "Clean complete!"
Loading
Loading