This repository has been archived by the owner on Apr 21, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ci): Switch to Jenkins and semantic-release
Use Jenkins for CI and semantic-release for packaging. Fixes: #110
- Loading branch information
1 parent
022edd6
commit 90ac36e
Showing
6 changed files
with
174 additions
and
101 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ logs | |
*.log | ||
npm-debug.log* | ||
package-lock.json | ||
.tap-output | ||
|
||
# Runtime data | ||
pids | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,141 @@ | ||
library 'magic-butler-catalogue' | ||
|
||
def PROJECT_NAME = "nodejs-client-legacy" | ||
def TRIGGER_PATTERN = ".*@logdnabot.*" | ||
def CURRENT_BRANCH = [env.CHANGE_BRANCH, env.BRANCH_NAME]?.find{branch -> branch != null} | ||
def DEFAULT_BRANCH = 'master' | ||
def CHANGE_ID = env.CHANGE_ID == null ? '' : env.CHANGE_ID | ||
|
||
pipeline { | ||
agent none | ||
|
||
options { | ||
timestamps() | ||
ansiColor 'xterm' | ||
} | ||
|
||
triggers { | ||
issueCommentTrigger(TRIGGER_PATTERN) | ||
} | ||
|
||
environment { | ||
GITHUB_TOKEN = credentials('github-api-token') | ||
NPM_TOKEN = credentials('npm-publish-token') | ||
NPM_CONFIG_CACHE = '.npm' | ||
NPM_CONFIG_USERCONFIG = '.npmrc' | ||
SPAWN_WRAP_SHIM_ROOT = '.npm' | ||
} | ||
|
||
stages { | ||
stage('Validate PR Source') { | ||
when { | ||
expression { env.CHANGE_FORK } | ||
not { | ||
triggeredBy 'issueCommentCause' | ||
} | ||
} | ||
steps { | ||
error("A maintainer needs to approve this PR for CI by commenting") | ||
} | ||
} | ||
|
||
stage('Test Suite') { | ||
matrix { | ||
axes { | ||
axis { | ||
name 'NODE_VERSION' | ||
values '12', '14', '15' | ||
} | ||
} | ||
|
||
when { | ||
not { | ||
changelog '\\[skip ci\\]' | ||
} | ||
} | ||
|
||
agent { | ||
docker { | ||
image "us.gcr.io/logdna-k8s/node:${NODE_VERSION}-ci" | ||
} | ||
} | ||
|
||
stages { | ||
stage('Test') { | ||
steps { | ||
sh "mkdir -p ${NPM_CONFIG_CACHE} coverage" | ||
sh 'npm install' | ||
sh 'npm run test:ci' | ||
} | ||
|
||
post { | ||
always { | ||
junit 'coverage/test.xml' | ||
|
||
publishHTML target: [ | ||
allowMissing: false, | ||
alwaysLinkToLastBuild: false, | ||
keepAll: true, | ||
reportDir: 'coverage/lcov-report', | ||
reportFiles: 'index.html', | ||
reportName: "coverage-node-v${NODE_VERSION}" | ||
] | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
stage('Test Release') { | ||
when { | ||
beforeAgent true | ||
not { | ||
branch DEFAULT_BRANCH | ||
} | ||
} | ||
|
||
agent { | ||
docker { | ||
image "us.gcr.io/logdna-k8s/node:14-ci" | ||
customWorkspace "${PROJECT_NAME}-${BUILD_NUMBER}" | ||
} | ||
} | ||
|
||
environment { | ||
GIT_BRANCH = "${CURRENT_BRANCH}" | ||
BRANCH_NAME = "${CURRENT_BRANCH}" | ||
CHANGE_ID = "" | ||
} | ||
|
||
steps { | ||
sh "mkdir -p ${NPM_CONFIG_CACHE}" | ||
sh 'npm install' | ||
sh "npm run release:dry" | ||
} | ||
} | ||
|
||
stage('Release') { | ||
when { | ||
beforeAgent true | ||
branch DEFAULT_BRANCH | ||
not { | ||
changelog '\\[skip ci\\]' | ||
} | ||
} | ||
|
||
agent { | ||
docker { | ||
image "us.gcr.io/logdna-k8s/node:14-ci" | ||
customWorkspace "${PROJECT_NAME}-${BUILD_NUMBER}" | ||
} | ||
} | ||
|
||
steps { | ||
sh "mkdir -p ${NPM_CONFIG_CACHE}" | ||
sh 'npm install' | ||
sh 'npm run release' | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
mkdir -p coverage | ||
tap | ||
|
||
code=$? | ||
cat .tap-output | ./node_modules/.bin/tap-parser -t -f | ./node_modules/.bin/tap-xunit > coverage/test.xml | ||
exit $code |