Skip to content

Instantly share code, notes, and snippets.

@JeffreyMFarley
Created May 14, 2018 17:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JeffreyMFarley/d9b79dbe18f6dfbb199713bacdd12edc to your computer and use it in GitHub Desktop.
Save JeffreyMFarley/d9b79dbe18f6dfbb199713bacdd12edc to your computer and use it in GitHub Desktop.
new BaseJobBuilder(
name: "pr-builder",
description: 'Run unit tests when a pull request is submitted',
).build(this).with {
GhUtils.ghPrWatcher(delegate,
[
ghProject: 'foo/bar',
ghHostname: 'github.com',
ghAuthId: '<#########>',
ghPermitAll: true,
ghPrHooks: false,
ghPrCron: '*/1 * * * *',
ghPrOrgsList: 'foo',
ghPrStatusContext: 'Run UI unit tests',
ghPrResultMessage: [
'SUCCESS': 'All tests passed',
'ERROR': 'There was a problem running the tests',
'FAILURE': 'At least one test failed',
]
]
)
wrappers {
nodejs('Node 8x Current')
}
steps {
shell("""
#!/bin/bash
# Remove the current packages in case they changed
if [[ -n \$(git diff HEAD origin/dev -- package-lock.json) ]]; then
rm -rf node_modules
npm install
fi
grunt build
npm test
""".stripIndent())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment