CircleCI Configuration Template Project Setup for Continuous Integration and Deployment Overview This repository contains a reusable CircleCI configuration template for automated testing, building, and releasing projects. CircleCI Configuration Features Workflow Steps
Checkout code Create virtual environment Install dependencies Run tests Build executable Create GitHub Release
Prerequisites
CircleCI Account GitHub Repository Personal Access Token
Configuration Setup
- GitHub Personal Access Token
Go to GitHub Settings Developer settings > Personal access tokens Generate a fine-grained token with:
Repository access Permissions:
Contents (Read and Write) Metadata (Read-only) Releases (Read and Write)
- CircleCI Environment Variables In CircleCI project settings, add these environment variables:
GH_TOKEN: GitHub personal access token Other project-specific variables as needed
Customizing the Configuration Modify config.yml Adjust these sections for your project: yamlCopy# Python version
- image: cimg/python:3.9 # Change to your Python version
- run: name: Install Dependencies command: | pip install -r requirements.txt pip install pyinstaller # Add/remove as needed
- run: name: Run Tests command: pytest tests/ # Change to your test runner
- run: name: Build Executable command: pyinstaller --onefile src/your_script.py # Adjust path Project Structure Recommendations Copyproject-root/ │ ├── .circleci/ │ └── config.yml # CircleCI configuration │ ├── src/ │ └── main_script.py # Main application script │ ├── tests/ │ └── test_main.py # Test files │ ├── requirements.txt # Project dependencies └── README.md Troubleshooting Common Issues
Ensure GitHub token has correct repository permissions Verify virtual environment activation Check dependency installations Confirm test script paths
Debugging CircleCI Builds
Check CircleCI web interface for detailed logs Verify environment variables Test commands locally before pushing
Best Practices
Use minimal required permissions for GitHub token Regularly rotate access tokens Keep dependencies up to date Maintain comprehensive test coverage
Supported Project Types
Python applications Executable builds Automated releases
Contributing
Fork the repository Create a feature branch Submit a pull request with detailed description