This directory contains GitHub Actions workflows for automated testing, building, and deployment of the CaseStrainer application.
- Triggers: Push to
main/develop, Pull Requests - Purpose: Comprehensive testing and deployment
- Jobs:
- Backend testing with Redis
- Frontend build and testing
- Docker container testing
- Integration testing
- E2E testing with Cypress
- Security scanning
- Production deployment (main branch only)
- Triggers: Pull Requests only
- Purpose: Lightweight checks for PRs
- Jobs:
- Quick backend tests
- Frontend build verification
- Docker build check
- Triggers: Push to
mainbranch only - Purpose: Production deployment with safety checks
- Jobs:
- Pre-deployment validation
- Production image building
- Staging deployment (optional)
- Production deployment
Set up the following secrets in your GitHub repository (Settings → Secrets and variables → Actions):
COURTLISTENER_API_KEY=your_courtlistener_api_key_herePRODUCTION_HOST=your_production_server_ip
PRODUCTION_USER=your_ssh_username
PRODUCTION_DEPLOY_KEY=your_private_ssh_key
STAGING_HOST=your_staging_server_ip
STAGING_USER=your_staging_ssh_username
STAGING_DEPLOY_KEY=your_staging_private_ssh_key
SLACK_WEBHOOK_URL=your_slack_webhook_url
NOTIFICATION_EMAIL=your_email@example.comSet up branch protection for main and develop:
- Go to
Settings→Branches - Add rule for
mainanddevelop - Enable:
- ✅ Require a pull request before merging
- ✅ Require status checks to pass before merging
- ✅ Require branches to be up to date before merging
- ✅ Include administrators
Add these status checks to branch protection:
Backend TestsFrontend BuildDocker BuildIntegration TestsE2E TestsSecurity Scan
- Runs Python 3.11
- Installs dependencies from
requirements.txt - Runs pytest with coverage
- Performs security scanning with Bandit
- Tests Redis connectivity
- Runs Node.js 18
- Installs npm dependencies
- Builds Vue.js application
- Runs linting and unit tests
- Generates production build
- Builds all Docker images
- Starts services (Redis, Backend, RQ Worker)
- Tests service health endpoints
- Verifies container communication
- Tests citation extraction
- Tests clustering algorithms
- Tests API endpoints
- Validates PowerShell scripts
- Runs Cypress tests
- Tests user workflows
- Captures screenshots and videos on failure
- Tests full application stack
- Bandit for Python security
- Safety for dependency vulnerabilities
- Generates security reports
- Backend Tests: Add new test files in the root directory or
src/directory - Frontend Tests: Add tests in
casestrainer-vue-new/src/ - E2E Tests: Add Cypress tests in
casestrainer-vue-new/cypress/e2e/
Edit the deployment steps in deploy.yml:
- name: Deploy to production
run: |
# Add your deployment commands here
ssh user@server "cd /opt/casestrainer && git pull"
ssh user@server "cd /opt/casestrainer && docker-compose up -d"Add new environment variables in config.yml:
env:
NEW_VARIABLE: ${{ secrets.NEW_VARIABLE }}- Tests Failing: Check the workflow logs for specific error messages
- Docker Build Failures: Verify Dockerfile syntax and dependencies
- Frontend Build Issues: Check Node.js version compatibility
- Redis Connection Errors: Verify Redis service configuration
- Enable Debug Logging: Add
ACTIONS_STEP_DEBUG: trueto repository secrets - Check Artifacts: Download and inspect uploaded artifacts
- Local Testing: Run workflows locally using act
- Cache Dependencies: Workflows use caching for pip and npm dependencies
- Parallel Jobs: Jobs run in parallel where possible
- Matrix Testing: Consider adding matrix builds for multiple Python/Node versions
- Check workflow status in the
Actionstab - Set up notifications for workflow failures
- Monitor deployment success rates
- Test coverage reports
- Security scan results
- Build times and success rates
- Deployment frequency
- Secrets Management: Never commit secrets to the repository
- Dependency Scanning: Regular security scans are automated
- Access Control: Limit who can approve deployments
- Audit Logs: Monitor workflow execution logs
For issues with GitHub Actions:
- Check the GitHub Actions documentation
- Review workflow logs for error details
- Test changes locally before pushing
- Use GitHub's community forums for help