Skip to content

Commit

Permalink
Reorganize CI scripts, fix CI deploy script
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Dane Springmeyer authored and lucaswoj committed Aug 12, 2016
1 parent 1529e49 commit 98461d3
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 87 deletions.
56 changes: 0 additions & 56 deletions ci.sh

This file was deleted.

14 changes: 14 additions & 0 deletions ci/dependencies.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# disable spotlight to ensure we waste no CPU on needless file indexing
sudo mdutil -i off /;

if [[ ! -d ./nvm ]]; then
git clone --depth 1 https://github.com/creationix/nvm.git ./nvm
fi

source ./nvm/nvm.sh && nvm install ${NODE_VERSION}

if [ "$CIRCLE_BRANCH" == "master" ]; then
source ./nvm/nvm.sh && nvm use ${NODE_VERSION} && npm update
else
source ./nvm/nvm.sh && nvm use ${NODE_VERSION} && npm install
fi
22 changes: 8 additions & 14 deletions deploy.sh → ci/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,24 @@

set -eu

TAG=$CIRCLE_TAG
PATH=$PATH:~/.local/bin

if [ -z $TAG ]; then
if [ -z $CIRCLE_TAG ]; then
echo '$CIRCLE_TAG must be set'
exit 1
fi

function upload {
aws s3 cp --acl public-read --content-type $2 dist/$1 s3://mapbox-gl-js/$TAG/$1
echo "upload: dist/$1 to s3://mapbox-gl-js/$TAG/$1"
aws s3 cp --acl public-read --content-type $2 dist/$1 s3://mapbox-gl-js/$CIRCLE_TAG/$1
echo "upload: dist/$1 to s3://mapbox-gl-js/$CIRCLE_TAG/$1"
}

cnregions="
cn-north-1
"

function cn_upload {
for region in cnregions; do
aws s3 cp --region $region --acl public-read --content-type $2 dist/$1 s3://mapbox-gl-js-$region/$TAG/$1
echo "upload: dist/$1 to s3://mapbox-gl-js-$region/$TAG/$1"
done
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
echo "upload: dist/$1 to s3://mapbox-gl-js-cn-north-1/$CIRCLE_TAG/$1"
}

pip install --user --upgrade awscli
PATH=$(python -m site --user-base)/bin:${PATH}

npm run build-dev
npm run build-min

Expand Down
33 changes: 33 additions & 0 deletions ci/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env bash

source ./nvm/nvm.sh
nvm use ${NODE_VERSION}

set -eu
set -o pipefail

# add npm packages to $PATH
PATH=$(pwd)/node_modules/.bin:$PATH

# set up code coverage instrumentation
rm -rf coverage .nyc_output

# run linters
npm run lint

# build and run build tests
npm run build-min
npm run build-dev

# run unit tests
tap --reporter dot --coverage --no-coverage-report test/js/*/*.js test/build/webpack.test.js

# run render tests
istanbul cover --dir .nyc_output --include-pid --report none --print none test/render.test.js &&
istanbul cover --dir .nyc_output --include-pid --report none --print none test/query.test.js

# send coverage report to coveralls
nyc report --reporter=lcov
(node ./node_modules/coveralls/bin/coveralls.js < ./coverage/lcov.info) || true

exit $EXIT_CODE
21 changes: 4 additions & 17 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,15 @@ dependencies:
cache_directories:
- './nvm'
override:
# disable spotlight to ensure we waste no CPU on needless file indexing
- if [[ $(uname -s) == 'Darwin' ]]; then sudo mdutil -i off /; fi;
- |
if [[ ! -d ./nvm ]]; then
git clone --depth 1 https://github.com/creationix/nvm.git ./nvm
fi
- source ./nvm/nvm.sh && nvm install ${NODE_VERSION}
- |
if [ "$(git symbolic-ref --short -q HEAD)" == "master" ]; then
source ./nvm/nvm.sh && nvm use ${NODE_VERSION} && npm update
else
source ./nvm/nvm.sh && nvm use ${NODE_VERSION} && npm install
fi
- ./ci/dependencies.sh
test:
override:
- ./ci.sh
- ./ci/test.sh
deployment:
release:
tag: /v[0-9]+\.[0-9]+\.[0-9]+/
tag: /v[0-9]+\.[0-9]+\.[0-9]+(\-dev)?/
commands:
- pip install awscli --user
- ./deploy.sh
- ./ci/deploy.sh
general:
artifacts:
- "node_modules/mapbox-gl-test-suite/render-tests/index.html"
Expand Down

0 comments on commit 98461d3

Please sign in to comment.