Skip to content

Commit 04ab817

Browse files
authored
build: yarn berry migration (patw0929#386)
* build: yarn berry * ci: yarn cache * chore: cov call syntax * chore: linker mode * chore: reuse n modules * chore: reuse n modules * ci: skip yarn install if cache hit * ci: coveralls split * ci: recursion
1 parent be281b6 commit 04ab817

File tree

7 files changed

+24211
-16223
lines changed

7 files changed

+24211
-16223
lines changed

.github/workflows/main.yml

+15-10
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ jobs:
1919
with:
2020
node-version: ${{ env.NODE_VERSION }}
2121
- uses: actions/cache@v2
22-
id: cache-restore
22+
id: yarn-cache-restore
2323
with:
2424
path: |
2525
node_modules
2626
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ env.NODE_VERSION }}
2727
- name: Install dependencies
28-
if: steps.cache-restore.outputs.cache-hit != 'true'
28+
if: steps.yarn-cache-restore.outputs.cache-hit != 'true'
2929
run: yarn
3030
lint:
3131
runs-on: ubuntu-latest
@@ -44,9 +44,10 @@ jobs:
4444
path: |
4545
node_modules
4646
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ env.NODE_VERSION }}
47+
- if: steps.yarn-cache-restore.outputs.cache-hit != 'true'
48+
run: yarn
4749
- name: Lint
4850
run: |
49-
yarn
5051
yarn lint
5152
test:
5253
runs-on: ubuntu-latest
@@ -65,11 +66,14 @@ jobs:
6566
path: |
6667
node_modules
6768
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ env.NODE_VERSION }}
69+
- if: steps.yarn-cache-restore.outputs.cache-hit != 'true'
70+
run: yarn
6871
- name: Tests
6972
run: |
70-
yarn
7173
yarn coverage
72-
yarn coveralls
74+
- name: Coverage upload
75+
run: |
76+
yarn coverage-upload
7377
build:
7478
runs-on: ubuntu-latest
7579
name: Build
@@ -87,8 +91,9 @@ jobs:
8791
path: |
8892
node_modules
8993
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ env.NODE_VERSION }}
94+
- if: steps.yarn-cache-restore.outputs.cache-hit != 'true'
95+
run: yarn
9096
- run: |
91-
yarn
9297
yarn build
9398
- name: Build Artifacts
9499
uses: actions/upload-artifact@v2
@@ -120,18 +125,18 @@ jobs:
120125
with:
121126
name: build-artifacts
122127
path: dist
128+
- if: steps.yarn-cache-restore.outputs.cache-hit != 'true'
129+
run: yarn
123130
- name: Release (dry)
124131
if: ${{ github.ref != 'refs/heads/master' }}
125132
run: |
126-
yarn
127133
yarn semantic-release --ci --dry-run
128134
- name: Release
129135
if: ${{ github.ref == 'refs/heads/master' }}
130136
env:
131137
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
132138
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
133139
run: |
134-
yarn
135140
yarn semantic-release --ci
136141
website-deploy:
137142
runs-on: ubuntu-latest
@@ -150,15 +155,15 @@ jobs:
150155
path: |
151156
node_modules
152157
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}-${{ env.NODE_VERSION }}
158+
- if: steps.yarn-cache-restore.outputs.cache-hit != 'true'
159+
run: yarn
153160
- name: Deploy (dry)
154161
if: ${{ github.ref != 'refs/heads/master' }}
155162
run: |
156-
yarn
157163
yarn deploy:dryrun
158164
- name: Deploy
159165
if: ${{ github.ref == 'refs/heads/master' }}
160166
env:
161167
GH_TOKEN: ${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}
162168
run: |
163-
yarn
164169
yarn deploy

.gitignore

+9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
## Yarn
2+
.yarn/*
3+
!.yarn/patches
4+
!.yarn/releases
5+
!.yarn/plugins
6+
!.yarn/sdks
7+
!.yarn/versions
8+
.pnp.*
9+
110
### SublimeText ###
211
*.sublime-workspace
312

.npmrc

-1
This file was deleted.

.yarn/releases/yarn-berry.cjs

+631
Large diffs are not rendered by default.

.yarnrc.yml

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
nodeLinker: node-modules
2+
yarnPath: .yarn/releases/yarn-berry.cjs
3+
npmPublishRegistry: "https://registry.npmjs.com/"

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@
116116
"deploy:dryrun": "storybook-to-ghpages --dry-run",
117117
"deploy": "storybook-to-ghpages -- --ci",
118118
"lint": "eslint src *.js",
119-
"coverage": "yarn run test -- --coverage",
120-
"coveralls": "NODE_ENV=development cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",
119+
"coverage": "yarn test --coverage",
120+
"coverage-upload": "NODE_ENV=development cat coverage/lcov.info | yarn coveralls",
121121
"test": "jest src",
122122
"test:watch": "jest src --watchAll --coverage",
123123
"footprint": "yarn build && yarn packwatch",

0 commit comments

Comments
 (0)