-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This removes circleci and goes with Jenkins. This will now include auto-versioning and publishing to npm via Jenkins. Semver: patch Ref: LOG-7378
- Loading branch information
1 parent
cabd1e5
commit 57d2bc5
Showing
2 changed files
with
149 additions
and
98 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 |
---|---|---|
@@ -0,0 +1,149 @@ | ||
library 'magic-butler-catalogue' | ||
|
||
def projectName = "logdna-winston" | ||
def repo = "logdna/${projectName}" | ||
|
||
pipeline { | ||
agent none | ||
|
||
options { | ||
timestamps() | ||
ansiColor 'xterm' | ||
} | ||
|
||
stages { | ||
stage('Test Suite') { | ||
matrix { | ||
axes { | ||
axis { | ||
name 'NODE_VERSION' | ||
values '10', '12', '14' | ||
} | ||
} | ||
|
||
agent { | ||
docker { | ||
image "us.gcr.io/logdna-k8s/node:${NODE_VERSION}-ci" | ||
} | ||
} | ||
|
||
environment { | ||
NPM_CONFIG_CACHE = '.npm' | ||
NPM_CONFIG_USERCONFIG = '.npm/rc' | ||
SPAWN_WRAP_SHIM_ROOT = '.npm' | ||
} | ||
|
||
stages { | ||
stage('Install') { | ||
environment { | ||
GITHUB_PACKAGES_TOKEN = credentials('github-api-token') | ||
} | ||
|
||
steps { | ||
sh 'mkdir -p .npm' | ||
|
||
script { | ||
npm.auth token: "${GITHUB_PACKAGES_TOKEN}" | ||
} | ||
|
||
sh """ | ||
npm install | ||
""" | ||
} | ||
} | ||
|
||
stage('Test') { | ||
steps { | ||
sh 'node -v' | ||
sh 'npm -v' | ||
sh 'npm test' | ||
} | ||
|
||
post { | ||
always { | ||
sh 'cat .tap-output | ./node_modules/.bin/tap-mocha-reporter xunit > coverage/test.xml' | ||
|
||
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 'master' | ||
} | ||
} | ||
|
||
agent { | ||
docker { | ||
image "us.gcr.io/logdna-k8s/node:12-ci" | ||
} | ||
} | ||
|
||
environment { | ||
NPM_CONFIG_CACHE = '.npm' | ||
NPM_CONFIG_USERCONFIG = '.npm/rc' | ||
SPAWN_WRAP_SHIM_ROOT = '.npm' | ||
GITHUB_PACKAGES_TOKEN = credentials('github-api-token') | ||
} | ||
|
||
steps { | ||
sh 'mkdir -p .npm' | ||
|
||
versioner( | ||
token: "${GITHUB_PACKAGES_TOKEN}" | ||
, dry: true | ||
, repo: repo | ||
) | ||
} | ||
} | ||
|
||
stage('Release') { | ||
when { | ||
beforeAgent true | ||
branch 'master' | ||
} | ||
|
||
agent { | ||
docker { | ||
image "us.gcr.io/logdna-k8s/node:12-ci" | ||
} | ||
} | ||
|
||
environment { | ||
GITHUB_PACKAGES_TOKEN = credentials('github-api-token') | ||
NPM_PUBLISH_TOKEN = credentials('npm-publish-token') | ||
NPM_CONFIG_CACHE = '.npm' | ||
NPM_CONFIG_USERCONFIG = '.npm/rc' | ||
SPAWN_WRAP_SHIM_ROOT = '.npm' | ||
} | ||
|
||
steps { | ||
sh 'mkdir -p .npm' | ||
|
||
sh "git checkout -b ${GIT_BRANCH} origin/${GIT_BRANCH}" | ||
|
||
versioner( | ||
token: "${GITHUB_PACKAGES_TOKEN}" | ||
, dry: false | ||
, repo: repo | ||
, NPM_PUBLISH_TOKEN: "${NPM_PUBLISH_TOKEN}" | ||
) | ||
} | ||
} | ||
} | ||
} |