Skip to content

Commit a507ae0

Browse files
committed
refactor: move lighthouseci to an independent job
This patch moves lighthouse ci related codes from `build` to an independent job in circleci config as we want to run lighthouse before PR merged but the `build` job has branch filter.
1 parent 7341d5f commit a507ae0

File tree

1 file changed

+32
-16
lines changed

1 file changed

+32
-16
lines changed

.circleci/config.yml

Lines changed: 32 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,7 @@ jobs:
1212
- image: circleci/node:10.15
1313
working_directory: ~/repo
1414
steps:
15-
- checkout
16-
17-
- browser-tools/install-chrome
15+
- checkout
1816

1917
# Download and cache dependencies
2018
- restore_cache:
@@ -30,19 +28,6 @@ jobs:
3028

3129
- run: make build RELEASE_BRANCH=${CIRCLE_BRANCH}
3230

33-
- run:
34-
name: run Lighthouse CI
35-
command: |
36-
sudo npm install -g @lhci/cli
37-
lhci autorun || echo "LHCI failed!"
38-
environment:
39-
# LHCI_SERVER_BASE_URL, LHCI_SERVER_USERNAME, LHCI_SERVER_PASSWORD, LHCI_TOKEN,
40-
# is defined in Environment Variables of circleci project
41-
LHCI_SERVER_BASE_URL=${LHCI_SERVER_BASE_URL}
42-
LHCI_USERNAME=${LHCI_SERVER_USERNAME}
43-
LHCI_PASSWORD=${LHCI_SERVER_PASSWORD}
44-
LHCI_TOKEN=${LHCI_TOKEN}
45-
4631
- run: rm -rf node_modules
4732

4833
# Download and cache dependencies for running
@@ -172,10 +157,41 @@ jobs:
172157
kubectl set image deployment/${DEPLOYMENT} ${APP}=gcr.io/${GOOGLE_PROJECT_ID}/${APP}:$CIRCLE_BRANCH-$PKG_VER -n $CLUSTER_NAMESPACE
173158
fi
174159
kubectl rollout status deployment/${DEPLOYMENT} -n $CLUSTER_NAMESPACE
160+
lighthouseci:
161+
docker:
162+
# specify the version you desire here
163+
- image: circleci/node:10.15
164+
working_directory: ~/repo
165+
steps:
166+
- checkout
167+
- browser-tools/install-chrome
168+
169+
# Download and cache dependencies
170+
- restore_cache:
171+
keys:
172+
- v1-dependencies-build-{{ checksum "yarn.lock" }}
173+
- run: yarn install --frozen-lockfile
174+
- save_cache:
175+
paths:
176+
- node_modules
177+
key: v1-dependencies-build-{{ checksum "yarn.lock" }}
178+
- run:
179+
name: run Lighthouse CI
180+
command: |
181+
sudo npm install -g @lhci/cli
182+
lhci autorun || echo "LHCI failed!"
183+
environment:
184+
# LHCI_SERVER_BASE_URL, LHCI_SERVER_USERNAME, LHCI_SERVER_PASSWORD, LHCI_TOKEN,
185+
# is defined in Environment Variables of circleci project
186+
LHCI_SERVER_BASE_URL=${LHCI_SERVER_BASE_URL}
187+
LHCI_USERNAME=${LHCI_SERVER_USERNAME}
188+
LHCI_PASSWORD=${LHCI_SERVER_PASSWORD}
189+
LHCI_TOKEN=${LHCI_TOKEN}
175190

176191
workflows:
177192
build_and_deploy:
178193
jobs:
194+
- lighthouseci:
179195
- build:
180196
filters:
181197
branches:

0 commit comments

Comments
 (0)