Skip to content

Commit 56fedd8

Browse files
Merge pull request #206 from commitd/stuarthendren/commitlint
Updates the CI process
2 parents 0575357 + 47193c2 commit 56fedd8

File tree

15 files changed

+13982
-19742
lines changed

15 files changed

+13982
-19742
lines changed

.eslintcache

Lines changed: 0 additions & 1 deletion
This file was deleted.

.github/workflows/build.yml

Lines changed: 0 additions & 56 deletions
This file was deleted.

.github/workflows/ci.yml

Lines changed: 256 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,256 @@
1+
name: ci
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- beta
8+
pull_request:
9+
types: [opened, synchronize, reopened]
10+
11+
concurrency:
12+
group: ${{ github.ref }}-${{ github.head_ref }}
13+
cancel-in-progress: true
14+
15+
env:
16+
NODE_VERSION: 14
17+
18+
jobs:
19+
install-cache:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout Commit
23+
uses: actions/checkout@v2
24+
with:
25+
fetch-depth: 0
26+
- name: Use Node.js
27+
uses: actions/setup-node@v1
28+
with:
29+
node-version: ${{ env.NODE_VERSION }}
30+
- name: npm 7
31+
run: npm i -g npm@7 --registry=https://registry.npmjs.org
32+
- name: Cache dependencies
33+
uses: actions/cache@v2
34+
id: cache-dependencies
35+
with:
36+
path: node_modules
37+
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
38+
restore-keys: |
39+
${{ runner.os }}-npm-
40+
- name: Install Dependencies
41+
if: steps.cache-dependencies.outputs.cache-hit != 'true'
42+
run: |
43+
npm install
44+
static-analysis:
45+
runs-on: ubuntu-latest
46+
needs: install-cache
47+
steps:
48+
- name: Checkout Commit
49+
uses: actions/checkout@v2
50+
with:
51+
fetch-depth: 0
52+
- name: Use Node.js
53+
uses: actions/setup-node@v1
54+
with:
55+
node-version: ${{ env.NODE_VERSION }}
56+
- name: npm 7
57+
run: npm i -g npm@7 --registry=https://registry.npmjs.org
58+
- name: Restore dependencies
59+
uses: actions/cache@v2
60+
id: cache-dependencies
61+
with:
62+
path: node_modules
63+
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
64+
restore-keys: |
65+
${{ runner.os }}-npm-
66+
- name: Run prettier
67+
run: |
68+
npm run format:check
69+
- name: Run lint
70+
run: |
71+
npm run lint
72+
- name: Danger
73+
if: github.event_name == 'pull_request'
74+
run: npm run danger:pr -- ci
75+
env:
76+
PR: ${{ github.event.number }}
77+
DANGER_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
78+
unit-test-scan:
79+
runs-on: ubuntu-latest
80+
needs: install-cache
81+
steps:
82+
- name: Checkout Commit
83+
uses: actions/checkout@v2
84+
with:
85+
fetch-depth: 0
86+
- name: Use Node.js
87+
uses: actions/setup-node@v1
88+
with:
89+
node-version: ${{ env.NODE_VERSION }}
90+
- name: npm 7
91+
run: npm i -g npm@7 --registry=https://registry.npmjs.org
92+
- name: Restore dependencies
93+
uses: actions/cache@v2
94+
id: cache-dependencies
95+
with:
96+
path: node_modules
97+
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
98+
restore-keys: |
99+
${{ runner.os }}-npm-
100+
- name: Run tests
101+
run: |
102+
npm run test
103+
- name: SonarCloud Scan
104+
uses: sonarsource/sonarcloud-github-action@master
105+
env:
106+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
107+
SONAR_TOKEN: ${{ secrets.SONAR_CLOUD_TOKEN }}
108+
build:
109+
runs-on: ubuntu-latest
110+
needs: [static-analysis, unit-test-scan]
111+
steps:
112+
- name: Checkout Commit
113+
uses: actions/checkout@v2
114+
with:
115+
fetch-depth: 0
116+
- name: Use Node.js
117+
uses: actions/setup-node@v1
118+
with:
119+
node-version: ${{ env.NODE_VERSION }}
120+
- name: npm 7
121+
run: npm i -g npm@7 --registry=https://registry.npmjs.org
122+
- name: Restore dependencies
123+
uses: actions/cache@v2
124+
id: cache-dependencies
125+
with:
126+
path: node_modules
127+
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
128+
restore-keys: |
129+
${{ runner.os }}-npm-
130+
- name: Run lint
131+
run: |
132+
npm run build
133+
- name: Upload build artifacts
134+
uses: actions/upload-artifact@v2
135+
with:
136+
name: build-output
137+
path: dist
138+
retention-days: 1
139+
build-example:
140+
runs-on: ubuntu-latest
141+
needs: build
142+
steps:
143+
- name: Checkout Commit
144+
uses: actions/checkout@v2
145+
with:
146+
fetch-depth: 0
147+
- name: Use Node.js
148+
uses: actions/setup-node@v1
149+
with:
150+
node-version: ${{ env.NODE_VERSION }}
151+
- name: npm 7
152+
run: npm i -g npm@7 --registry=https://registry.npmjs.org
153+
- name: Download build artifacts
154+
uses: actions/download-artifact@v2
155+
with:
156+
name: build-output
157+
path: dist
158+
- name: Restore dependencies
159+
uses: actions/cache@v2
160+
id: cache-dependencies
161+
with:
162+
path: node_modules
163+
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
164+
restore-keys: |
165+
${{ runner.os }}-npm-
166+
- name: Check example
167+
run: |
168+
npm install
169+
npm run build
170+
working-directory: ./example
171+
build-storybook:
172+
if: github.event_name == 'pull_request'
173+
runs-on: ubuntu-latest
174+
needs: build
175+
steps:
176+
- name: Checkout Commit
177+
uses: actions/checkout@v2
178+
with:
179+
fetch-depth: 0
180+
- name: Use Node.js
181+
uses: actions/setup-node@v1
182+
with:
183+
node-version: ${{ env.NODE_VERSION }}
184+
- name: npm 7
185+
run: npm i -g npm@7 --registry=https://registry.npmjs.org
186+
- name: Restore dependencies
187+
uses: actions/cache@v2
188+
id: cache-dependencies
189+
with:
190+
path: node_modules
191+
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
192+
restore-keys: |
193+
${{ runner.os }}-npm-
194+
- name: Build Storybook
195+
run: npm run build-storybook --quiet
196+
release:
197+
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/beta'
198+
runs-on: ubuntu-latest
199+
needs: build
200+
steps:
201+
- name: Checkout Commit
202+
uses: actions/checkout@v2
203+
with:
204+
fetch-depth: 0
205+
- name: Use Node.js
206+
uses: actions/setup-node@v1
207+
with:
208+
node-version: ${{ env.NODE_VERSION }}
209+
- name: npm 7
210+
run: npm i -g npm@7 --registry=https://registry.npmjs.org
211+
- name: Restore dependencies
212+
uses: actions/cache@v2
213+
id: cache-dependencies
214+
with:
215+
path: node_modules
216+
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
217+
restore-keys: |
218+
${{ runner.os }}-npm-
219+
- name: Download build artifacts
220+
uses: actions/download-artifact@v2
221+
with:
222+
name: build-output
223+
path: dist
224+
- name: Release
225+
env:
226+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
227+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
228+
run: npx semantic-release
229+
publish-storybook:
230+
runs-on: ubuntu-latest
231+
needs: release
232+
steps:
233+
- name: Checkout Commit
234+
uses: actions/checkout@v2
235+
with:
236+
persist-credentials: false
237+
fetch-depth: 0
238+
- name: Use Node.js
239+
uses: actions/setup-node@v1
240+
with:
241+
node-version: ${{ env.NODE_VERSION }}
242+
- name: npm 7
243+
run: npm i -g npm@7 --registry=https://registry.npmjs.org
244+
- name: Restore dependencies
245+
uses: actions/cache@v2
246+
id: cache-dependencies
247+
with:
248+
path: node_modules
249+
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
250+
restore-keys: |
251+
${{ runner.os }}-npm-
252+
- name: Publish Storybook
253+
if: github.ref == 'refs/heads/main'
254+
run: npm run deploy-storybook -- --ci
255+
env:
256+
GH_TOKEN: ${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yml

Lines changed: 0 additions & 54 deletions
This file was deleted.

.github/workflows/size.yml

Lines changed: 0 additions & 12 deletions
This file was deleted.

.husky/commit-msg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
. "$(dirname "$0")/_/husky.sh"
33

44
npx --no-install commitlint --edit ""
5+
npx --no-install commitlint --edit ""

example/.proxyrc.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = function (app) {
2+
app.use((req, res, next) => {
3+
res.removeHeader('Cross-Origin-Resource-Policy')
4+
res.removeHeader('Cross-Origin-Embedder-Policy')
5+
next()
6+
})
7+
}

0 commit comments

Comments
 (0)