Skip to content

Commit

Permalink
chore(turbo): add remote cache to reduce duplicated ci or build (#300)
Browse files Browse the repository at this point in the history
fix #299 

# Overview

<!--
    A clear and concise description of what this pr is about.
 -->

As the project grew, CI and build times were getting longer. Therefore,
I wanted to shorten this time by using a [remote
cache](https://turbo.build/repo/docs/core-concepts/remote-caching). We
can check extremely fast ci in GitHub Actions using Turborepo's remote
caching of Vercel. I'm happy to solve the problem and introduce it to
you with this Pull Request. 🚀

## Extremely fast ci (for example: ci(lint): 1m 24s -> 28s)

### AS-IS:not using cache (ci(lint total): 1m 24s, prepack:29s ->
lint:22s)
<img width="830" alt="image"
src="https://github.com/suspensive/react/assets/61593290/88241c97-dd98-4e41-a608-f18d47422678">

### TO-BE:using cache (ci(lint total): 28s, prepack:2s -> lint:1s)
<img width="822" alt="image"
src="https://github.com/suspensive/react/assets/61593290/18363734-163e-40e3-9f98-be0a7854e6df">


## Extremely fast publish

In Pull Request, visualization and docs built file and @suspensive/react
@suspensive/react-query @suspensive/react-await packed files will be
cached, and when this Pull Request finally is merged, reuse it so
publishing time for all packages and websites(docs, visualization) will
be extremely saved

### build on Pull Request and cache it to reuse on publish docs,
visualization and all packages
<img width="832" alt="image"
src="https://github.com/suspensive/react/assets/61593290/dad0e929-5c81-4fd8-8680-2dc821a4b266">


## PR Checklist

- [x] I did below actions if need

1. I read the [Contributing
Guide](https://github.com/suspensive/react/blob/main/CONTRIBUTING.md)
2. I added documents and tests.
  • Loading branch information
manudeli authored Nov 5, 2023
1 parent 38c1247 commit 0d7f7a0
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ on:
- main
pull_request:
types: [opened, synchronize, reopened]

env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
Expand All @@ -17,7 +19,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
command: ['lint', 'lint:attw', 'lint:pub', 'test', 'test:tsd', 'type:check']
command: ['lint', 'lint:attw', 'lint:pub', 'test', 'test:tsd', 'type:check', 'build']
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/code-coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ on:
- main
pull_request:
types: [opened, synchronize, reopened]
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
quality:
Expand Down
14 changes: 7 additions & 7 deletions turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
"build": { "dependsOn": ["^build"], "outputs": ["dist/**", ".next/**", "build/**"] },
"build:watch": { "outputs": ["dist/**"] },
"npm:publish": { "dependsOn": ["^build"] },
"lint": { "cache": false },
"lint:attw": { "dependsOn": ["^build"], "cache": false },
"lint:pub": { "cache": false },
"test": { "dependsOn": ["^build"], "outputs": ["coverage/**"], "cache": false },
"lint": {},
"lint:attw": { "dependsOn": ["^build"] },
"lint:pub": {},
"test": { "dependsOn": ["^prepack"], "outputs": ["coverage/**"] },
"test:tsd": {},
"test:watch": { "cache": false },
"prepack": { "dependsOn": ["^prepack"], "cache": false },
"dev": { "dependsOn": ["^prepack"], "cache": false },
"test:watch": { "dependsOn": ["^prepack"], "outputs": ["coverage/**"] },
"prepack": { "dependsOn": ["^prepack"], "outputs": ["dist/**"] },
"dev": { "dependsOn": ["^prepack"] },
"type:check": { "dependsOn": ["^build"] }
},
"globalEnv": ["NODE_ENV"]
Expand Down

2 comments on commit 0d7f7a0

@vercel
Copy link

@vercel vercel bot commented on 0d7f7a0 Nov 5, 2023

Choose a reason for hiding this comment

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

Successfully deployed to the following URLs:

visualization – ./websites/visualization

visualization.suspensive.org
visualization-git-main-suspensive.vercel.app
visualization-suspensive.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 0d7f7a0 Nov 5, 2023

Choose a reason for hiding this comment

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

Please sign in to comment.