Skip to content

Commit

Permalink
Testing Screwdriver
Browse files Browse the repository at this point in the history
  • Loading branch information
stjohnjohnson committed Sep 16, 2016
1 parent cc396b9 commit 3177c2b
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 3 deletions.
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pids
lib-cov

# Coverage directory used by tools like istanbul
coverage
/coverage

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt
Expand All @@ -22,5 +22,5 @@ build/Release
# Dependency directory
# Deployed apps should consider commenting this line out:
# see https://npmjs.org/doc/faq.html#Should-I-check-my-node_modules-folder-into-git
node_modules
artifacts
/node_modules
/artifacts
6 changes: 6 additions & 0 deletions ci/coverage
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash -e

echo Upload coverage to Coveralls
export CI_PULL_REQUEST=${SD_PULL_REQUEST}
export COVERALLS_SERVICE_NAME=screwdriver
cat ./artifacts/coverage/lcov.info | ./node_modules/.bin/coveralls
42 changes: 42 additions & 0 deletions ci/publish
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/bash -e

if [ -z "$GIT_KEY" ] || [ -z "$NPM_TOKEN" ]; then
echo Skipping publish in Pull Request
exit 0
fi

GITHUB_FINGERPRINT=16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48

echo Addding github.com to known_hosts
mkdir -p /root/.ssh
touch /root/.ssh/known_hosts
ssh-keyscan -H github.com >> /root/.ssh/known_hosts
chmod 600 /root/.ssh/known_hosts

echo Validating good known_hosts
ssh-keygen -l -f ~/.ssh/known_hosts | grep $GITHUB_FINGERPRINT

echo Starting ssh-agent
eval "$(ssh-agent -s)"

echo Loading github key
echo $GIT_KEY > git_key
echo $GIT_KEY
cat git_key
ssh-add git_key
# ssh-add <(echo $GIT_KEY)

echo Setting up secrets
GIT_PATH=`git remote -v | grep push | sed 's/ (push)//' | cut -d'/' -f4-5`
git remote set-url --push origin git@github.com:$GIT_PATH
npm config set access public > /dev/null 2>&1
npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN > /dev/null 2>&1

echo Bump the version
./node_modules/.bin/npm-auto-version

echo Publish the package
npm publish

echo Push the new tag to GitHub
git push origin --tags -q
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@
},
"devDependencies": {
"chai": "^3.0.0",
"coveralls": "^2.11.13",
"mockery": "^1.4.0",
"npm-auto-version": "^1.0.0",
"sinon": "^1.10.3"
}
}
15 changes: 15 additions & 0 deletions screwdriver.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
jobs:
main:
image: node:6
steps:
- install: npm install
- test: npm test
- coverage: ./ci/coverage
- publish: ./ci/publish
secrets:
# Publishing to NPM
- NPM_TOKEN
# Pushing tags to Git
- GIT_KEY
# Uploading coverage information to coveralls
- COVERALLS_REPO_TOKEN

0 comments on commit 3177c2b

Please sign in to comment.