Add CI/CD pipeline generation module for GitHub Actions and GitLab CI#10
Draft
Copilot wants to merge 2 commits intocopilot/add-cloud-resource-provisioningfrom
Draft
Conversation
…I support Co-authored-by: Karthik777 <7102951+Karthik777@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Add CI/CD pipeline generation module for workflows
Add CI/CD pipeline generation module for GitHub Actions and GitLab CI
Feb 25, 2026
This was referenced Feb 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Completes the deployment story:
ship()handles one-time deploys, but production apps need automated pipelines. This module programmatically generates GitHub Actions workflows and GitLab CI configs with full-stack support.Changes
Core module (
fastops/ci.py, 592 lines):github_actions()- Generate GHA workflows with test/build/deploy jobsgitlab_ci()- Generate GitLab CI with equivalent capabilitiesdeploy_workflow()- Convenience wrapper for deploy-focused pipelinestest_workflow()- Convenience wrapper for PR testingmulti_env_workflow()- Staging → production with approval gates_yaml_dump()- PyYAML with fallback to custom serializerExports:
fastops/__init__.pyto expose all functionsUsage
Multi-environment workflows include conditional branching and environment protection:
Original prompt
Overview
Add a CI/CD pipeline generation module that programmatically creates GitHub Actions workflows, GitLab CI configs, and deploy-on-push pipelines. This completes the deployment story:
ship()handles one-time deploys, but production apps need automated pipelines.Branch off
copilot/add-cloud-resource-provisioning.File:
fastops/ci.pyModule docstring
"""CI/CD pipeline generation: GitHub Actions, GitLab CI, and deploy-on-push workflows."""__all__['github_actions', 'gitlab_ci', 'deploy_workflow', 'test_workflow', 'multi_env_workflow']Imports
Function 1:
github_actions(name='deploy', app_name='app', **kw)Generate a GitHub Actions workflow YAML dict and optionally save to
.github/workflows/.Parameters:
name— workflow nameapp_name— application name used in image tags, service namestrigger— dict with keys likepush,pull_request,workflow_dispatch. Default:{'push': {'branches': ['main']}}python_version— default'3.12'node_version— defaultNone(skip Node setup if None)test_cmd— command to run tests, default'python -m pytest'build— bool, include Docker build step, defaultTrueregistry—'ghcr','dockerhub','ecr','acr'. Default'ghcr'deploy_target—None,'docker','vps','azure','aws','hetzner'. If None, no deploy step.deploy_host— SSH host for VPS/Hetzner deploydeploy_user— SSH user, default'deploy'domain— domain for proxy configenv_vars— dict of env var names to pull from GitHub secretsservices— list of service dicts for theservices:key (e.g., postgres for tests)cache— bool, enable pip/npm caching, defaultTruelint— bool, add ruff/eslint step, defaultFalsesave— bool, write to.github/workflows/{name}.yml, defaultTrueReturns: dict (the workflow YAML structure)
The workflow should include these jobs:
Job:
test(iftest_cmdis not None)pip install -e '.[dev]'), run testsJob:
build(ifbuild=True)ghcr:docker/login-actionwithregistry: ghcr.io, username${{ github.actor }}, password${{ secrets.GITHUB_TOKEN }}dockerhub:docker/login-actionwith username from secrets, password from secretsecr:aws-actions/configure-aws-credentials+aws-actions/amazon-ecr-loginacr:azure/login+azure/docker-login{registry_prefix}/{app_name}:${{ github.sha }}and:latestJob:
deploy(ifdeploy_targetis not None)docker: SSH into host,docker compose pull && docker compose up -dvps/hetzner: SSH deploy with rsync + docker composeazure:azure/webapps-deployactionaws: ECS update-service or App RunnerIf
save=True, write to.github/workflows/{name}.ymlusingyaml.dump(import yaml lazily, fallback to json-style manual YAML generation if PyYAML not available).Function 2:
gitlab_ci(name='deploy', app_name='app', **kw)Similar to
github_actionsbut generates.gitlab-ci.ymlformat.Parameters: same as
github_actionswhere applicable.Stages:
test,build,deployEach stage maps to a GitLab CI job with:
image:appropriate Docker imagescript:list of commandsonly:branch restrictionsvariables:from kwservices:for test databaseReturns: dict, optionally saves to
.gitlab-ci.yml.Function 3:
deploy_workflow(app_name='app', target='docker', **kw)Convenience wrapper that calls
github_actions()with deploy-focused defaults:name='deploy'build=Truedeploy_target=targettrigger={'push': {'branches': ['main']}, 'workflow_dispatch': {}}Returns the workflow dict.
Function 4:
test_workflow(app_name='app', **kw)Convenience wrapper for test-only workflow:
name='test'build=Falsedeploy_target=Nonetrigger={'push': {'branches': ['main', 'develop']}, 'pull_request': {'branches': ['main']}}lint=TrueReturns the workflow dict.
Function 5:
multi_env_workflow(app_name='app', environments=None, **kw)Generate a workflow with staging → production promotion:
Default environments:
Creates a workflow with:
environment: productionwith protection rules)Returns dict, saves to
.github/workflows/deploy.yml.---...
This pull request was created from Copilot chat.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.