Skip to content

Commit 2e3d963

Browse files
committed
chore(ci):Create new github workflow
jira: STARGAZER-2760
1 parent bceeaf1 commit 2e3d963

File tree

1 file changed

+122
-0
lines changed

1 file changed

+122
-0
lines changed

.github/workflows/build.yml

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
env:
10+
NODE_VERSION: 14
11+
12+
jobs:
13+
tests:
14+
name: Unit tests
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout
19+
uses: actions/checkout@v2
20+
21+
- name: Setup Node.js
22+
uses: actions/setup-node@v2
23+
with:
24+
node-version: ${{ env.NODE_VERSION }}
25+
26+
- name: Cache node_modules
27+
uses: actions/cache@v2
28+
id: cache-nodemodules
29+
with:
30+
path: node_modules
31+
key: ${{ runner.os }}-${{ env.NODE_VERSION }}-nodemodules-${{ hashFiles('**/yarn.lock') }}
32+
33+
- name: Install dependencies
34+
if: steps.cache-nodemodules.outputs.cache-hit != 'true'
35+
run: yarn install --frozen-lockfile --non-interactive
36+
37+
- name: Unit tests
38+
run: yarn test --ci --coverage
39+
40+
- name: Upload coverage to Codecov
41+
uses: codecov/codecov-action@v1
42+
with:
43+
files: ./coverage/coverage-final.json
44+
fail_ci_if_error: true
45+
46+
lint:
47+
name: Lint
48+
runs-on: ubuntu-latest
49+
50+
steps:
51+
- name: Checkout
52+
uses: actions/checkout@v2
53+
54+
- name: Setup Node.js
55+
uses: actions/setup-node@v2
56+
with:
57+
node-version: ${{ env.NODE_VERSION }}
58+
59+
- name: Cache node_modules
60+
uses: actions/cache@v2
61+
id: cache-nodemodules
62+
with:
63+
path: node_modules
64+
key: ${{ runner.os }}-${{ env.NODE_VERSION }}-nodemodules-${{ hashFiles('**/yarn.lock') }}
65+
66+
- name: Install dependencies
67+
if: steps.cache-nodemodules.outputs.cache-hit != 'true'
68+
run: yarn install --frozen-lockfile --non-interactive
69+
70+
- name: Lint
71+
run: yarn lint
72+
73+
docs:
74+
needs: [tests, lint]
75+
if: github.ref == 'refs/heads/main'
76+
name: Update docs
77+
runs-on: ubuntu-latest
78+
79+
steps:
80+
- name: Generate storybook documentation
81+
run: yarn build:storybook
82+
83+
- name: Generate storybook documentation
84+
run: yarn build:storybook
85+
uses: JamesIves/[email protected]
86+
with:
87+
branch: gh-pages # The branch the action should deploy to.
88+
folder: .docs # The folder the action should deploy.
89+
90+
release:
91+
needs: [tests, lint, docs]
92+
if: github.ref == 'refs/heads/main'
93+
name: Release
94+
runs-on: ubuntu-latest
95+
96+
steps:
97+
- name: Checkout
98+
uses: actions/checkout@v2
99+
with:
100+
fetch-depth: 0
101+
102+
- name: Setup Node.js
103+
uses: actions/setup-node@v2
104+
with:
105+
node-version: ${{ env.NODE_VERSION }}
106+
107+
- name: Cache node_modules
108+
uses: actions/cache@v2
109+
id: cache-nodemodules
110+
with:
111+
path: node_modules
112+
key: ${{ runner.os }}-${{ env.NODE_VERSION }}-nodemodules-${{ hashFiles('**/yarn.lock') }}
113+
114+
- name: Install dependencies
115+
if: steps.cache-nodemodules.outputs.cache-hit != 'true'
116+
run: yarn install --frozen-lockfile --non-interactive
117+
118+
- name: Release
119+
run: yarn release
120+
env:
121+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
122+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

0 commit comments

Comments
 (0)