Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
H
heroku-buildpack-nodejs
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Python-Dev
heroku-buildpack-nodejs
Commits
3c3db2ed
Unverified
Commit
3c3db2ed
authored
Jan 28, 2019
by
Jeremy Morrell
Committed by
GitHub
Jan 28, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sure that failing builds in CI actually fail (#613)
Make sure that failing builds in CI actually fail
parent
1f8c988b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
8 deletions
+31
-8
test-compile
bin/test-compile
+14
-1
package.json
test/fixtures/failing-build/package.json
+2
-2
run
test/run
+15
-5
No files found.
bin/test-compile
View file @
3c3db2ed
#!/usr/bin/env bash
# bin/test-compile <build-dir> <cache-dir> <env-dir>
### Configure environment
set
-o
errexit
# always exit on error
set
-o
pipefail
# don't ignore exit codes when piping output
### Configure directories
BP_DIR
=
$(
cd
"
$(
dirname
"
${
0
:-}
"
)
"
||
exit
;
cd
..
;
pwd
)
### Load dependencies
# shellcheck source=lib/environment.sh
source
"
$BP_DIR
/lib/environment.sh"
### Set up test Node environment
export
NPM_CONFIG_PRODUCTION
=
${
NPM_CONFIG_PRODUCTION
:-
false
}
export
NODE_ENV
=
${
NODE_ENV
:-
test
}
"
$BP_DIR
/bin/compile"
"
$1
"
"
$2
"
"
$3
"
### Compile the app
"
$BP_DIR
/bin/compile"
"
$1
"
"
$2
"
"
$3
"
write_ci_profile
"
$BP_DIR
"
"
$1
"
test/fixtures/failing-build/package.json
View file @
3c3db2ed
...
...
@@ -10,9 +10,9 @@
"hashish"
:
"*"
},
"engines"
:
{
"node"
:
"
0.10.38
"
"node"
:
"
8.x
"
},
"scripts"
:
{
"
postinstall
"
:
"exit 1"
"
heroku-postbuild
"
:
"exit 1"
}
}
test/run
View file @
3c3db2ed
...
...
@@ -562,11 +562,6 @@ testOldNpm() {
assertCapturedError
}
testOldNpm2
()
{
compile
"failing-build"
assertCaptured
"This version of npm (1.4.28) has several known issues"
}
testNonexistentNpm
()
{
compile
"nonexistent-npm"
assertCaptured
"Unable to install npm 1.1.65"
...
...
@@ -874,6 +869,12 @@ testCIEnvVars() {
assertCapturedSuccess
}
# If compile fails, test-compile should also fail
testCICompileFails
()
{
testCompile
"failing-build"
assertCapturedError
}
testCIEnvVarsOverride
()
{
env_dir
=
$(
mktmpdir
)
echo
"banana"
>
$env_dir
/NODE_ENV
...
...
@@ -1143,6 +1144,15 @@ compile() {
capture
${
bp_dir
}
/bin/compile
${
compile_dir
}
${
2
:-$(
mktmpdir
)}
$3
}
testCompile
()
{
default_process_types_cleanup
bp_dir
=
$(
mktmpdir
)
compile_dir
=
$(
mktmpdir
)
cp
-a
"
$(
pwd
)
"
/
*
${
bp_dir
}
cp
-a
${
bp_dir
}
/test/fixtures/
$1
/.
${
compile_dir
}
capture
${
bp_dir
}
/bin/test-compile
${
compile_dir
}
${
2
:-$(
mktmpdir
)}
$3
}
# This is meant to be run after `compile`. `cleanupStartup` must be run
# after this function is called before other tests are executed
executeStartup
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment