-
Notifications
You must be signed in to change notification settings - Fork 492
Add test runs with minimum dependency versions #757
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
cameel
wants to merge
2
commits into
master
Choose a base branch
from
testing-min-dependencies
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
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 hidden or 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 hidden or 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,56 @@ | ||
#!/usr/bin/env bash | ||
# Creates a variant of package.json, hard-coded to use the oldest version of each dependency in | ||
# the supported range. | ||
# | ||
# package.json is taken from the current working directory. The script does not modify the file - | ||
# the new version is instead printed to the standard output. | ||
# | ||
# Dependencies: npm, jq, semver | ||
|
||
set -euo pipefail | ||
|
||
function fail { >&2 echo "$@"; exit 1; } | ||
|
||
function find_min_supported_versions { | ||
local packages_json min_versions packages supported_range available_versions min_version | ||
|
||
# The function expects a JSON dict with package names and versions, extracted from package.json by the caller. | ||
packages_json=$(cat -) | ||
|
||
# Use @tsv filter to get tab-separated package names. We assume that neither packages, nor | ||
# available versions contain spaces. Spaces in version range are fine though. | ||
packages=$(echo "$packages_json" | jq --raw-output 'keys | @tsv') | ||
min_versions=() | ||
for package in $packages; do | ||
available_versions=$(npm view "$package" versions --json | jq --raw-output @tsv) | ||
supported_range=$(echo "$packages_json" | jq --raw-output ".\"${package}\"") | ||
|
||
# shellcheck disable=SC2086 | ||
# semver prints versions matching the range, one per line, in semver order, oldest first | ||
min_version=$(semver $available_versions --range "$supported_range" | head --lines 1) | ||
[[ $min_version != "" ]] || fail "No version matching ${supported_range} found for package ${package}." | ||
|
||
# Debug info. It goes to stderr not to interfere with actual output. | ||
>&2 echo "Package ${package}:" | ||
>&2 echo " minimum version: ${min_version}" | ||
>&2 echo " supported range: ${supported_range}" | ||
>&2 echo " available versions: ${available_versions}" | ||
>&2 echo | ||
|
||
min_versions+=("{\"${package}\": \"${min_version}\"}") | ||
done | ||
|
||
# Actual output: min_versions merged into a single dict. | ||
echo "${min_versions[@]}" | jq --slurp add | ||
} | ||
|
||
dependencies=$(jq .dependencies package.json | find_min_supported_versions) | ||
dev_dependencies=$(jq .devDependencies package.json | find_min_supported_versions) | ||
|
||
# Print package.json with overwritten dependency versions | ||
cat <<EOF | jq --slurp '.[0] * .[1]' package.json - | ||
{ | ||
"dependencies": ${dependencies}, | ||
"devDependencies": ${dev_dependencies} | ||
} | ||
EOF |
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.
For some reason CircleCI decided to change the name of the existing job to
node-current-1
. Not sure why, this does not happen withnode-v12
for example. I tried addingname: node-current
but it does not change this.I guess we'll have to accept this and update the name of the required job in settings if we decide to merge the PR. I think we should make the
min-dependencies
jobs required as well.Uh oh!
There was an error while loading. Please reload this page.
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.
Isn't it because you have two
node-current
entries? I believe you may have accidentally duplicated the job name.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.
No. It has to be
node-current
for both because that's the name of the job that's being invoked in both cases:solc-js/.circleci/config.yml
Lines 457 to 460 in 4aec1e7
The name of the run normally comes from that invoked job, but if it's invoked more than once, CircleCI adds numbers to disambiguate it. That's why there's the
name
parameter - note that it does not come from the job definition (seenode-base
). It's a built-in CircleCI thing meant for providing a custom name.See also
t_ext
in Solidity CI config. We do it there the same way and it works.