-
Notifications
You must be signed in to change notification settings - Fork 1.4k
CLI - Publish Workflow #4064
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
CLI - Publish Workflow #4064
Conversation
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR implements a comprehensive CI/CD workflow for publishing the Kilo CLI package to NPM and Docker Hub. The changes include setting up automated testing, building, and deployment infrastructure, along with supporting modifications for Docker containerization and integration testing.
- Adds GitHub Actions workflow for automated publishing triggered by version bump PRs or manual dispatch
- Implements multi-stage Dockerfile supporting both Debian and Alpine base images
- Introduces integration test infrastructure using PTY for interactive CLI testing
Reviewed changes
Copilot reviewed 15 out of 17 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| .github/workflows/cli-publish.yml | Defines complete CI/CD pipeline with version checking, building, testing, and multi-target publishing (NPM, Docker Debian, Docker Alpine, GitHub releases) |
| cli/Dockerfile | Multi-stage build supporting both Debian and Alpine images with proper user setup and dependencies |
| cli/docs/DOCKER.md | Updated documentation with instructions for building and using both Debian and Alpine Docker images |
| cli/package.json | Updated test scripts to separate unit and integration tests, moved strip-ansi to devDependencies |
| cli/vitest.config.ts | New Vitest configuration for running tests with proper timeouts and sequential execution |
| cli/integration-tests/test-helper.ts | Comprehensive test helper utilities for PTY-based interactive CLI testing |
| cli/integration-tests/simple-file-operations.test.ts | Integration test verifying file modification capabilities |
| cli/integration-tests/logo.test.ts | Integration test for CLI logo display functionality |
| cli/repeat-integration-test.js | Utility script for stress testing integration tests |
| cli/esbuild.config.mjs | Added alias for is-in-ci patch and ESM polyfills |
| cli/src/patches/is-in-ci.ts | Patch file to override is-in-ci module behavior |
| cli/.dockerignore | Removed to allow dist/ directory in Docker context |
| cli/.gitignore | Added integration test artifacts to ignore list |
| .gitignore | Added act secret files to ignore list |
| flake.nix | Added act tool for local GitHub Actions testing |
| src/utils/logging/CompactTransport.ts | Changed console output from process.stdout.write to console.log |
| pnpm-lock.yaml | Added @lydell/node-pty and related dependencies, moved strip-ansi, removed cpu constraint from @lancedb/lancedb |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
pandemicsyn
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking great. The only bit im not sure about is whether or not we need the docker qemu step still to build arm targets on the vanilla runners (or use the arm runners).
| LABEL org.opencontainers.image.created="${BUILD_DATE}" \ | ||
| org.opencontainers.image.revision="${VCS_REF}" \ | ||
| org.opencontainers.image.version="${VERSION}" \ | ||
| org.opencontainers.image.title="Kilo CLI" \ | ||
| org.opencontainers.image.description="Docker image for Kilo CLI" \ | ||
| org.opencontainers.image.vendor="Kilo" \ | ||
| org.opencontainers.image.licenses="Apache-2.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super bike-sheddy - feel free to ignore.
Might be worth including org.opencontainers.image.url
https://github.com/opencontainers/image-spec/blob/main/annotations.md#pre-defined-annotation-keys
| - name: Build and push Debian image | ||
| uses: docker/build-push-action@v5 | ||
| with: | ||
| context: ./cli | ||
| file: ./cli/Dockerfile | ||
| target: debian | ||
| platforms: ${{ env.DOCKER_PLATFORMS }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mess with this only every couple of years it feels like so not positive but do we need https://github.com/docker/setup-qemu-action or do a matrix and build on a ubuntu-24.04-arm to actually be able to build the arm image ?
Context
Deploy CLI Automatically
Resolve: #3595
Resolve: #3930
Implementation
Screenshots
flowchart TD Start([Trigger: PR Merged or Manual]) --> CheckVersion[check-version Job] CheckVersion --> CheckConditions{Check Conditions} CheckConditions -->|PR merged to main<br/>with version bump<br/>OR manual trigger| CheckoutCode1[Checkout Code] CheckConditions -->|Conditions not met| End1([End - No Publish]) CheckoutCode1 --> SetupNode1[Setup Node.js 20.19.2] SetupNode1 --> CompareVersions{Compare Versions} CompareVersions -->|Local > Published| SetPublish[publish=true] CompareVersions -->|Local ≤ Published| SetNoPublish[publish=false] SetPublish --> BuildTest[build-and-test Job] SetNoPublish --> End2([End - Already Published]) BuildTest --> CheckoutCode2[Checkout Code] CheckoutCode2 --> InstallPnpm[Install pnpm 10.8.1] InstallPnpm --> SetupNode2[Setup Node.js + Cache] SetupNode2 --> TurboCache[Setup Turbo Cache] TurboCache --> InstallDeps[Install Dependencies] InstallDeps --> CreateEnv[Create .env with PostHog Key] CreateEnv --> BuildCLI[Build CLI Bundle] BuildCLI --> RunTests[Run Integration Tests] RunTests --> UploadArtifact[Upload Build Artifact] UploadArtifact --> PublishNPM[publish-npm Job] UploadArtifact --> PackNPM[pack-npm Job] PublishNPM --> CheckoutCode3[Checkout Code] CheckoutCode3 --> SetupNode3[Setup Node.js + NPM Registry] SetupNode3 --> DownloadArtifact1[Download Build Artifact] DownloadArtifact1 --> PublishToNPM[Publish to NPM Registry] PackNPM --> CheckoutCode4[Checkout Code] CheckoutCode4 --> DownloadArtifact2[Download Build Artifact] DownloadArtifact2 --> PackCLI[npm pack] PackCLI --> UploadPackaged[Upload Packaged CLI] UploadPackaged --> DockerDebian[publish-docker-debian Job] UploadPackaged --> DockerAlpine[publish-docker-alpine Job] DockerDebian --> CheckoutCode5[Checkout Code] CheckoutCode5 --> SetupBuildx1[Setup Docker Buildx] SetupBuildx1 --> LoginDocker1[Login to Docker Hub] LoginDocker1 --> DownloadPackaged1[Download Packaged CLI] DownloadPackaged1 --> BuildPushDebian[Build & Push Debian Image] BuildPushDebian --> TagsDebian[Tags:<br/>version, latest,<br/>version-debian,<br/>latest-debian] DockerAlpine --> CheckoutCode6[Checkout Code] CheckoutCode6 --> SetupBuildx2[Setup Docker Buildx] SetupBuildx2 --> LoginDocker2[Login to Docker Hub] LoginDocker2 --> DownloadPackaged2[Download Packaged CLI] DownloadPackaged2 --> BuildPushAlpine[Build & Push Alpine Image] BuildPushAlpine --> TagsAlpine[Tags:<br/>version-alpine,<br/>latest-alpine] PublishToNPM --> CreateRelease[create-release Job] TagsDebian --> CreateRelease TagsAlpine --> CreateRelease UploadPackaged --> CreateRelease CreateRelease --> CheckoutCode7[Checkout Code] CheckoutCode7 --> DownloadPackaged3[Download Packaged CLI] DownloadPackaged3 --> CreateTag{Git Tag Exists?} CreateTag -->|No| PushTag[Create & Push Git Tag] CreateTag -->|Yes| SkipTag[Skip Tag Creation] PushTag --> CheckRelease{GitHub Release Exists?} SkipTag --> CheckRelease CheckRelease -->|No| CreateGHRelease[Create GitHub Release<br/>with Changelog & .tgz] CheckRelease -->|Yes| SkipRelease[Skip Release Creation] CreateGHRelease --> Success([✓ Deployment Complete]) SkipRelease --> Success style Start fill:#0969da,stroke:#0969da,color:#ffffff style Success fill:#1a7f37,stroke:#1a7f37,color:#ffffff style End1 fill:#cf222e,stroke:#cf222e,color:#ffffff style End2 fill:#9a6700,stroke:#9a6700,color:#ffffff style CheckVersion fill:#bf8700,stroke:#bf8700,color:#ffffff style BuildTest fill:#0969da,stroke:#0969da,color:#ffffff style PublishNPM fill:#8250df,stroke:#8250df,color:#ffffff style PackNPM fill:#8250df,stroke:#8250df,color:#ffffff style DockerDebian fill:#0969da,stroke:#0969da,color:#ffffff style DockerAlpine fill:#0969da,stroke:#0969da,color:#ffffff style CreateRelease fill:#1a7f37,stroke:#1a7f37,color:#ffffff