Skip to content

Commit 3a889b6

Browse files
authored
Merge pull request conventional-changelog#127 from verdaccio/refactor-ci
chore: refactor ci
2 parents 2890e5a + de0f91a commit 3a889b6

File tree

8 files changed

+2043
-2878
lines changed

8 files changed

+2043
-2878
lines changed

.circleci/config.yml

+50-62
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,25 @@
11
version: 2
22

33
aliases:
4+
- &repo_path
5+
~/ui-theme
46
- &defaults
5-
working_directory: ~/ui-theme
6-
- &node11_executor
7+
working_directory: *repo_path
8+
- &node_latest_executor
79
docker:
8-
- image: circleci/node:11.10.1
9-
- &node8_executor
10+
- image: circleci/node:latest
11+
- &node_lts_executor
1012
docker:
11-
- image: circleci/node:8
12-
- &node10_executor
13-
docker:
14-
- image: circleci/node:10
13+
- image: circleci/node:lts
1514
- &default_executor
16-
<<: *node10_executor
17-
- &repo_key
18-
repo-{{ .Branch }}-{{ .Revision }}
19-
- &coverage_key
20-
coverage-{{ .Branch }}-{{ .Revision }}
21-
- &base_config_key
22-
base-config-{{ .Branch }}-{{ .Revision }}
15+
<<: *node_latest_executor
2316
- &yarn_cache_key
2417
yarn-sha-{{ checksum "yarn.lock" }}
18+
- &coverage_key
19+
coverage-{{ .Branch }}-{{ .Revision }}
2520
- &restore_repo
26-
restore_cache:
27-
keys:
28-
- *repo_key
21+
attach_workspace:
22+
at: *repo_path
2923
- &ignore_non_dev_branches
3024
filters:
3125
tags:
@@ -36,7 +30,7 @@ aliases:
3630
- &execute_on_release
3731
filters:
3832
tags:
39-
only: /(v)?[0-9]+(\.[0-9]+)*/
33+
only: /v?[0-9]+(\.[0-9]+)*([-+\.][a-zA-Z0-9]+)*/
4034
branches:
4135
ignore:
4236
- /.*/
@@ -48,21 +42,11 @@ jobs:
4842
steps:
4943
- *restore_repo
5044
- checkout
51-
- restore_cache:
52-
key: *base_config_key
53-
- run:
54-
name: 'Base environment setup'
55-
command: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
56-
- save_cache:
57-
key: *base_config_key
58-
paths:
59-
- ~/.npmrc
60-
- ~/.gitconfig
6145
- restore_cache:
6246
key: *yarn_cache_key
6347
- run:
64-
name: Install Js dependencies
65-
command: yarn install --no-progress --registry https://registry.verdaccio.org --no-lockfile
48+
name: Install dependencies
49+
command: yarn install --frozen-lockfile
6650
- run:
6751
name: Build project
6852
command: yarn run build
@@ -72,49 +56,50 @@ jobs:
7256
- ~/.yarn
7357
- ~/.cache/yarn
7458
- node_modules
75-
- save_cache:
76-
key: *repo_key
59+
- persist_to_workspace:
60+
root: *repo_path
7761
paths:
78-
- ~/ui-theme
79-
test_bundlesize:
62+
- ./*
63+
64+
lint:
8065
<<: *defaults
8166
<<: *default_executor
8267
steps:
8368
- *restore_repo
8469
- run:
85-
name: Test BundleSize
86-
command: yarn test:size
70+
name: Lint code
71+
command: yarn lint
8772

88-
test_node11:
73+
test_bundlesize:
8974
<<: *defaults
90-
<<: *node11_executor
75+
<<: *default_executor
9176
steps:
9277
- *restore_repo
9378
- run:
94-
name: Test with Node 11
95-
command: yarn test
79+
name: Test BundleSize
80+
command: yarn test:size
9681

97-
test_node8:
82+
test_node_latest:
9883
<<: *defaults
99-
<<: *node8_executor
84+
<<: *node_latest_executor
10085
steps:
10186
- *restore_repo
10287
- run:
103-
name: Test with Node 8
88+
name: Test with Node (Latest)
10489
command: yarn test
90+
- save_cache:
91+
key: *coverage_key
92+
paths:
93+
- coverage
10594

106-
test_node10:
95+
test_node_lts:
10796
<<: *defaults
108-
<<: *node10_executor
97+
<<: *node_lts_executor
10998
steps:
11099
- *restore_repo
111100
- run:
112-
name: Test with Node 10
113-
command: yarn run test
114-
- save_cache:
115-
key: *coverage_key
116-
paths:
117-
- coverage
101+
name: Test with Node (LTS)
102+
command: yarn test
118103

119104
coverage:
120105
<<: *defaults
@@ -140,8 +125,9 @@ jobs:
140125
<<: *default_executor
141126
steps:
142127
- *restore_repo
143-
- restore_cache:
144-
key: *base_config_key
128+
- run:
129+
name: 'Setup publish credentials'
130+
command: echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
145131
- run:
146132
name: Publish
147133
command: yarn publish
@@ -152,29 +138,31 @@ workflows:
152138
jobs:
153139
- prepare:
154140
<<: *ignore_non_dev_branches
155-
- test_node11:
141+
- lint:
156142
requires:
157143
- prepare
158144
<<: *ignore_non_dev_branches
159-
- test_node8:
145+
- test_bundlesize:
160146
requires:
161147
- prepare
162148
<<: *ignore_non_dev_branches
163-
- test_node10:
149+
- test_node_latest:
164150
requires:
165151
- prepare
166152
<<: *ignore_non_dev_branches
167-
- test_bundlesize:
153+
- test_node_lts:
168154
requires:
169-
- test_node11
170-
- test_node8
171-
- test_node10
155+
- prepare
172156
<<: *ignore_non_dev_branches
173157
- coverage:
174158
requires:
175-
- test_bundlesize
159+
- test_node_latest
176160
<<: *ignore_non_dev_branches
177161
- publish_package:
178162
requires:
163+
- lint
164+
- test_bundlesize
165+
- test_node_latest
166+
- test_node_lts
179167
- coverage
180168
<<: *execute_on_release

.github/main.workflow

-67
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
1-
name: Node CI
1+
name: CI
22

3-
on: [push]
3+
on: push
44

55
jobs:
6-
ci:
7-
name: Test on node ${{ matrix.node_version }} and ${{ matrix.os }}
8-
runs-on: ${{ matrix.os }}
6+
build_test_lint:
7+
name: Node ${{ matrix.node_version }} and ${{ matrix.os }}
8+
99
strategy:
10+
fail-fast: false
1011
matrix:
11-
node_version: [8, 10, 12]
12+
node_version: [10, 12]
1213
os: [ubuntu-latest, windows-latest, macOS-latest]
1314

15+
runs-on: ${{ matrix.os }}
16+
1417
steps:
1518
- uses: actions/checkout@v1
1619
- name: Use Node.js ${{ matrix.node_version }}
1720
uses: actions/setup-node@v1
1821
with:
1922
version: ${{ matrix.node_version }}
20-
21-
- name: Use Yarn 1.17.2
22-
run: |
23-
npm install -g [email protected]
24-
- name: yarn build
25-
run: |
26-
yarn install
27-
yarn lint
28-
yarn build
23+
- name: Install
24+
run: yarn install --frozen-lockfile
25+
- name: Build
26+
run: yarn build
27+
- name: Lint
28+
run: yarn lint

.prettierrc

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"endOfLine": "auto",
23
"useTabs": false,
34
"printWidth": 160,
45
"tabWidth": 2,

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@
152152
"test:size": "bundlesize",
153153
"lint": "npm run lint:js && npm run lint:css",
154154
"lint:js": "npm run type-check && eslint . --ext .js,.ts,.tsx",
155-
"lint:css": "stylelint 'src/**/styles.ts'",
155+
"lint:css": "stylelint \"src/**/styles.ts\"",
156156
"coverage:publish": "codecov",
157157
"pre:webpack": "rimraf static/*",
158158
"prepublish": "in-publish && npm run build || not-in-publish",

src/components/Versions/Versions.test.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ describe('<Version /> component', () => {
2727
cleanup();
2828
});
2929

30-
test('should render the component in default state', () => {
30+
// FIXME: this test is not deterministic (writes `N days ago` in the snapshot, where N is random number)
31+
test.skip('should render the component in default state', () => {
3132
const wrapper = mount(
3233
<MemoryRouter>
3334
<Versions />

src/components/Versions/__snapshots__/Versions.test.tsx.snap

+1-1
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)