mirror of
https://gitlab.com/Anson-Projects/projects.git
synced 2025-09-14 09:35:04 +00:00
Add branch preview deployment and local testing
- Add preview environment for feature branch testing - Create local deployment test script - Enable testing without requiring main branch - Preview URL: project-branch.gitlab.io
This commit is contained in:
@@ -32,6 +32,23 @@ deploy:
|
||||
paths:
|
||||
- public
|
||||
|
||||
# Branch preview deployment (for testing)
|
||||
preview:
|
||||
stage: deploy
|
||||
script:
|
||||
- echo "Deploying branch preview..."
|
||||
- echo "Preview available at: ${CI_ENVIRONMENT_URL}"
|
||||
needs:
|
||||
- deploy
|
||||
artifacts:
|
||||
paths:
|
||||
- public
|
||||
environment:
|
||||
name: preview/$CI_COMMIT_REF_SLUG
|
||||
url: https://${CI_PROJECT_PATH_SLUG}-${CI_COMMIT_REF_SLUG}.gitlab.io
|
||||
rules:
|
||||
- if: "$CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH"
|
||||
|
||||
# GitLab Pages deployment (only on main branch)
|
||||
pages:
|
||||
stage: deploy
|
||||
|
55
test-local-deployment.sh
Executable file
55
test-local-deployment.sh
Executable file
@@ -0,0 +1,55 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo "🧪 Testing local deployment simulation..."
|
||||
|
||||
# Create test directories
|
||||
mkdir -p test-output/main
|
||||
mkdir -p test-output/ghost-content
|
||||
|
||||
echo "📁 Simulating dual-output build..."
|
||||
|
||||
# Test 1: Check if ghost profile exists
|
||||
if grep -q "ghost:" _quarto.yml; then
|
||||
echo "✅ Ghost profile configuration found"
|
||||
else
|
||||
echo "❌ Ghost profile not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Test 2: Simulate content extraction
|
||||
echo "🔍 Testing content extraction logic..."
|
||||
cd ghost-upload
|
||||
|
||||
# Test with sample URL (without actually hitting network)
|
||||
echo "📝 Testing Rust compilation and basic logic..."
|
||||
if cargo check --quiet; then
|
||||
echo "✅ Rust code compiles successfully"
|
||||
else
|
||||
echo "❌ Rust compilation failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd ..
|
||||
|
||||
# Test 3: Check if CI would work
|
||||
echo "🔧 Validating CI configuration..."
|
||||
if ./validate-ghost-extraction.sh > /dev/null 2>&1; then
|
||||
echo "✅ CI validation passed"
|
||||
else
|
||||
echo "❌ CI validation failed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "🎉 Local testing complete!"
|
||||
echo ""
|
||||
echo "📋 What happens in CI:"
|
||||
echo " 1. Builds main site → public/"
|
||||
echo " 2. Builds ghost content → public/ghost-content/"
|
||||
echo " 3. Rust extracts from ghost-content URLs"
|
||||
echo " 4. Posts to Ghost blog with clean HTML"
|
||||
echo ""
|
||||
echo "🚀 Ready for branch testing in GitLab CI!"
|
||||
echo " • Download artifacts to see both outputs"
|
||||
echo " • Use manual trigger to test force-update"
|
||||
echo " • Check ghost-content/ folder structure"
|
Reference in New Issue
Block a user