This project is an automated CI/CD pipeline that leverages GitHub Actions and Terraform to manage Google Cloud Platform (GCP) infrastructure and perform AI-driven code reviews and tests. The primary components include infrastructure deployment via Terraform, AI-powered document generation, and automated testing and notification systems based on cloud functions and services.
- GitHub Actions: Automate workflows for code reviews, testing, and deployment.
- Terraform: Infrastructure as Code (IaC) tool for provisioning GCP resources.
- Node.js: JavaScript runtime used for custom automation scripts.
- Google Cloud Platform: Hosts application infrastructure and resources.
- OpenAI API: Powers AI-driven code reviews and document/content generation.
- SendGrid: Sends notifications via email.
- Google Cloud Storage: Stores test artifacts and assets.
Triggered by opening, synchronizing, or reopening a pull request. This workflow:
- Fetches the latest code.
- Generates a filtered diff of relevant files (JavaScript, YAML, Terraform).
- Uses OpenAI to perform an AI-driven code review.
- Utilizes secrets
OPENAI_API_KEYandGITHUB_TOKEN.
Runs on pushes to the automation/js path and includes a demo placeholder step:
- Simply outputs a hello message as a demonstration.
Triggered on pushes to the main branch. The workflow:
- Authenticates with GCP using the
GCP_CREDENTIALSsecret. - Deploys and manages GCP infrastructure using Terraform.
- Generates and commits AI-powered documentation.
- Builds and runs an AI-generated web test using Playwright.
- Uploads test results and screenshots to Google Cloud Storage.
- Sends a notification email with the test results using SendGrid.
Upon modifications or new feature implementations in the code (e.g., a new pull request or a push to main), GitHub Actions workflows are automatically triggered:
- Code Review (PR): An AI-driven review checks for issues in code changes targeting the main branch.
- Demo Placeholder: Provides a simple demonstration step confirming the workflow execution.
- Infrastructure Management:
- On a code push to
main, Terraform is used to apply or destroy infrastructure changes on GCP. - AI-generated documentation is committed back to the repository if changes are detected.
- On a code push to
- Testing and Notifications:
- Post-deployment, an AI-generated Playwright test validates the application's web UI.
- Test results and related assets are stored and shared via email notifications.
- Pull Requests: Open, sync, or reopen a PR to trigger code review workflows.
- Push to Main: Automated infrastructure handling and testing occur on a push to the
mainbranch. - Demo Steps: Pushing changes to the
automation/jsdirectory triggers the demo workflow.
OPENAI_API_KEY: Authenticate with OpenAI for AI-driven tasks.GITHUB_TOKEN: Required for repository and workflow authentication and operations.GCP_CREDENTIALS: JSON key for Google Cloud Platform authentication.SENDGRID_API_KEY: To send email notifications using SendGrid.EMAIL_TO,EMAIL_FROM: Email addresses for sending and receiving notifications.
- Automatically analyzes code changes related to
.js,.yml, and.tffiles. - The results are posted back to the pull request as comments or checks.
Ensure all required secrets are properly configured in the GitHub repository settings to enable seamless operation of the workflows.
This pipeline setup streamlines operations for efficient development, deployment, and maintenance of GCP-hosted applications with integrated AI capabilities for enhanced code review and documentation.