Skip to content
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

ci: migrate from CircleCI to Github Actions #1836

Merged
merged 36 commits into from
Jul 1, 2024
Merged

ci: migrate from CircleCI to Github Actions #1836

merged 36 commits into from
Jul 1, 2024

Conversation

ze-flo
Copy link
Contributor

@ze-flo ze-flo commented Jun 11, 2024

Description

Migrate from CircleCI to Github Actions! 🤖 🚀

Detail

  • Converts CCI's to GHA config
  • Leverage parallel jobs to speed up workflow
  • Follows approach to "build first, discard if tests fail"
  • Persists only the necessary files across jobs using actions/upload-artifact@v4 + actions/download-artifact@v4
  • Reduces average CI workflow duration on "non-main" branches from ~16min to ~11min (~30% faster! 🚀 )

Screenshot 2024-06-28 at 11 29 39 AM

Checklist

  • [ ] 👌 design updates will be Garden Designer approved (add the designer as a reviewer)
  • [ ] 🌐 demo is up-to-date (npm start)
  • [ ] ⬅️ renders as expected with reversed (RTL) direction
  • [ ] 🤘 renders as expected with Bedrock CSS (?bedrock)
  • [ ] 💂‍♂️ includes new unit tests. Maintain existing coverage (always >= 96%)
  • [ ] ♿ tested for WCAG 2.1 AA accessibility compliance
  • [ ] 📝 tested in Chrome, Firefox, Safari, and Edge

@ze-flo ze-flo marked this pull request as ready for review June 12, 2024 00:35
@ze-flo ze-flo requested a review from a team as a code owner June 12, 2024 00:35
@ze-flo ze-flo requested review from a team and removed request for a team June 12, 2024 00:35
.github/workflows/ci.yaml Show resolved Hide resolved
Comment on lines 23 to 27
- name: Upload dist artifacts
uses: actions/upload-artifact@v4
with:
name: dist-artifact
path: packages/**/dist
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stores content of packages/**/dist/ for test and publish jobs.

Screenshot 2024-06-11 at 1 56 02 PM

To (hopefully 😅) stay within the 500MB storage monthly allowance, we can explicitly set retention-days in the config:

Ex:

Suggested change
- name: Upload dist artifacts
uses: actions/upload-artifact@v4
with:
name: dist-artifact
path: packages/**/dist
- name: Upload dist artifacts
uses: actions/upload-artifact@v4
with:
name: dist-artifact
path: packages/**/dist
retention-days: 7

Or globally define it from the settings page.

Which way do you prefer?

Copy link
Contributor

@geotrev geotrev Jun 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this something we had set previously for CCI? I didn't see an equivalent, so I could go either way. The config route does feel more obvious for us to easily grok in the future, but the settings live independent of commit history.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's definitely rely on the setting rather than specify here. I want to be able to control this outside the scope of a PR.

.github/workflows/ci.yaml Outdated Show resolved Hide resolved
.github/workflows/ci.yaml Outdated Show resolved Hide resolved
.github/workflows/ci.yaml Outdated Show resolved Hide resolved
.github/workflows/ci.yaml Outdated Show resolved Hide resolved
package.json Show resolved Hide resolved
package.json Show resolved Hide resolved
utils/build/styled.d.ts Show resolved Hide resolved
.github/workflows/ci.yaml Outdated Show resolved Hide resolved
.github/workflows/ci.yaml Outdated Show resolved Hide resolved
@ze-flo ze-flo force-pushed the ze-flo/CCI-to-GHA branch from 1a09da3 to 083e01b Compare June 13, 2024 17:49
@ze-flo ze-flo force-pushed the ze-flo/CCI-to-GHA branch from 083e01b to d865963 Compare June 13, 2024 17:52
.circleci/config.yml Outdated Show resolved Hide resolved
.circleci/config.yml Show resolved Hide resolved
@@ -0,0 +1,159 @@
name: CI

on: push
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of these CI workflows should only happen on pull_request. That's the typical setting for all CircleCI repos. We just turned it off temporarily on react-components because there was no way to get next to build in addition to main.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this config/GHA now allow us to only build on PR for select branches? 🤞🏻

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines 23 to 27
- name: Upload dist artifacts
uses: actions/upload-artifact@v4
with:
name: dist-artifact
path: packages/**/dist
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's definitely rely on the setting rather than specify here. I want to be able to control this outside the scope of a PR.

.github/workflows/ci.yaml Outdated Show resolved Hide resolved
.github/workflows/ci.yaml Outdated Show resolved Hide resolved
.github/workflows/ci.yaml Outdated Show resolved Hide resolved
.github/workflows/ci.yaml Show resolved Hide resolved
.github/workflows/ci.yaml Show resolved Hide resolved
package.json Show resolved Hide resolved
.github/workflows/ci.yaml Outdated Show resolved Hide resolved
.github/workflows/ci.yaml Outdated Show resolved Hide resolved
.github/workflows/ci.yaml Outdated Show resolved Hide resolved
@coveralls
Copy link

Coverage Status

coverage: 96.374%. remained the same
when pulling 00a4e8a on ze-flo/CCI-to-GHA
into 44b5263 on main.

NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}

deploy-gh-pages:
# if: contains(needs.initialize.outputs.teams, 'Writers') && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/next')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To clarify, this will only trigger following a push event.

For push events, github.ref looks something like this refs/heads/{branch}

For pull_request events, github.ref > refs/pull/{PR#}/merge

@coveralls
Copy link

Coverage Status

coverage: 96.374%. remained the same
when pulling b5240e0 on ze-flo/CCI-to-GHA
into 44b5263 on main.

@coveralls
Copy link

Coverage Status

coverage: 96.374%. remained the same
when pulling ded342c on ze-flo/CCI-to-GHA
into 44b5263 on main.

@ze-flo ze-flo force-pushed the ze-flo/CCI-to-GHA branch from bf2975f to abf1547 Compare June 28, 2024 21:20
@coveralls
Copy link

Coverage Status

coverage: 96.374%. remained the same
when pulling 02ffe95 on ze-flo/CCI-to-GHA
into 44b5263 on main.

Copy link
Member

@jzempel jzempel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work @ze-flo. I'll plan to continue on with this PR in prep for final transition away from CircleCI

.github/workflows/ci.yaml Outdated Show resolved Hide resolved
.github/workflows/ci.yaml Outdated Show resolved Hide resolved
.github/workflows/ci.yaml Outdated Show resolved Hide resolved
publish:
needs: [initialize, lint, test]
runs-on: ubuntu-latest
if: contains(needs.initialize.outputs.teams, 'Maintainers') && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/next')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This condition is fine for now, but we'll need to allow version maintenance branches (i.e. v7, v8, etc) as well, so may need to weigh the idea of removing and relying solely on Lerna's allowBranch config.

@jzempel jzempel merged commit 25b2af7 into main Jul 1, 2024
8 checks passed
@jzempel jzempel deleted the ze-flo/CCI-to-GHA branch July 1, 2024 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

4 participants