Skip to content

Commit 98461d3

Browse files
Dane Springmeyerlucaswoj
authored andcommitted
Reorganize CI scripts, fix CI deploy script
* ensure deploy.sh works * Further refinements to CI setup * Fix file permissions * Move cloudformation folder * test * Rejigger upload paths * Undo path changes * Fix bug in deploy script * Simplify deploy scripts * Re-enable tests * Fix script error
1 parent 1529e49 commit 98461d3

File tree

5 files changed

+59
-87
lines changed

5 files changed

+59
-87
lines changed

ci.sh

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

ci/dependencies.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# disable spotlight to ensure we waste no CPU on needless file indexing
2+
sudo mdutil -i off /;
3+
4+
if [[ ! -d ./nvm ]]; then
5+
git clone --depth 1 https://github.com/creationix/nvm.git ./nvm
6+
fi
7+
8+
source ./nvm/nvm.sh && nvm install ${NODE_VERSION}
9+
10+
if [ "$CIRCLE_BRANCH" == "master" ]; then
11+
source ./nvm/nvm.sh && nvm use ${NODE_VERSION} && npm update
12+
else
13+
source ./nvm/nvm.sh && nvm use ${NODE_VERSION} && npm install
14+
fi

deploy.sh renamed to ci/deploy.sh

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,24 @@
22

33
set -eu
44

5-
TAG=$CIRCLE_TAG
6-
PATH=$PATH:~/.local/bin
7-
8-
if [ -z $TAG ]; then
5+
if [ -z $CIRCLE_TAG ]; then
96
echo '$CIRCLE_TAG must be set'
107
exit 1
118
fi
129

1310
function upload {
14-
aws s3 cp --acl public-read --content-type $2 dist/$1 s3://mapbox-gl-js/$TAG/$1
15-
echo "upload: dist/$1 to s3://mapbox-gl-js/$TAG/$1"
11+
aws s3 cp --acl public-read --content-type $2 dist/$1 s3://mapbox-gl-js/$CIRCLE_TAG/$1
12+
echo "upload: dist/$1 to s3://mapbox-gl-js/$CIRCLE_TAG/$1"
1613
}
1714

18-
cnregions="
19-
cn-north-1
20-
"
21-
2215
function cn_upload {
23-
for region in cnregions; do
24-
aws s3 cp --region $region --acl public-read --content-type $2 dist/$1 s3://mapbox-gl-js-$region/$TAG/$1
25-
echo "upload: dist/$1 to s3://mapbox-gl-js-$region/$TAG/$1"
26-
done
16+
aws s3 cp --region cn-north-1 --acl public-read --content-type $2 dist/$1 s3://mapbox-gl-js-cn-north-1/$CIRCLE_TAG/$1
17+
echo "upload: dist/$1 to s3://mapbox-gl-js-cn-north-1/$CIRCLE_TAG/$1"
2718
}
2819

20+
pip install --user --upgrade awscli
21+
PATH=$(python -m site --user-base)/bin:${PATH}
22+
2923
npm run build-dev
3024
npm run build-min
3125

ci/test.sh

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/usr/bin/env bash
2+
3+
source ./nvm/nvm.sh
4+
nvm use ${NODE_VERSION}
5+
6+
set -eu
7+
set -o pipefail
8+
9+
# add npm packages to $PATH
10+
PATH=$(pwd)/node_modules/.bin:$PATH
11+
12+
# set up code coverage instrumentation
13+
rm -rf coverage .nyc_output
14+
15+
# run linters
16+
npm run lint
17+
18+
# build and run build tests
19+
npm run build-min
20+
npm run build-dev
21+
22+
# run unit tests
23+
tap --reporter dot --coverage --no-coverage-report test/js/*/*.js test/build/webpack.test.js
24+
25+
# run render tests
26+
istanbul cover --dir .nyc_output --include-pid --report none --print none test/render.test.js &&
27+
istanbul cover --dir .nyc_output --include-pid --report none --print none test/query.test.js
28+
29+
# send coverage report to coveralls
30+
nyc report --reporter=lcov
31+
(node ./node_modules/coveralls/bin/coveralls.js < ./coverage/lcov.info) || true
32+
33+
exit $EXIT_CODE

circle.yml

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,28 +10,15 @@ dependencies:
1010
cache_directories:
1111
- './nvm'
1212
override:
13-
# disable spotlight to ensure we waste no CPU on needless file indexing
14-
- if [[ $(uname -s) == 'Darwin' ]]; then sudo mdutil -i off /; fi;
15-
- |
16-
if [[ ! -d ./nvm ]]; then
17-
git clone --depth 1 https://github.com/creationix/nvm.git ./nvm
18-
fi
19-
- source ./nvm/nvm.sh && nvm install ${NODE_VERSION}
20-
- |
21-
if [ "$(git symbolic-ref --short -q HEAD)" == "master" ]; then
22-
source ./nvm/nvm.sh && nvm use ${NODE_VERSION} && npm update
23-
else
24-
source ./nvm/nvm.sh && nvm use ${NODE_VERSION} && npm install
25-
fi
13+
- ./ci/dependencies.sh
2614
test:
2715
override:
28-
- ./ci.sh
16+
- ./ci/test.sh
2917
deployment:
3018
release:
31-
tag: /v[0-9]+\.[0-9]+\.[0-9]+/
19+
tag: /v[0-9]+\.[0-9]+\.[0-9]+(\-dev)?/
3220
commands:
33-
- pip install awscli --user
34-
- ./deploy.sh
21+
- ./ci/deploy.sh
3522
general:
3623
artifacts:
3724
- "node_modules/mapbox-gl-test-suite/render-tests/index.html"

0 commit comments

Comments
 (0)