trendmicro-frontend / tonic-ui

Tonic UI is a UI component library for React, built with Emotion and Styled System. It is designed to be easy to use and easy to customize.
https://trendmicro-frontend.github.io/tonic-ui
MIT License
125 stars 28 forks source link

ci: enhance monorepo release flow with `changesets` #884

Closed cheton closed 2 months ago

cheton commented 2 months ago

Reference


PR Type

Enhancement, Configuration changes


Description


Changes walkthrough 📝

Relevant files
Documentation
README.md
Add README for Changesets with documentation links             

.changeset/README.md
  • Added a README file for Changesets with introductory information and
    links to documentation.
  • +8/-0     
    Configuration changes
    config.json
    Add Changesets configuration file                                               

    .changeset/config.json
  • Added configuration file for Changesets with schema, changelog, and
    repository details.
  • +11/-0   
    changesets-release.yml
    Add GitHub Actions workflow for Changesets release             

    .github/workflows/changesets-release.yml
  • Added GitHub Actions workflow for releasing packages using Changesets.

  • +44/-0   
    Enhancement
    package.json
    Update package.json with Changesets dependencies and scripts

    package.json
  • Added Changesets dependencies and scripts for publishing.
  • Modified existing publish scripts to include build steps.
  • +7/-4     

    💡 PR-Agent usage: Comment /help on the PR to get a list of all available PR-Agent tools and their descriptions

    codesandbox[bot] commented 2 months ago

    Review or Edit in CodeSandbox

    Open the branch in Web EditorVS CodeInsiders
    Open Preview

    changeset-bot[bot] commented 2 months ago

    ⚠️ No Changeset found

    Latest commit: 6e11be1493d85dfcfae7d4be311c7d800f6617d3

    Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

    This PR includes no changesets When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

    Click here to learn what changesets are, and how to add one.

    Click here if you're a maintainer who wants to add a changeset to this PR

    codiumai-pr-agent-free[bot] commented 2 months ago

    PR Reviewer Guide 🔍

    (Review updated until commit https://github.com/trendmicro-frontend/tonic-ui/commit/6e11be1493d85dfcfae7d4be311c7d800f6617d3)

    ⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Key issues to review

    **Configuration Consistency:** Ensure that the changes in the GitHub Actions workflow and `package.json` scripts are consistent and correctly integrate with the existing CI/CD pipeline. **Dependency Management:** The addition of `@changesets/cli` and `@changesets/changelog-github` should be reviewed to ensure they are compatible with other dependencies and correctly configured.
    codiumai-pr-agent-free[bot] commented 2 months ago

    PR Code Suggestions ✨

    CategorySuggestion                                                                                                                                    Score
    Performance
    Add a cache step for yarn dependencies to speed up workflow runs ___ **Consider adding a cache step for yarn dependencies to speed up the workflow runs and
    reduce the load on the package registry.** [.github/workflows/changesets-release.yml [31-33]](https://github.com/trendmicro-frontend/tonic-ui/pull/884/files#diff-dab56b8e025a5098264c80c3e4da18714a7c63c3f88ad320c52e12cf9b3c9185R31-R33) ```diff +- name: Cache Yarn Dependencies + uses: actions/cache@v2 + with: + path: | + ~/.yarn/cache + node_modules + key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} + restore-keys: | + ${{ runner.os }}-yarn- - name: Install Dependencies id: install-dependencies run: yarn install ``` - [ ] **Apply this suggestion**
    Suggestion importance[1-10]: 8 Why: Adding a cache step for yarn dependencies is a significant improvement for performance, reducing build times and network load.
    8
    Best practice
    Ensure the full git history is available by setting fetch-depth to 0 in the checkout step ___ **Add a checkout step with fetch-depth: 0 to ensure the full history is available for lerna
    commands that might need it.** [.github/workflows/changesets-release.yml [23-25]](https://github.com/trendmicro-frontend/tonic-ui/pull/884/files#diff-dab56b8e025a5098264c80c3e4da18714a7c63c3f88ad320c52e12cf9b3c9185R23-R25) ```diff - name: Checkout id: checkout uses: actions/checkout@v4 + with: + fetch-depth: 0 ``` - [x] **Apply this suggestion**
    Suggestion importance[1-10]: 7 Why: Ensuring full git history is available can be crucial for operations that require a complete history, such as generating changelogs or version tags.
    7
    Add a prepublishOnly script to run tests before publishing ___ **Add a prepublishOnly script to run tests before publishing to ensure that only passing
    code is published.** [package.json [12]](https://github.com/trendmicro-frontend/tonic-ui/pull/884/files#diff-7ae45ad102eab3b6d7e7896acd08c427a9b25b346470d7bc6507b6481575d519R12-R12) ```diff "ci-publish": "yarn build && lerna publish from-package --y --no-private", +"prepublishOnly": "yarn test", ``` - [ ] **Apply this suggestion**
    Suggestion importance[1-10]: 7 Why: Adding a `prepublishOnly` script to ensure tests pass before publishing improves the reliability of the release process.
    7
    Enhancement
    Add a post-publish step to notify a Slack channel about the new release ___ **Add a post-publish step to notify a Slack channel or other communication tool about the
    new release.** [.github/workflows/changesets-release.yml [35-44]](https://github.com/trendmicro-frontend/tonic-ui/pull/884/files#diff-dab56b8e025a5098264c80c3e4da18714a7c63c3f88ad320c52e12cf9b3c9185R35-R44) ```diff - name: Create Release Pull Request or Publish to npm id: changesets uses: changesets/action@master with: title: "chore(release): version packages" commit: "chore(release): version packages [skip ci]" publish: yarn ci-publish version: yarn changeset version env: GITHUB_TOKEN: ${{ env.GITHUB_TOKEN }} NPM_TOKEN: ${{ env.NPM_TOKEN }} +- name: Notify Slack + if: success() + uses: 8398a7/action-slack@v3 + with: + status: ${{ job.status }} + fields: repo,message,commit,author,action,eventName,ref,workflow,job,took + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} ``` - [ ] **Apply this suggestion**
    Suggestion importance[1-10]: 6 Why: Adding a notification step enhances the communication and awareness of new releases, although it's more of an enhancement than a critical improvement.
    6
    codesandbox-ci[bot] commented 2 months ago

    This pull request is automatically built and testable in CodeSandbox.

    To see build info of the built libraries, click here or the icon next to each commit SHA.

    trendmicro-frontend-bot commented 2 months ago

    Tonic UI Demo

    codecov[bot] commented 2 months ago

    Codecov Report

    All modified and coverable lines are covered by tests :white_check_mark:

    Project coverage is 74.83%. Comparing base (7baee21) to head (6e11be1).

    Additional details and impacted files ```diff @@ Coverage Diff @@ ## v2 #884 +/- ## ======================================= Coverage 74.83% 74.83% ======================================= Files 375 375 Lines 6140 6140 ======================================= Hits 4595 4595 Misses 1545 1545 ``` | [Flag](https://app.codecov.io/gh/trendmicro-frontend/tonic-ui/pull/884/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=trendmicro-frontend) | Coverage Δ | | |---|---|---| | [codemod](https://app.codecov.io/gh/trendmicro-frontend/tonic-ui/pull/884/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=trendmicro-frontend) | `74.28% <ø> (ø)` | | | [react](https://app.codecov.io/gh/trendmicro-frontend/tonic-ui/pull/884/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=trendmicro-frontend) | `72.43% <ø> (ø)` | | | [react-base](https://app.codecov.io/gh/trendmicro-frontend/tonic-ui/pull/884/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=trendmicro-frontend) | `100.00% <ø> (ø)` | | | [react-hooks](https://app.codecov.io/gh/trendmicro-frontend/tonic-ui/pull/884/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=trendmicro-frontend) | `87.59% <ø> (ø)` | | | [styled-system](https://app.codecov.io/gh/trendmicro-frontend/tonic-ui/pull/884/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=trendmicro-frontend) | `93.42% <ø> (ø)` | | | [theme](https://app.codecov.io/gh/trendmicro-frontend/tonic-ui/pull/884/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=trendmicro-frontend) | `100.00% <ø> (ø)` | | | [utils](https://app.codecov.io/gh/trendmicro-frontend/tonic-ui/pull/884/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=trendmicro-frontend) | `89.14% <ø> (ø)` | | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=trendmicro-frontend#carryforward-flags-in-the-pull-request-comment) to find out more.

    :umbrella: View full report in Codecov by Sentry.
    :loudspeaker: Have feedback on the report? Share it here.

    cheton commented 2 months ago

    /review

    codiumai-pr-agent-free[bot] commented 2 months ago

    Persistent review updated to latest commit https://github.com/trendmicro-frontend/tonic-ui/commit/6e11be1493d85dfcfae7d4be311c7d800f6617d3