|
| 1 | +#!/bin/bash |
| 2 | +# Release test script for BLSync v0.4.2 |
| 3 | +# This script validates the release by running tests and checking version consistency |
| 4 | + |
| 5 | +set -e |
| 6 | + |
| 7 | +VERSION="0.4.2" |
| 8 | +RELEASE_COLOR='\033[0;32m' |
| 9 | +ERROR_COLOR='\033[0;31m' |
| 10 | +INFO_COLOR='\033[0;34m' |
| 11 | +NC='\033[0m' # No Color |
| 12 | + |
| 13 | +echo -e "${INFO_COLOR}========================================${NC}" |
| 14 | +echo -e "${INFO_COLOR}BLSync v${VERSION} Release Test${NC}" |
| 15 | +echo -e "${INFO_COLOR}========================================${NC}" |
| 16 | + |
| 17 | +# Function to print colored output |
| 18 | +print_success() { |
| 19 | + echo -e "${RELEASE_COLOR}✓ $1${NC}" |
| 20 | +} |
| 21 | + |
| 22 | +print_error() { |
| 23 | + echo -e "${ERROR_COLOR}✗ $1${NC}" |
| 24 | +} |
| 25 | + |
| 26 | +print_info() { |
| 27 | + echo -e "${INFO_COLOR}ℹ $1${NC}" |
| 28 | +} |
| 29 | + |
| 30 | +# Test 1: Check version in pyproject.toml |
| 31 | +print_info "Checking version in pyproject.toml..." |
| 32 | +if grep -q "version = \"${VERSION}\"" pyproject.toml; then |
| 33 | + print_success "pyproject.toml version is correct" |
| 34 | +else |
| 35 | + print_error "pyproject.toml version mismatch" |
| 36 | + exit 1 |
| 37 | +fi |
| 38 | + |
| 39 | +# Test 2: Check CHANGELOG is updated |
| 40 | +print_info "Checking CHANGELOG for v${VERSION}..." |
| 41 | +if grep -q "## \[${VERSION}\]" CHANGELOG.md; then |
| 42 | + print_success "CHANGELOG contains v${VERSION} entry" |
| 43 | +else |
| 44 | + print_error "CHANGELOG missing v${VERSION} entry" |
| 45 | + exit 1 |
| 46 | +fi |
| 47 | + |
| 48 | +# Test 3: Check CHANGELOG links |
| 49 | +print_info "Checking CHANGELOG version links..." |
| 50 | +if grep -q "\[${VERSION}\]: " CHANGELOG.md; then |
| 51 | + print_success "CHANGELOG contains version link" |
| 52 | +else |
| 53 | + print_error "CHANGELOG missing version link" |
| 54 | + exit 1 |
| 55 | +fi |
| 56 | + |
| 57 | +# Test 4: Run Python tests |
| 58 | +print_info "Running Python tests..." |
| 59 | +if uv run pytest tests/ -v --tb=short; then |
| 60 | + print_success "All Python tests passed" |
| 61 | +else |
| 62 | + print_error "Python tests failed" |
| 63 | + exit 1 |
| 64 | +fi |
| 65 | + |
| 66 | +# Test 5: Check code formatting |
| 67 | +print_info "Checking code formatting with ruff..." |
| 68 | +if uv run ruff check .; then |
| 69 | + print_success "Code formatting check passed" |
| 70 | +else |
| 71 | + print_error "Code formatting issues found" |
| 72 | + exit 1 |
| 73 | +fi |
| 74 | + |
| 75 | +# Test 6: Verify package can be built |
| 76 | +print_info "Testing package build..." |
| 77 | +TEMP_DIR=$(mktemp -d) |
| 78 | +cd "${TEMP_DIR}" |
| 79 | +if uv build --outdir /tmp/blsync-build-test /Users/beny/dev_src/BLSync > /dev/null 2>&1; then |
| 80 | + print_success "Package builds successfully" |
| 81 | + rm -rf /tmp/blsync-build-test |
| 82 | +else |
| 83 | + print_error "Package build failed" |
| 84 | + cd /Users/beny/dev_src/BLSync |
| 85 | + rm -rf "${TEMP_DIR}" |
| 86 | + exit 1 |
| 87 | +fi |
| 88 | +cd /Users/beny/dev_src/BLSync |
| 89 | +rm -rf "${TEMP_DIR}" |
| 90 | + |
| 91 | +# Test 7: Check static files exist |
| 92 | +print_info "Checking static frontend files..." |
| 93 | +if [ -d "static" ] && [ -f "static/index.html" ]; then |
| 94 | + print_success "Static frontend files exist" |
| 95 | +else |
| 96 | + print_error "Static frontend files missing" |
| 97 | + exit 1 |
| 98 | +fi |
| 99 | + |
| 100 | +# Test 8: Verify git status (should be clean except for version changes) |
| 101 | +print_info "Checking git status..." |
| 102 | +GIT_CHANGES=$(git status --porcelain | grep -v "pyproject.toml" | grep -v "CHANGELOG.md" | grep -v "scripts/" || true) |
| 103 | +if [ -z "$GIT_CHANGES" ]; then |
| 104 | + print_success "No unexpected changes detected" |
| 105 | +else |
| 106 | + print_info "Note: There are changes besides version files:" |
| 107 | + git status --short |
| 108 | +fi |
| 109 | + |
| 110 | +echo "" |
| 111 | +echo -e "${RELEASE_COLOR}========================================${NC}" |
| 112 | +echo -e "${RELEASE_COLOR}All release tests passed! ✓${NC}" |
| 113 | +echo -e "${RELEASE_COLOR}========================================${NC}" |
| 114 | +echo "" |
| 115 | +echo "Version: ${VERSION}" |
| 116 | +echo "Date: $(date +%Y-%m-%d)" |
| 117 | +echo "" |
| 118 | +echo "Ready to commit and tag:" |
| 119 | +echo " git add pyproject.toml CHANGELOG.md" |
| 120 | +echo " git commit -m 'chore: release v${VERSION}'" |
| 121 | +echo " git tag -a v${VERSION} -m 'Release v${VERSION}'" |
| 122 | +echo " git push origin dev" |
| 123 | +echo " git push origin v${VERSION}" |
0 commit comments