-
Notifications
You must be signed in to change notification settings - Fork 32
ci: convert production workflows #3192
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
Merged
Merged
Changes from 5 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
48f9ae1
robo start, need to review
dreamwasp 9ea1ea7
Merge branch 'main' into cass-GMT-287
dreamwasp 54c6644
add back cacheing
dreamwasp 4ff1579
Merge branch 'cass-GMT-287' of github.com:Codecademy/gamut into cass-…
dreamwasp 9a97cd9
more automerge to required checks
dreamwasp 44efeec
update summary
dreamwasp da23bb2
Merge branch 'main' into cass-GMT-287
dreamwasp 81ec370
pull
dreamwasp e8d3517
test passes
dreamwasp 4aed134
Merge branch 'main' into cass-GMT-287
dreamwasp 72f1244
jake fix
dreamwasp 0594990
finishing touches
dreamwasp 653bb46
capitalize Badge comment
dreamwasp dd7207a
fixed
dreamwasp File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,156 @@ | ||
| # CircleCI to GitHub Actions Migration Summary | ||
|
|
||
| This document summarizes the migration from CircleCI to GitHub Actions completed on October 21, 2025. | ||
|
|
||
| ## New GitHub Actions Workflows Created | ||
|
|
||
| ### 1. `publish-production.yml` | ||
|
|
||
| - **Purpose**: Publishes production packages to npm when changes are merged to main | ||
| - **Trigger**: Push to main branch | ||
| - **Key Features**: | ||
| - Skips automated release commits to prevent circular builds | ||
| - Uses Lerna for conventional commit-based versioning | ||
| - Creates GitHub releases automatically | ||
| - Uses concurrency control to prevent simultaneous publish jobs | ||
|
|
||
| ### 2. `deploy-production.yml` | ||
|
|
||
| - **Purpose**: Deploys production Storybook to GitHub Pages when changes are merged to main | ||
| - **Trigger**: Push to main branch | ||
| - **Key Features**: | ||
| - Builds all packages and Storybook | ||
| - Deploys to GitHub Pages using gh-pages | ||
| - Uses concurrency control to prevent simultaneous deploy jobs | ||
| - Skips automated release commits | ||
|
|
||
| ## Files Modified | ||
|
|
||
| ### 1. `.github/workflows/automerge.yml` | ||
|
|
||
| - **Change**: Updated CircleCI check reference from `build-test` to `test` | ||
| - **Reason**: The test suite is now run via GitHub Actions workflow named "Test Suite" with job name "test" | ||
|
|
||
| ### 2. `README.md` | ||
|
|
||
| - **Changes**: | ||
| - Replaced CircleCI badge with GitHub Actions badge | ||
| - Updated publishing documentation to reference GitHub Actions instead of CircleCI | ||
|
|
||
| ### 3. `nx.json` | ||
|
|
||
| - **Change**: Updated `ci` named input to reference GitHub Actions workflows | ||
| - **Before**: Referenced `.circleci/config.yml` and `.github/push.yml` | ||
| - **After**: References `.github/workflows/**/*.yml` and `.github/actions/**/*.yml` | ||
| - **Impact**: Nx will now properly invalidate caches when any GitHub Actions workflow or action changes | ||
|
|
||
| ## Files Deleted | ||
|
|
||
| ### 1. `.circleci/` directory | ||
|
|
||
| - **Removed**: Entire CircleCI configuration directory | ||
| - **Reason**: All workflows have been successfully migrated to GitHub Actions | ||
|
|
||
| ## Workflow Comparison | ||
|
|
||
| | CircleCI Job | GitHub Actions Workflow | Status | | ||
| | --------------- | ------------------------------------ | ----------- | | ||
| | `checkout_code` | Integrated into individual workflows | ✅ Migrated | | ||
| | `publish` | `publish-production.yml` | ✅ Migrated | | ||
| | `deploy` | `deploy-production.yml` | ✅ Migrated | | ||
|
|
||
| ## Key Design Decisions | ||
|
|
||
| ### 1. **DRY Principles** | ||
|
|
||
| All workflows reuse the existing composite actions in `.github/actions/`: | ||
|
|
||
| - `yarn/` - Node.js setup and dependency installation | ||
| - `set-git-user/` - Git user configuration | ||
| - `set-npm-token/` - NPM authentication | ||
| - `skip-automated-commits/` - Skip release commits | ||
| - `validate-pr-context/` - Ensure PR context exists | ||
|
|
||
| ### 2. **Concurrency Control** | ||
|
|
||
| Replaced CircleCI's queue orb with GitHub Actions concurrency groups: | ||
|
|
||
| - `publish-production` - Ensures only one publish runs at a time | ||
| - `deploy-production` - Ensures only one deploy runs at a time | ||
| - Both set `cancel-in-progress: false` to avoid canceling active deployments | ||
|
|
||
| ### 3. **Consistent Patterns** | ||
|
|
||
| Followed patterns established in existing workflows: | ||
|
|
||
| - Same Node.js version (`22.13.1`) | ||
| - Same runner (`ubuntu-22.04`) | ||
| - Same environment variables | ||
| - Same timeout settings (30 minutes) | ||
| - Same permissions structure | ||
|
|
||
| ### 4. **Caching Strategy** | ||
|
|
||
| All workflows include comprehensive caching to speed up builds, matching CircleCI's strategy: | ||
|
|
||
| **Yarn dependencies** (via `yarn` action): | ||
|
|
||
| - Cached automatically by `setup-node` action using `cache: 'yarn'` | ||
| - Cache key based on `yarn.lock` hash | ||
| - Equivalent to CircleCI's yarn cache | ||
|
|
||
| **Nx build cache** (in production workflows): | ||
|
|
||
| - Path: `node_modules/.cache/nx` | ||
| - Primary key: `nx-{OS}-{yarn.lock}-{branch}-{run_id}` (similar to CircleCI's epoch-based key) | ||
| - Restore keys fall back progressively: branch → yarn.lock → OS | ||
| - Uses standard `actions/cache@v4` which automatically saves on success | ||
|
|
||
| **Webpack cache** (in deploy workflow): | ||
|
|
||
| - Paths: `node_modules/.cache` and `packages/styleguide/node_modules/.cache` | ||
| - Primary key: `webpack-{OS}-{yarn.lock}-{branch}-{commit_sha}` (matches CircleCI's revision-based key) | ||
| - Restore keys fall back to branch and yarn.lock levels | ||
| - Only included in deploy workflow since it's specifically needed for Storybook builds | ||
|
|
||
| **Key improvements over CircleCI:** | ||
|
|
||
| - Uses GitHub Actions' native `actions/cache@v4` (simpler than separate restore/save) | ||
| - Automatic cache saving (no need for `if: always()` conditions) | ||
| - `github.run_id` for Nx provides unique per-run keys similar to CircleCI's `{{ epoch }}` | ||
| - `github.sha` for webpack matches CircleCI's `{{ .Revision }}` | ||
|
|
||
| ### 5. **Security Best Practices** | ||
|
|
||
| - Minimal permissions using principle of least privilege | ||
| - Separate tokens for different purposes (`ACTIONS_GITHUB_TOKEN` vs `NODE_AUTH_TOKEN`) | ||
| - Explicit permission declarations for each workflow | ||
|
|
||
| ## Testing Checklist | ||
|
|
||
| Before considering this migration complete, verify: | ||
|
|
||
| - [ ] Merge a PR to main and confirm packages are published correctly | ||
| - [ ] Verify GitHub releases are created with proper changelog | ||
| - [ ] Confirm Storybook deploys to GitHub Pages successfully | ||
| - [ ] Check that automerge still works with the new test check name | ||
| - [ ] Verify concurrency controls prevent overlapping publishes/deploys | ||
| - [ ] Ensure skip-automated-commits properly prevents circular builds | ||
|
|
||
| ## Secrets Required | ||
|
|
||
| Ensure the following secrets are configured in GitHub: | ||
|
|
||
| - `ACTIONS_GITHUB_TOKEN` - For creating releases and pushing to gh-pages | ||
| - `NODE_AUTH_TOKEN` - For publishing to npm | ||
| - Other existing secrets used by other workflows | ||
|
|
||
| ## Rollback Plan | ||
|
|
||
| If issues arise, you can temporarily: | ||
|
|
||
| 1. Restore `.circleci/config.yml` from git history | ||
| 2. Re-enable CircleCI in the repository settings | ||
| 3. Update the automerge workflow to reference `build-test` again | ||
|
|
||
| However, this should only be done as a last resort. Most issues can be fixed by updating the new workflows. | ||
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -20,15 +20,6 @@ jobs: | |
| runs-on: ubuntu-latest | ||
| if: github.ref != 'refs/heads/main' | ||
| steps: | ||
| - name: Wait for CI build | ||
| uses: fountainhead/[email protected] | ||
| id: wait-for-build | ||
| with: | ||
| token: ${{ secrets.ACTIONS_GITHUB_TOKEN }} | ||
| checkName: build-test | ||
| ref: ${{ github.event.pull_request.head.sha || github.sha }} | ||
| timeoutSeconds: 1200 | ||
| intervalSeconds: 30 | ||
|
Comment on lines
-23
to
-31
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. & pr-title |
||
| - name: automerge | ||
| uses: pascalgn/[email protected] | ||
| env: | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
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.

Uh oh!
There was an error while loading. Please reload this page.
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.
will remove before shiupping, but wanted to keep cursors notes for the review