Skip to content

Commit

Permalink
Merge pull request snyk#181 from snyk/chore/semantic-release
Browse files Browse the repository at this point in the history
chore: upgrade semantic-release
  • Loading branch information
adrukh committed Aug 8, 2018
2 parents 2a6938f + 6abdfd9 commit 9312a04
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 174 deletions.
35 changes: 18 additions & 17 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
sudo: false
language: node_js
node_js:
- "8"
- "6"
- "4"
cache:
directories:
- node_modules
Expand All @@ -11,26 +15,23 @@ notifications:
on_pull_requests: false
rooms:
secure: mWzYwXXkaPJ/t24kG9gz6hYyRGoGX+zsjKDa+IzjhY4NeMJyzgHyN3x1vWwSXhfG1jQuBTFyT5RTWN8Jfo2Za/XDKYfMXXP5gCMtNkeWdflYWaUC7sAZepRANUB3gzkCTvkc/DOY/FI07xCcLMJoZ7jGiADNakTaWvzdExJUBs6NuhGdIUmOT+chbip02yN7mSPeqyU7/vFqpCxxEoPeNzaNshLufbZUEWgmLm0bm5Uxdo7Yi5rL0/nA7oqXUzzWTtgQEu0mOG4Oqu7oXAki2rLISw8enZwt5/fUbxGgK1J3UB86vgnDrxbTAhuNUuddaSxUuDsg1+3xyRzU74cyKUWnWqL10Tyy9KgDR0A+48w2v8DH/pOvnvfXA+FL0zLtDJ9jPuSK0dFbceRYmolEGMDF53Q/s2W+waC13Bi3nHRQJKYmT+bOnoLABLpfm5fbV/2br4LVTQwiP80HJ+19Vy4lriF55zu1yjESUBzdvvX1Dhp5E3AXZZv6xB0v4gyZZeOoIv6BxqinLauZiS3nM7O9vu1QnFvbo4HH0Df651fyy1kOU5UAAD+CNRgpZ8GMc+EegvnLbS3nzbNOPlkACmhxMNcpEvD6MomcB4UV2dPWAYIQSfrRV5h+iZlNSqCkA2pl3p6TTZhLMvoSxziRzUZZx7GQe/cnUGN6GbzyyRk=
matrix:
include:
- node_js: "8"
- node_js: "6"
- node_js: "4"
before_install:
# tests are failing on npm@5, remove this once this is not an issue
- npm i -g npm@^3.0.0
before_script:
- npm prune
script:
- npm run snyk-auth
# tests are failing on npm@5, downgrade to npm@3 if >3 is installed
- test "$(npm -v | cut -d'.' -f1)" -le 3 || npm i -g npm@^3.0.0
- npm test
after_success:
- npm run travis-coverage
- python scripts/travis_after_all.py
- export $(cat .to_export_back)
- npm run semantic-release
- bash scripts/travis_after_success.sh
jobs:
include:
- stage: Release
node_js: "8"
script:
# run only if this is a 'push' build
# 1. grab and run semantic-release
# (not used as a dev dep because it pulls in new `npm` and breaks our tests)
# 2. run post-release actions
- 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then npx semantic-release && bash scripts/travis_after_success.sh; fi'
branches:
except:
- "/^v\\d+\\.\\d+\\.\\d+$/"
- /^released-/
only:
- "master"
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,4 @@ install:
# Post-install test scripts.
test_script:
- npm run snyk-auth-windows
- npm run windows-tests
- npm run tap
14 changes: 1 addition & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,11 @@
"node": ">=4"
},
"scripts": {
"coverage": "tap --cov --coverage-report=lcov test/*.test.js",
"tap": "COVERALLS_REPO_TOKEN=0 tap --timeout=180 --cov --coverage-report=text-summary test/*.test.js",
"tap": "tap test/*.test.js -R spec --timeout=180",
"test": "npm run test-common && npm run tap",
"test-common": "npm run check-tests && npm run lint && node cli/index.js test --org=snyk",
"windows-tests": "tap -R spec test/*.test.js --timeout=120",
"lint": "jscs `find ./cli -name '*.js'` -v && jscs `find ./lib -name '*.js'` -v",
"check-tests": "! grep 'test\\.only' test/*.test.js -n",
"semantic-release": "semantic-release pre && npm publish && semantic-release post",
"snyk-auth": "node cli auth $SNYK_API_KEY",
"snyk-auth-windows": "node cli auth %SNYK_API_KEY%"
},
Expand Down Expand Up @@ -70,7 +67,6 @@
"nock": "^9.2.5",
"proxyquire": "^1.7.4",
"restify": "^4.1.1",
"semantic-release": "^8",
"sinon": "^1.17.2",
"strip-ansi": "^4.0.0",
"tap": "^5.7.1",
Expand All @@ -81,14 +77,6 @@
"type": "git",
"url": "https://github.com/snyk/snyk.git"
},
"nyc": {
"exclude": [
"test",
"test{,-*}.js",
"**/*.test.js",
"**/__tests__/**"
]
},
"pkg": {
"scripts": [
"cli/**/*.js",
Expand Down
21 changes: 0 additions & 21 deletions scripts/test-vulns.sh

This file was deleted.

122 changes: 0 additions & 122 deletions scripts/travis_after_all.py

This file was deleted.

13 changes: 13 additions & 0 deletions scripts/travis_after_success.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/bin/bash

# trigger external services into post-release action
if [ "$TRAVIS_BRANCH" = "master" ]; then
# manually detect master branch push, and post a dockerhub trigger to build the docker images
curl -s -H "Content-Type: application/json" --data "{\"build\": true}" -X POST "https://registry.hub.docker.com/u/snyk/snyk-cli/trigger/${DOCKER_TOKEN}/"
Expand All @@ -10,3 +11,15 @@ if [ "$TRAVIS_BRANCH" = "master" ]; then
curl "https://g.codefresh.io/api/builds/$GRADLE28_BUILD_ID" -H "content-type:application/json; charset=utf-8" -H "x-access-token: $CF_ACCESS_TOKEN" --data-binary "{\"repoOwner\":\"snyk\",\"repoName\":\"snyk\",\"serviceId\":\"$GRADLE28_BUILD_ID\",\"branch\":\"master\",\"type\":\"build\"}" --compressed
curl "https://g.codefresh.io/api/builds/$GRADLE44_BUILD_ID" -H "content-type:application/json; charset=utf-8" -H "x-access-token: $CF_ACCESS_TOKEN" --data-binary "{\"repoOwner\":\"snyk\",\"repoName\":\"snyk\",\"serviceId\":\"$GRADLE44_BUILD_ID\",\"branch\":\"master\",\"type\":\"build\"}" --compressed
fi

# grab latest version and publish its assets
npm i -g snyk # must install to get the proper `version` key
cd $(dirname $(which snyk))/../lib/node_modules/snyk

npx pkg . # create standalone binaries based on the latest `pkg`

export SNYK_VERSION=$(./cli/index.js -v)

# upload assets built by `pkg`
# GH_TOKEN is set as Travis env var
GITHUB_TOKEN=$GH_TOKEN npx github-release upload --owner snyk --repo snyk --tag "v${SNYK_VERSION}" --name "v${SNYK_VERSION}" ./snyk-linux ./snyk-macos ./snyk-win.exe

0 comments on commit 9312a04

Please sign in to comment.