| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent b80e006 commit 3bf2bd4
4 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 | + - icu | ||
| 27 | 28 | - libuv | |
| 28 | 29 | - lint-md-dependencies | |
| 29 | 30 | - llhttp | |
@@ -36,6 +37,9 @@ on: | |||
| 36 | 37 | - undici | |
| 37 | 38 | - uvwasi | |
| 38 | 39 | ||
| 40 | + env: | ||
| 41 | + PYTHON_VERSION: '3.11' | ||
| 42 | + | ||
| 39 | 43 | permissions: | |
| 40 | 44 | contents: read | |
| 41 | 45 | ||
@@ -254,11 +258,24 @@ jobs: | |||
| 254 | 258 | cat temp-output | |
| 255 | 259 | tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" || true | |
| 256 | 260 | rm temp-output | |
| 261 | + - id: icu | ||
| 262 | + subsystem: deps | ||
| 263 | + label: dependencies, test | ||
| 264 | + run: | | ||
| 265 | + ./tools/dep_updaters/update-icu.sh > temp-output | ||
| 266 | + cat temp-output | ||
| 267 | + tail -n1 temp-output | grep "NEW_VERSION=" >> "$GITHUB_ENV" || true | ||
| 268 | + rm temp-output | ||
| 257 | 269 | steps: | |
| 258 | 270 | - uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 | |
| 259 | 271 | if: github.event_name == 'schedule' || inputs.id == 'all' || inputs.id == matrix.id | |
| 260 | 272 | with: | |
| 261 | 273 | persist-credentials: false | |
| 274 | + - name: Set up Python ${{ env.PYTHON_VERSION }} | ||
| 275 | + if: matrix.id == 'icu' && (github.event_name == 'schedule' || inputs.id == 'all' || inputs.id == matrix.id) | ||
| 276 | + uses: actions/setup-python@d27e3f3d7c64b4bbf8e4abfb9b63b83e846e0435 # v4.5.0 | ||
| 277 | + with: | ||
| 278 | + python-version: ${{ env.PYTHON_VERSION }} | ||
| 262 | 279 | - run: ${{ matrix.run }} | |
| 263 | 280 | if: github.event_name == 'schedule' || inputs.id == 'all' || inputs.id == matrix.id | |
| 264 | 281 | env: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -101,6 +101,9 @@ Node.js is built. | |||
| 101 | 101 | ||
| 102 | 102 | ## How to upgrade ICU | |
| 103 | 103 | ||
| 104 | + > The script `tools/dep_updaters/update-icu.sh` automates | ||
| 105 | + > this process. | ||
| 106 | + | ||
| 104 | 107 | * Make sure your Node.js workspace is clean (`git status` | |
| 105 | 108 | should be sufficient). | |
| 106 | 109 | * Configure Node.js with the specific [ICU version](http://site.icu-project.org/download) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,75 @@ | |||
| 1 | + #!/bin/sh | ||
| 2 | + set -e | ||
| 3 | + # Shell script to update icu in the source tree to a specific version | ||
| 4 | + | ||
| 5 | + BASE_DIR=$(cd "$(dirname "$0")/../.." && pwd) | ||
| 6 | + DEPS_DIR="$BASE_DIR/deps" | ||
| 7 | + TOOLS_DIR="$BASE_DIR/tools" | ||
| 8 | + | ||
| 9 | + [ -z "$NODE" ] && NODE="$BASE_DIR/out/Release/node" | ||
| 10 | + [ -x "$NODE" ] || NODE=$(command -v node) | ||
| 11 | + | ||
| 12 | + NEW_VERSION="$("$NODE" --input-type=module <<'EOF' | ||
| 13 | + const res = await fetch('https://api.github.com/repos/unicode-org/icu/releases/latest'); | ||
| 14 | + if (!res.ok) throw new Error(`FetchError: ${res.status} ${res.statusText}`, { cause: res }); | ||
| 15 | + const { tag_name } = await res.json(); | ||
| 16 | + console.log(tag_name.replace('release-', '').replace('-','.')); | ||
| 17 | + EOF | ||
| 18 | + )" | ||
| 19 | + | ||
| 20 | + ICU_VERSION_H="$DEPS_DIR/icu-small/source/common/unicode/uvernum.h" | ||
| 21 | + | ||
| 22 | + CURRENT_VERSION="$(grep "#define U_ICU_VERSION " "$ICU_VERSION_H" | cut -d'"' -f2)" | ||
| 23 | + | ||
| 24 | + echo "Comparing $NEW_VERSION with $CURRENT_VERSION" | ||
| 25 | + | ||
| 26 | + if [ "$NEW_VERSION" = "$CURRENT_VERSION" ]; then | ||
| 27 | + echo "Skipped because icu is on the latest version." | ||
| 28 | + exit 0 | ||
| 29 | + fi | ||
| 30 | + | ||
| 31 | + DASHED_NEW_VERSION=$(echo "$NEW_VERSION" | sed 's/\./-/g') | ||
| 32 | + | ||
| 33 | + LOW_DASHED_NEW_VERSION=$(echo "$NEW_VERSION" | sed 's/\./_/g') | ||
| 34 | + | ||
| 35 | + NEW_VERSION_TGZ="icu4c-${LOW_DASHED_NEW_VERSION}-src.tgz" | ||
| 36 | + | ||
| 37 | + NEW_VERSION_TGZ_URL="https://github.com/unicode-org/icu/releases/download/release-${DASHED_NEW_VERSION}/$NEW_VERSION_TGZ" | ||
| 38 | + | ||
| 39 | + NEW_VERSION_MD5="https://github.com/unicode-org/icu/releases/download/release-${DASHED_NEW_VERSION}/icu4c-${LOW_DASHED_NEW_VERSION}-src.md5" | ||
| 40 | + | ||
| 41 | + ./configure --with-intl=full-icu --with-icu-source="$NEW_VERSION_TGZ_URL" | ||
| 42 | + | ||
| 43 | + "$TOOLS_DIR/icu/shrink-icu-src.py" | ||
| 44 | + | ||
| 45 | + rm -rf "$DEPS_DIR/icu" | ||
| 46 | + | ||
| 47 | + CHECKSUM=$(curl -sL "$NEW_VERSION_MD5" | grep "$NEW_VERSION_TGZ" | grep -v "\.asc$" | awk '{print $1}') | ||
| 48 | + | ||
| 49 | + GENERATED_CHECKSUM=$( curl -sL "$NEW_VERSION_TGZ_URL" | md5sum | cut -d ' ' -f1) | ||
| 50 | + | ||
| 51 | + echo "Comparing checksums: deposited $CHECKSUM with $GENERATED_CHECKSUM" | ||
| 52 | + | ||
| 53 | + if [ "$CHECKSUM" != "$GENERATED_CHECKSUM" ]; then | ||
| 54 | + echo "Skipped because checksums do not match." | ||
| 55 | + exit 0 | ||
| 56 | + fi | ||
| 57 | + | ||
| 58 | + sed -i '' -e "s|\"url\": \"\(.*\)\".*|\"url\": \"$NEW_VERSION_TGZ_URL\",|" "$TOOLS_DIR/icu/current_ver.dep" | ||
| 59 | + | ||
| 60 | + sed -i '' -e "s|\"md5\": \"\(.*\)\".*|\"md5\": \"$CHECKSUM\"|" "$TOOLS_DIR/icu/current_ver.dep" | ||
| 61 | + | ||
| 62 | + rm -rf out "$DEPS_DIR/icu" "$DEPS_DIR/icu4c*" | ||
| 63 | + | ||
| 64 | + echo "All done!" | ||
| 65 | + echo "" | ||
| 66 | + echo "Please git add icu, commit the new version:" | ||
| 67 | + echo "" | ||
| 68 | + echo "$ git add -A deps/icu-small" | ||
| 69 | + echo "$ git add tools/icu/current_ver.dep" | ||
| 70 | + echo "$ git commit -m \"deps: update icu to $NEW_VERSION\"" | ||
| 71 | + echo "" | ||
| 72 | + | ||
| 73 | + # The last line of the script should always print the new version, | ||
| 74 | + # as we need to add it to $GITHUB_ENV variable. | ||
| 75 | + echo "NEW_VERSION=$NEW_VERSION" | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments