Skip to content
Merged
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
65 changes: 39 additions & 26 deletions .github/workflows/template-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,27 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Check if this is the template repository
id: repo_check
run: |
echo "Repository: $GITHUB_REPOSITORY"
if [[ "$GITHUB_REPOSITORY" == *"/SwiftProjectTemplate" ]]; then
echo "βœ… This is the SwiftProjectTemplate repository - proceeding with validation"
echo "is_template_repo=true" >> $GITHUB_OUTPUT
else
echo "ℹ️ This is a generated project repository - skipping template validation"
echo "πŸ’‘ Template validation only runs on the SwiftProjectTemplate repository"
echo "is_template_repo=false" >> $GITHUB_OUTPUT
fi

- name: Set up Xcode
if: steps.repo_check.outputs.is_template_repo == 'true'
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: "16.0"

- name: Cache Homebrew packages
if: steps.repo_check.outputs.is_template_repo == 'true'
uses: actions/cache@v4
with:
path: |
Expand All @@ -34,6 +49,7 @@ jobs:
${{ runner.os }}-homebrew-

- name: Install dependencies
if: steps.repo_check.outputs.is_template_repo == 'true'
run: |
# Install Homebrew dependencies
brew bundle install --file=./Brewfile
Expand All @@ -46,6 +62,7 @@ jobs:
yq --version

- name: Generate test project
if: steps.repo_check.outputs.is_template_repo == 'true'
run: |
echo "πŸ—οΈ Generating test project for E2E validation..."
echo "Working directory: $(pwd)"
Expand All @@ -58,22 +75,10 @@ jobs:
echo "Running setup script from template root directory"
echo "Target directory: $(pwd)/ci-test-project"

set -x # Enable verbose output
cd ci-test-project

echo "πŸ” Debugging setup script execution..."
echo "Current directory: $(pwd)"
echo "Setup script location: $(ls -la scripts/setup.sh)"
echo "Setup script is executable: $(test -x scripts/setup.sh && echo 'YES' || echo 'NO')"

# Check if all required tools are available
echo "πŸ”§ Checking tool availability..."
which bash || echo "bash not found"
bash --version || echo "bash version check failed"

# Run setup script with bash debugging and verbose output
echo "πŸš€ Running setup script with full debugging..."
bash -x ./scripts/setup.sh \
echo "πŸš€ Running setup script to generate test project..."
./scripts/setup.sh \
--project-name "CITestApp" \
--bundle-id-root "com.ci.test" \
--deployment-target 18.0 \
Expand All @@ -84,26 +89,18 @@ jobs:
--no-commit \
--public \
--skip-brew \
--force 2>&1 || {
--force || {
echo "❌ Setup script failed with exit code $?"
echo ""
echo "πŸ“ Contents of current directory:"
ls -la
echo ""
echo "πŸ“ Contents of parent directory:"
ls -la ..
echo ""
echo "πŸ“ Setup script contents (first 50 lines):"
head -50 scripts/setup.sh
echo "πŸ’‘ For detailed debugging, enable ACTIONS_STEP_DEBUG in repository settings"
exit 1
}
set +x # Disable verbose output

echo "βœ“ Test project generated successfully"
echo "Generated files:"
ls -la

- name: Run E2E validation on generated project
if: steps.repo_check.outputs.is_template_repo == 'true'
run: |
echo "πŸ” Running end-to-end validation on generated project..."
cd ci-test-project
Expand All @@ -115,13 +112,14 @@ jobs:
echo "βœ“ E2E validation completed successfully"

- name: Cleanup test project
if: always()
if: always() && steps.repo_check.outputs.is_template_repo == 'true'
run: |
echo "🧹 Cleaning up test project..."
rm -rf ci-test-project
echo "βœ“ Cleanup completed"

- name: Template validation summary
if: steps.repo_check.outputs.is_template_repo == 'true'
run: |
echo "πŸŽ‰ Template Validation Complete!"
echo ""
Expand All @@ -130,3 +128,18 @@ jobs:
echo "βœ… E2E workflow validated"
echo ""
echo "Template is ready for use! πŸš€"

- name: Generated repository info
if: steps.repo_check.outputs.is_template_repo == 'false'
run: |
echo "πŸŽ‰ Welcome to your new iOS project!"
echo ""
echo "This repository was created from SwiftProjectTemplate."
echo "Template validation is skipped for generated projects."
echo ""
echo "πŸ“– Next steps:"
echo " 1. Run './scripts/setup.sh' to configure your project"
echo " 2. Follow the README.md for development guidance"
echo " 3. Start building your iOS app!"
echo ""
echo "✨ Happy coding! πŸš€"
Loading