Skip to content

Commit bc6e02c

Browse files
committed
ci(perf): 👷 add perf improvements to ci builds
1 parent 1a8511e commit bc6e02c

File tree

9 files changed

+325
-114
lines changed

9 files changed

+325
-114
lines changed

.github/workflows/build.yml

-34
This file was deleted.

.github/workflows/lint.yml

-34
This file was deleted.

.github/workflows/main.yml

+133
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
branches:
8+
- main
9+
10+
jobs:
11+
install:
12+
name: Install node_modules
13+
runs-on: ubuntu-latest
14+
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v3
18+
19+
- name: Set up Node
20+
uses: actions/setup-node@v3
21+
with:
22+
node-version-file: .nvmrc
23+
24+
- name: Get yarn cache directory path
25+
id: yarn-cache-dir-path
26+
run: echo "::set-output name=dir::$(yarn cache dir)"
27+
28+
- name: Cache node_modules
29+
- uses: actions/cache@v3
30+
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
31+
with:
32+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
33+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
34+
restore-keys: |
35+
${{ runner.os }}-yarn-
36+
37+
- name: Install Dependencies
38+
if: steps.yarn-cache.outputs.cache-hit != 'true'
39+
run: yarn --prefer-offline --frozen-lockfile
40+
41+
lint:
42+
name: Lint
43+
needs: install
44+
runs-on: ubuntu-latest
45+
46+
steps:
47+
- name: Checkout repository
48+
uses: actions/checkout@v3
49+
50+
- name: Set up Node
51+
uses: actions/setup-node@v3
52+
with:
53+
node-version-file: .nvmrc
54+
55+
- name: Cache node_modules
56+
- uses: actions/cache@v3
57+
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
58+
with:
59+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
60+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
61+
restore-keys: |
62+
${{ runner.os }}-yarn-
63+
64+
- name: Install Dependencies
65+
if: steps.yarn-cache.outputs.cache-hit != 'true'
66+
run: yarn --prefer-offline --frozen-lockfile
67+
68+
- name: Lint
69+
run: yarn lint
70+
71+
build:
72+
name: Build
73+
needs: install
74+
runs-on: ubuntu-latest
75+
76+
steps:
77+
- name: Checkout repository
78+
uses: actions/checkout@v3
79+
80+
- name: Set up Node
81+
uses: actions/setup-node@v3
82+
with:
83+
node-version-file: .nvmrc
84+
85+
- name: Cache node_modules
86+
- uses: actions/cache@v3
87+
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
88+
with:
89+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
90+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
91+
restore-keys: |
92+
${{ runner.os }}-yarn-
93+
94+
- name: Install Dependencies
95+
if: steps.yarn-cache.outputs.cache-hit != 'true'
96+
run: yarn --prefer-offline --frozen-lockfile
97+
98+
- name: Built
99+
run: yarn build
100+
101+
test:
102+
name: Test (${{ matrix.shard }})
103+
needs: install
104+
runs-on: ubuntu-latest
105+
strategy:
106+
fail-fast: false
107+
matrix:
108+
shard: ["1/2", "2/2"]
109+
110+
steps:
111+
- name: Checkout repository
112+
uses: actions/checkout@v3
113+
114+
- name: Set up Node
115+
uses: actions/setup-node@v3
116+
with:
117+
node-version-file: .nvmrc
118+
119+
- name: Cache node_modules
120+
- uses: actions/cache@v3
121+
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
122+
with:
123+
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
124+
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
125+
restore-keys: |
126+
${{ runner.os }}-yarn-
127+
128+
- name: Install Dependencies
129+
if: steps.yarn-cache.outputs.cache-hit != 'true'
130+
run: yarn --prefer-offline --frozen-lockfile
131+
132+
- name: Test
133+
run: yarn test -- --maxWorkers 2 --shard ${{ matrix.shard }}

.github/workflows/test.yml

-41
This file was deleted.

.nvmrc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
16

.storybook/main.ts

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const config = {
1717
},
1818
},
1919
},
20+
"storybook-addon-turbo-build",
2021
],
2122
};
2223

.vscode/settings.json

+29-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,33 @@
11
{
22
"typescript.tsdk": "node_modules/typescript/lib",
33
"git.branchProtection": ["main"],
4-
"yaml.schemas": {
5-
"https://json.schemastore.org/github-workflow.json": "file:///Users/navin/Documents/github/react-tailwind/.github/workflows/build.yml"
6-
}
4+
"editor.tabSize": 2,
5+
"editor.guides.bracketPairs": true,
6+
"editor.rulers": [80, 100, 120],
7+
"editor.wordWrap": "bounded",
8+
"editor.wordWrapColumn": 120,
9+
"files.insertFinalNewline": true,
10+
"files.trimTrailingWhitespace": true,
11+
"files.eol": "\n",
12+
"editor.defaultFormatter": "esbenp.prettier-vscode",
13+
"prettier.enable": true,
14+
"editor.formatOnSave": true,
15+
"editor.codeActionsOnSave": {
16+
"source.addMissingImports": true,
17+
// "source.organizeImports": true,
18+
// "source.sortImports": true,
19+
// "source.fixAll": true
20+
"source.fixAll.eslint": true
21+
// "source.fixAll.stylelint": true
22+
},
23+
"eslint.enable": true,
24+
"eslint.useESLintClass": true,
25+
"eslint.validate": [
26+
"javascript",
27+
"javascriptreact",
28+
"vue",
29+
"typescript",
30+
"typescriptreact",
31+
"html"
32+
]
733
}

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@
179179
"size-limit": "5.0.5",
180180
"sort-package-json": "1.57.0",
181181
"storybook-addon-preview": "2.2.0",
182+
"storybook-addon-turbo-build": "^1.1.0",
182183
"tailwindcss": "3.1.4",
183184
"ts-node": "10.8.1",
184185
"tslib": "2.4.0",

0 commit comments

Comments
 (0)