| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 215b2bc commit 07aa264
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -24,6 +24,7 @@ on: | |||
| 24 | 24 | - doc | |
| 25 | 25 | - eslint | |
| 26 | 26 | - googletest | |
| 27 | + - histogram | ||
| 27 | 28 | - icu | |
| 28 | 29 | - libuv | |
| 29 | 30 | - lint-md-dependencies | |
@@ -147,6 +148,14 @@ jobs: | |||
| 147 | 148 | cat temp-output | |
| 148 | 149 | tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" || true | |
| 149 | 150 | rm temp-output | |
| 151 | + - id: histogram | ||
| 152 | + subsystem: deps | ||
| 153 | + label: dependencies | ||
| 154 | + run: | | ||
| 155 | + ./tools/dep_updaters/update-histogram.sh > temp-output | ||
| 156 | + cat temp-output | ||
| 157 | + tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" || true | ||
| 158 | + rm temp-output | ||
| 150 | 159 | - id: icu | |
| 151 | 160 | subsystem: deps | |
| 152 | 161 | label: dependencies, test | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,74 @@ | |||
| 1 | + #!/bin/sh | ||
| 2 | + set -e | ||
| 3 | + # Shell script to update histogram in the source tree to specific version | ||
| 4 | + | ||
| 5 | + BASE_DIR=$(cd "$(dirname "$0")/../.." && pwd) | ||
| 6 | + DEPS_DIR="$BASE_DIR/deps" | ||
| 7 | + | ||
| 8 | + [ -z "$NODE" ] && NODE="$BASE_DIR/out/Release/node" | ||
| 9 | + [ -x "$NODE" ] || NODE=$(command -v node) | ||
| 10 | + | ||
| 11 | + # shellcheck disable=SC1091 | ||
| 12 | + . "$BASE_DIR/tools/dep_updaters/utils.sh" | ||
| 13 | + | ||
| 14 | + NEW_VERSION="$("$NODE" --input-type=module <<'EOF' | ||
| 15 | + const res = await fetch('https://api.github.com/repos/HdrHistogram/HdrHistogram_c/releases/latest'); | ||
| 16 | + if (!res.ok) throw new Error(`FetchError: ${res.status} ${res.statusText}`, { cause: res }); | ||
| 17 | + const { tag_name } = await res.json(); | ||
| 18 | + console.log(tag_name.replace('v', '')); | ||
| 19 | + EOF | ||
| 20 | + )" | ||
| 21 | + | ||
| 22 | + CURRENT_VERSION=$(grep "#define HDR_HISTOGRAM_VERSION" ./deps/histogram/include/hdr/hdr_histogram_version.h | sed -n "s/^.*VERSION \"\(.*\)\"/\1/p") | ||
| 23 | + | ||
| 24 | + echo "Comparing $NEW_VERSION with $CURRENT_VERSION" | ||
| 25 | + | ||
| 26 | + if [ "$NEW_VERSION" = "$CURRENT_VERSION" ]; then | ||
| 27 | + echo "Skipped because histogram is on the latest version." | ||
| 28 | + exit 0 | ||
| 29 | + fi | ||
| 30 | + | ||
| 31 | + echo "Making temporary workspace" | ||
| 32 | + | ||
| 33 | + WORKSPACE=$(mktemp -d 2> /dev/null || mktemp -d -t 'tmp') | ||
| 34 | + | ||
| 35 | + cleanup () { | ||
| 36 | + EXIT_CODE=$? | ||
| 37 | + [ -d "$WORKSPACE" ] && rm -rf "$WORKSPACE" | ||
| 38 | + exit $EXIT_CODE | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + trap cleanup INT TERM EXIT | ||
| 42 | + | ||
| 43 | + HISTOGRAM_TARBALL="$NEW_VERSION.tar.gz" | ||
| 44 | + | ||
| 45 | + cd "$WORKSPACE" | ||
| 46 | + | ||
| 47 | + echo "Fetching histogram source archive" | ||
| 48 | + | ||
| 49 | + curl -sL -o "$HISTOGRAM_TARBALL" "https://github.com/HdrHistogram/HdrHistogram_c/archive/refs/tags/$HISTOGRAM_TARBALL" | ||
| 50 | + | ||
| 51 | + log_and_verify_sha256sum "histogram" "$HISTOGRAM_TARBALL" | ||
| 52 | + | ||
| 53 | + gzip -dc "$HISTOGRAM_TARBALL" | tar xf - | ||
| 54 | + | ||
| 55 | + rm "$HISTOGRAM_TARBALL" | ||
| 56 | + | ||
| 57 | + mv "HdrHistogram_c-$NEW_VERSION" histogram | ||
| 58 | + | ||
| 59 | + cp "$WORKSPACE/histogram/include/hdr/hdr_histogram_version.h" "$WORKSPACE/histogram/include/hdr/hdr_histogram.h" "$DEPS_DIR/histogram/include/hdr" | ||
| 60 | + | ||
| 61 | + cp "$WORKSPACE/histogram/src/hdr_atomic.h" "$WORKSPACE/histogram/src/hdr_malloc.h" "$WORKSPACE/histogram/src/hdr_tests.h" "$WORKSPACE/histogram/src/hdr_histogram.c" "$DEPS_DIR/histogram/src" | ||
| 62 | + | ||
| 63 | + | ||
| 64 | + echo "All done!" | ||
| 65 | + echo "" | ||
| 66 | + echo "Please git add histogram, commit the new version:" | ||
| 67 | + echo "" | ||
| 68 | + echo "$ git add -A deps/histogram" | ||
| 69 | + echo "$ git commit -m \"deps: update histogram to $NEW_VERSION\"" | ||
| 70 | + echo "" | ||
| 71 | + | ||
| 72 | + # The last line of the script should always print the new version, | ||
| 73 | + # as we need to add it to $GITHUB_ENV variable. | ||
| 74 | + echo "NEW_VERSION=$NEW_VERSION" | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments