diff options
author | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2023-11-09 16:17:38 +0000 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2023-11-09 16:42:47 -0500 |
commit | fc07ab26e15a40ad3ceb78eb7e62f9d88d75e670 (patch) | |
tree | 0667ee512c0668078f1e3eb13e8c32374d8095b2 /bin/mermaid-cli-in-ci | |
parent | 5945aef18be46f0e403ae874cd3f6000cf991d69 (diff) | |
download | torspec-fc07ab26e15a40ad3ceb78eb7e62f9d88d75e670.tar.gz torspec-fc07ab26e15a40ad3ceb78eb7e62f9d88d75e670.zip |
build system: Provide mermaid-cli-in-ci script
This is quite vexing.
Diffstat (limited to 'bin/mermaid-cli-in-ci')
-rwxr-xr-x | bin/mermaid-cli-in-ci | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/bin/mermaid-cli-in-ci b/bin/mermaid-cli-in-ci new file mode 100755 index 0000000..9a0e4ab --- /dev/null +++ b/bin/mermaid-cli-in-ci @@ -0,0 +1,52 @@ +#!/usr/bin/env bash + +set -euo pipefail + +set -x + +# Bump this to "clear" the cache. +# Actually, it just causes us to ignore previous cached results. +cache_clear_token=2023-11-09b + +cache_dir=cache/"$CI_JOB_IMAGE","$cache_clear_token","puppeteer" +local_dir="$HOME/.cache/puppeteer" + +if test -d "$cache_dir"; then + mkdir -p "$local_dir"/. + cp -a "$cache_dir"/. "$local_dir"/. +fi + +./bin/via-yarn-install-in-ci mmdc https://github.com/mermaid-js/mermaid-cli \ + bba0240ad87f6fbf44d8a24941e37f4bc2c8bf30 + +( + cd "$local_dir" + find -printf '%y %p %l\n' | sort + find -type f | sort | xargs sha256sum -- +) >puppeteer-cache-got-listings + +# Empirically, the mermaid-cli locked install produced a very old +# chromium today. So I suspect it's not fetching "latest", but a controlled +# version. Nevertheless, we should check that what we got is actually +# the same and hasn't been changed by Google (or something on the way). + +# Doing this now isn't ideal, because I don't actually know if +# the mermaid-cli *install* process runs anything from here. +# But I don't think it runs the main chrome binary, since at one point +# in our tests we got as far as this and then the chrome binary +# failed with due to a missing OS shared library. + +# This expected output listing shouldn't be in bin/ but the best way +# to fix that would be to rename the whole bin directory to maint. +diff -u bin/puppeteer-cache-expect-listings puppeteer-cache-got-listings + +if ! test -d "$cache_dir"; then + mkdir -p "$cache_dir" + cp -a "$local_dir"/. "$cache_dir"/. +fi + +# This is the easiest way to get the shared libraries that chromium +# depends on. Obviously, using the Debian package's dependencies +# is totally wrong, but it works in practice, and we don't have a proper +# dependency list from the binaries from the ad-hoc downloads. +apt-get install -y chromium |