frappe-ci-expert
Frappe CI Expert
Overview
This skill provides comprehensive guidance for setting up Continuous Integration (CI) testing for Frappe applications using GitHub Actions. It covers the complete CI setup process including database services, bench initialization, site creation, and test execution based on official Frappe and ERPNext patterns.
What This Skill Covers
Setting up CI tests for Frappe apps requires several components working together:
- GitHub Actions Workflow - Define when and how tests run
- Database Services - Configure MariaDB or PostgreSQL containers
- Dependencies - Install system packages, Python packages, and Node.js
- Bench Setup - Initialize bench and create test sites
- Test Execution - Run server tests, UI tests, or parallel tests
- Debugging - Access logs and troubleshoot CI failures
Quick Start
For a standard Frappe app with server tests:
- Create
.github/workflows/server-tests.ymlbased on references/workflow-templates.md - Add helper scripts from references/helper-scripts.md
- Configure database services from references/database-services.md
- Follow the setup steps in references/ci-setup-process.md
Reference Documentation
Workflow Templates
See references/workflow-templates.md for:
- Complete server tests workflow
- UI tests (Cypress) workflow
- Patch migration tests workflow
- Customizing workflows for your app
Database Services
See references/database-services.md for:
- MariaDB service configuration
- PostgreSQL service configuration
- Database credentials and configuration
- Site config JSON templates
CI Setup Process
See references/ci-setup-process.md for:
- Step-by-step bench initialization
- Installing dependencies
- Creating and configuring test sites
- Process management (Procfile modifications)
- Starting bench services in CI
Helper Scripts
See references/helper-scripts.md for:
- install_dependencies.sh - System packages setup
- install.sh - Bench initialization and site creation
- Database setup scripts
- Best practices for helper scripts
Test Execution
See references/test-execution.md for:
- Running parallel tests for server
- Running UI tests with Cypress
- Test output and logging
- Code coverage setup
CI Patterns and Best Practices
See references/ci-patterns.md for:
- Caching strategies (pip, yarn, Cypress)
- Performance optimization
- Debugging CI failures
- Common pitfalls and solutions
- Multi-matrix testing strategies
Key Concepts
Services in GitHub Actions
Frappe apps typically require:
- Database: MariaDB 10.6+ or PostgreSQL 12+
- Redis: For caching and background jobs (optional for basic tests)
- SMTP: For email testing (smtp4dev)
These run as Docker containers in the GitHub Actions runner.
Test Site Configuration
CI tests use a dedicated test site (typically test_site) with:
- Specific database credentials
- Test-safe email configuration
- Monitoring and server scripts enabled
- Host entry in
/etc/hostsfor proper URL resolution
Bench in CI
The bench setup in CI differs from development:
- Installed via pip (not git clone)
- Uses
--skip-assetsflag for speed - Disables watch/schedule processes
- Runs in background for tests
Common Use Cases
Setting Up Server Tests
Follow the complete example in references/workflow-templates.md which includes:
- Workflow triggers (PR, workflow_dispatch, schedule)
- MariaDB and PostgreSQL services
- Full setup steps
- Parallel test execution
Adding UI Tests (Cypress)
See references/workflow-templates.md for:
- Cypress binary caching
- Matrix strategy for parallel execution
- Setup wizard completion
- Headless browser configuration
Testing Database Migrations
Check references/workflow-templates.md for:
- Testing upgrades from older versions
- Restoring production backups
- Sequential migration testing
Custom App Testing
When setting up CI for your own app:
- Start with the server tests template
- Modify the app name and repository references
- Add any app-specific dependencies
- Adjust test commands if needed
- See references/ci-patterns.md for details
Environment Details
Standard Paths
- Bench directory:
~/frappe-benchor/home/runner/frappe-bench - Apps directory:
~/frappe-bench/apps/ - Sites directory:
~/frappe-bench/sites/ - Logs:
~/frappe-bench/logs/
Standard Configuration
- Test site name:
test_site - Database name:
test_frappe - Database user:
test_frappe - Database password:
test_frappe - Root password:
travis - Admin password:
admin
Python and Node Versions
Based on Frappe requirements:
- Python: 3.10+ (typically 3.10 or 3.11)
- Node.js: 24 (use setup-node@v3 or higher with check-latest)
Debugging CI Failures
When tests fail in CI:
- Check the logs - Workflow outputs bench logs and error logs
- Reproduce locally - Use the same commands from the workflow
- Enable tmate - Add
debug-ghalabel for interactive debugging - Check services - Ensure database services are healthy
- Review build output - Asset build failures are common issues
See references/ci-patterns.md for detailed troubleshooting.
Integration with Frappe Apps
For Apps in the Frappe Ecosystem
If building an app to work with ERPNext or other Frappe apps:
- Install the dependent app in your CI workflow
- Use
bench get-appto fetch dependencies - Install apps in the correct order
- Test against multiple versions if needed
For Standalone Apps
If your app doesn't depend on other Frappe apps:
- Test against the base Frappe framework only
- Keep the setup minimal
- Focus on your app's specific tests
Additional Resources
All reference files are located in the references/ directory:
workflow-templates.md- Complete workflow YAML examplesdatabase-services.md- Database service configurationsci-setup-process.md- Detailed setup steps explanationhelper-scripts.md- Script templates and explanationstest-execution.md- Test running strategiesci-patterns.md- Best practices and patterns
License
This skill documentation is licensed under Apache License 2.0.
More from kehwar/frappe_tweaks
frappe-tweaks-power-query-expert
Expert guidance for connecting Power Query (Power BI, Excel) to Frappe apps and reports. Use when building Power Query M code for Frappe data access, integrating Frappe reports with Power BI/Excel, implementing authentication for Power Query connections, handling heavy/long-running reports with report_long_polling API to avoid timeouts, applying column types and transformations, or troubleshooting Power Query caching and connection issues.
6open-observe-api-expert
Expert guidance for OpenObserve API integration in Frappe Tweaks. Use when creating, configuring, or troubleshooting OpenObserve API DocType, implementing send_logs() or search_logs() functionality, integrating with Server Scripts/Business Logic/Client-side code, debugging connection issues, or implementing logging, monitoring, error tracking, performance metrics, or audit trail use cases.
5workflow-expert
Expert guidance on Frappe Workflow system including workflow structure, states and transitions, workflow actions, email notifications, permission hooks (before_transition, after_transition, filter_workflow_transitions, has_workflow_action_permission), and best practices. Use when creating workflows, implementing workflow logic, understanding state transitions, working with workflow actions, configuring email notifications, or troubleshooting workflow-related issues.
4report-expert
Expert guidance on Frappe reports including report types, structure, creation workflow, and best practices. Use when creating standard script reports, query reports, understanding report structure, working with columns and filters, or troubleshooting report-related issues.
4api-reviewer
Security review and analysis for Frappe API endpoints decorated with @frappe.whitelist(). Use when reviewing API security, checking for permission vulnerabilities, scanning for unprotected endpoints, validating role restrictions, or auditing API endpoints for security best practices. Helps identify missing frappe.only_for(), frappe.has_permission(), or frappe.get_list() usage.
4skill-importer
Import and synchronize skills from remote GitHub repositories. Use this skill when you need to copy skills from other repositories, maintain a list of remote skill sources, or update local skills with fresh copies from upstream sources.
4