Make generation of demo.svg deterministic #625
Merged
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.
While working on #605 we found out that the PR's CI revealed an unexpected diff in
docs/demo.svg
. CI onmaster
looked fine as well but I could reproduce the failure nonetheless locally by runningmake -B docs/demo.svg
.The rootcause is as follows:
The generation of
demo.svg
depends on a Node tool that is installed vianpm install svg-term-cli
. Underneath this thenpm
command performs its own recursive dependency resolution and fetches the latest version (that is compatible with any existing version constraints) of all required direct & indirect dependencies.The latest CI run on
master
dates back to 13/14 July and passed correctly. Since then thesvgo
NPM package, a direct dependency ofsvg-term-cli
, released a new minor version making the most recent version1.3.0
instead of1.2.2
which is still compatible with the>=1.0.3
constraint defined bysvg-term-cli
. The move from1.2.2
to1.3.0
apparently introduced a change that resulted in a diff in the generateddocs/demo.svg
file.The solution here (and which will help prevent this occurring in the future as well) is to fix the versions of all (in)direct dependencies used to install the
svg-term-cli
package.This is achieved by creating a fake NPM package in the
tools
folder using apackage.json
withsvg-term-cli
as a dependency and apackage-lock.json
file to hardcode the required version for each dependency. This also allows us to runnpm ci
instead ofnpm install svg-term-cli
which is designed specifically for the automated runs of a CI environment.This will make the generation of
docs/demo.svg
deterministic and allows the safe upgrade of any of the required package versions in the future via code-reviewed updates to thepackage.json
andpackage-lock.json
files.