This repository has been archived by the owner on Apr 16, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 38
Implemented NodeJS compatibility test. #128
Merged
martysweet
merged 12 commits into
martysweet:master
from
RazzM13:node_compatibility_test
Apr 4, 2018
Merged
Changes from 9 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
6cc7d09
Implemented NodeJS compatibility test.
RazzM13 c327c3d
Merge branch 'master' into node_compatibility_test
martysweet 228a2cd
Moved compatibility testing scripts to `tools/nodejs_compatibility_ch…
RazzM13 defffdf
Implemented quick compatibility checking.
RazzM13 45b3439
Updated CircleCI config to use quick compatibility checking.
RazzM13 93d4c52
Improved compatibility test failure detection.
RazzM13 eac5772
Improved compatibility test reporting.
RazzM13 8d360d2
Merge branch 'master' into node_compatibility_test
martysweet 04bd993
Fixed code style for compatibility test scripts.
RazzM13 ae103a3
Fixed code style for "test_compatibility_setup.sh".
RazzM13 4f9f5dc
Merge branch 'master' into node_compatibility_test
RazzM13 63413a8
Implement NodeJS compatibility test
martysweet File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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,37 @@ | ||
#!/usr/bin/env bash | ||
[ ! -e ~/.envirius/nv ] && echo 'Error: envirius is not installed!' && exit 1 | ||
[ ! -e nodes_available.log ] && echo 'Error: no environments available!' && exit 1 | ||
|
||
export TERM="dumb" | ||
source ~/.envirius/nv | ||
node_versions=$(cat nodes_available.log) | ||
|
||
# Run the tests on all available versions | ||
for version in ${node_versions}; do | ||
echo "Testing node-${version}!"; | ||
nv activate --same-shell "node-${version}" | ||
npm test >"test_node_${version}.log" 2>&1 | ||
if [ $? -eq 0 ]; then | ||
echo "PASSED" | ||
echo ${version} >> nodes_passed.log | ||
else | ||
echo "FAILED" | ||
fi | ||
nv deactivate | ||
done | ||
|
||
# Determine failed versions and display the test-run | ||
failed=$(comm -23 <(sort nodes_available.log) <(sort nodes_passed.log)) | ||
if [ -z "${failed}" ]; then | ||
echo "Build is compatible with all major node versions!" | ||
exit 0 | ||
fi | ||
|
||
echo "Build is incompatible with the following node versions:" | ||
echo "${failed}" | ||
for version in ${failed}; do | ||
echo "***Started test-run for ${version}***"; | ||
cat "test_node_${version}.log"; | ||
echo "***Finished test-run for ${version}***"; | ||
done | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice touch |
||
exit 1 |
13 changes: 13 additions & 0 deletions
13
tools/nodejs_compatibility_checker/test_compatibility_cache.sh
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,13 @@ | ||
#!/usr/bin/env bash | ||
[ ! -e ~/.envirius/nv ] && echo 'Error: envirius is not installed!' && exit 1 | ||
[ ! -e nodes_available.log ] && echo 'Error: no environments available!' && exit 1 | ||
|
||
export TERM="dumb" | ||
source ~/.envirius/nv | ||
node_versions=$(cat nodes_available.log) | ||
|
||
# Cache NodeJS environments | ||
for version in ${node_versions}; do | ||
echo "Adding NodeJS ${version} into environment cache!" && \ | ||
nv mk "node-${version}" --node-prebuilt=${version} | ||
done |
36 changes: 36 additions & 0 deletions
36
tools/nodejs_compatibility_checker/test_compatibility_setup.sh
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,36 @@ | ||
#!/usr/bin/env bash | ||
export TERM="dumb" | ||
|
||
# Install envirius | ||
git clone --depth 1 https://github.com/ekalinin/envirius.git && \ | ||
cd envirius && \ | ||
make install && \ | ||
cd .. && \ | ||
source ~/.envirius/nv | ||
|
||
if [ $? -ne 0 ]; then | ||
echo "Unable to install envirius!" | ||
exit 1 | ||
fi | ||
|
||
# Determine available node versions | ||
node_versions=$(nv ls-versions --node-prebuilt | sed 's/\s/\n/g' | grep -E '^[1-9]') | ||
if [ -z "${node_versions}" ]; then | ||
echo "Unable to determine node versions!" | ||
exit 1 | ||
fi | ||
|
||
# Quick check | ||
if [ "$1" == "--quick" ]; then | ||
lts_versions=$( | ||
for lts in 4 6 8 9; do | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
echo "${node_versions}" | grep -E "^${lts}" | tail -1 | ||
done | ||
) | ||
node_versions=${lts_versions} | ||
fi | ||
|
||
# Dump available versions to file | ||
for version in ${node_versions}; do | ||
echo ${version} >> nodes_available.log | ||
done |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
22 seconds, awesome!