Skip to content

Commit

Permalink
Integrate mbx-ci with mapbox-gl-directions (#280)
Browse files Browse the repository at this point in the history
* add in blank line to test

* Attempt adding in mbx-ci

* Attempt to fix schema error in config.yml

* fixed yml formatting

* fix yml formatting

* removed blank line to test circle ci

* bumped aws-cli back to 0.1.16, receiving aws related errors

* Fix unit test fail

* Remove blank line to trigger circle ci run

* potential unit test fix

* remove changes to unit tests

* Sometimes request does not have responseText and needs to return dispatch 'error' to continue tests

* formatting
  • Loading branch information
avpeery authored Jan 6, 2022
1 parent 2dadf74 commit 7bdc5ca
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 22 deletions.
74 changes: 53 additions & 21 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
version: 2.1
orbs:
aws-cli: circleci/[email protected]

workflows:
version: 2
default:
Expand All @@ -10,6 +9,14 @@ workflows:
filters:
tags:
only: /.*/
- install-mbx-ci:
requires:
- prepare
filters:
tags:
only: /.*/
branches:
ignore: '/pull\/[0-9]*/'
- build:
requires:
- prepare
Expand All @@ -33,68 +40,93 @@ workflows:
- build
filters:
tags:
only: /v[0-9]+\.[0-9]+\.[0-9]+(\-dev)?/
only: '/v[0-9]+\.[0-9]+\.[0-9]+(\-dev)?/'
branches:
ignore: /.*/

defaults: &defaults
docker:
- image: circleci/node:10.16-browsers
defaults:
docker: &ref_0
- image: 'circleci/node:10.16-browsers'
working_directory: ~/mapbox-gl-directions

jobs:
prepare:
<<: *defaults
docker: *ref_0
working_directory: ~/mapbox-gl-directions
steps:
- checkout
- restore_cache:
keys: v1-yarn-{{ checksum "yarn.lock" }}
keys: 'v1-yarn-{{ checksum "yarn.lock" }}'
- run: yarn
- save_cache:
key: v1-yarn-{{ checksum "yarn.lock" }}
key: 'v1-yarn-{{ checksum "yarn.lock" }}'
paths:
- "~/.yarn"
- "node_modules"
- ~/.yarn
- node_modules
- persist_to_workspace:
root: .
paths:
- .
install-mbx-ci:
docker: *ref_0
working_directory: ~/mapbox-gl-directions
steps:
- run:
name: Install mbx-ci
command: >
curl -Ls
https://mapbox-release-engineering.s3.amazonaws.com/mbx-ci/latest/mbx-ci-linux-amd64
> ~/mbx-ci &&
chmod 755 ~/mbx-ci &&
~/mbx-ci aws setup
- persist_to_workspace:
root: ~/
paths:
- .ssh
- .aws
- mbx-ci
build:
<<: *defaults
docker: *ref_0
working_directory: ~/mapbox-gl-directions
steps:
- attach_workspace:
at: .
- run: yarn run build
- store_artifacts:
path: "dist"
path: dist
- persist_to_workspace:
root: .
paths:
- dist
lint:
<<: *defaults
docker: *ref_0
working_directory: ~/mapbox-gl-directions
steps:
- attach_workspace:
at: .
- restore_cache:
keys:
- v2-lint-{{ .Branch }}
- 'v2-lint-{{ .Branch }}'
- v2-lint
- run: yarn run lint
- save_cache:
key: v2-lint-{{ .Branch }}-{{ .Revision }}
key: 'v2-lint-{{ .Branch }}-{{ .Revision }}'
paths:
- ".eslintcache"
- .eslintcache
test:
<<: *defaults
docker: *ref_0
working_directory: ~/mapbox-gl-directions
steps:
- attach_workspace:
at: .
- run: yarn run test
publish:
<<: *defaults
docker: *ref_0
working_directory: ~/mapbox-gl-directions
steps:
- attach_workspace:
at: .
- aws-cli/install
- run: aws s3 cp --recursive --acl public-read dist s3://mapbox-gl-js/plugins/mapbox-gl-directions/$CIRCLE_TAG
- run: >-
aws s3 cp --recursive --acl public-read dist
s3://mapbox-gl-js/plugins/mapbox-gl-directions/$CIRCLE_TAG
3 changes: 2 additions & 1 deletion src/actions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ function fetchDirections() {

request.onerror = () => {
dispatch(setDirections([]));
return dispatch(setError(JSON.parse(request.responseText).message));
if (request.responseText) return dispatch(setError(JSON.parse(request.responseText).message));
return dispatch(setError('Error'));
};

request.send();
Expand Down

0 comments on commit 7bdc5ca

Please sign in to comment.