From b8a09c033332ac0b09692f2da40ce28eafd268ee Mon Sep 17 00:00:00 2001 From: Yun Chan Date: Sat, 26 Sep 2026 21:05:34 +0900 Subject: [PATCH] ci(forgejo): install the .nvmrc Node before npm on the Linux runner The first real Forgejo CI run failed because the linux-builder runner ships Node 18.19: scripts using import.meta.dirname threw, and its older npm reported the mobile lock as out of sync with the file: dependency on packages/core (the lock is in sync under Node 24's npm). bootstrap-linux-toolchain.sh gains a checksum-verified `node` mode (24.19.0, the .nvmrc version); ci.yml (quality, build-validation, mobile-quality) and deploy-site.yml add it to GITHUB_PATH before npm runs. --- .forgejo/workflows/ci.yml | 27 +++++++++++++++++++++++-- .forgejo/workflows/deploy-site.yml | 8 ++++++++ scripts/ci/bootstrap-linux-toolchain.sh | 17 +++++++++++++++- 3 files changed, 49 insertions(+), 3 deletions(-) diff --git a/.forgejo/workflows/ci.yml b/.forgejo/workflows/ci.yml index 09f9ebe..8a657b5 100644 --- a/.forgejo/workflows/ci.yml +++ b/.forgejo/workflows/ci.yml @@ -44,9 +44,14 @@ jobs: git checkout -q -f FETCH_HEAD git clean -qfdx - - name: 도구 버전 + - name: Node (.nvmrc) 설치 + shell: bash run: | - echo "node $(node --version) (.nvmrc $(cat .nvmrc)) / npm $(npm --version)" + set -euo pipefail + export CI_PROJECT_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/d3ro-ci" + . scripts/ci/bootstrap-linux-toolchain.sh node + dirname "$(command -v node)" >> "$GITHUB_PATH" + echo "node $(node --version) / npm $(npm --version)" - name: 의존성 설치 run: npm ci @@ -95,6 +100,15 @@ jobs: git checkout -q -f FETCH_HEAD git clean -qfdx + - name: Node (.nvmrc) 설치 + shell: bash + run: | + set -euo pipefail + export CI_PROJECT_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/d3ro-ci" + . scripts/ci/bootstrap-linux-toolchain.sh node + dirname "$(command -v node)" >> "$GITHUB_PATH" + echo "node $(node --version) / npm $(npm --version)" + - name: 의존성 설치 run: npm ci @@ -122,6 +136,15 @@ jobs: git checkout -q -f FETCH_HEAD git clean -qfdx + - name: Node (.nvmrc) 설치 + shell: bash + run: | + set -euo pipefail + export CI_PROJECT_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/d3ro-ci" + . scripts/ci/bootstrap-linux-toolchain.sh node + dirname "$(command -v node)" >> "$GITHUB_PATH" + echo "node $(node --version) / npm $(npm --version)" + - name: 의존성 설치 run: | npm ci diff --git a/.forgejo/workflows/deploy-site.yml b/.forgejo/workflows/deploy-site.yml index 0fe30ab..3e4fd1c 100644 --- a/.forgejo/workflows/deploy-site.yml +++ b/.forgejo/workflows/deploy-site.yml @@ -30,6 +30,14 @@ jobs: git checkout -q -f FETCH_HEAD git clean -qfdx + - name: Node (.nvmrc) 설치 + shell: bash + run: | + set -euo pipefail + export CI_PROJECT_DIR="${XDG_CACHE_HOME:-$HOME/.cache}/d3ro-ci" + . scripts/ci/bootstrap-linux-toolchain.sh node + dirname "$(command -v node)" >> "$GITHUB_PATH" + - name: 모바일 릴리스 공개 경계 검사 run: node scripts/ci/verify-mobile-release-boundary.mjs --self-test diff --git a/scripts/ci/bootstrap-linux-toolchain.sh b/scripts/ci/bootstrap-linux-toolchain.sh index 8e99935..62a34a9 100644 --- a/scripts/ci/bootstrap-linux-toolchain.sh +++ b/scripts/ci/bootstrap-linux-toolchain.sh @@ -8,7 +8,7 @@ set -euo pipefail mode="${1:-}" if [[ -z "$mode" ]]; then - echo 'bootstrap-linux-toolchain: mode is required (dotnet|deno|android)' >&2 + echo 'bootstrap-linux-toolchain: mode is required (node|dotnet|deno|android)' >&2 return 64 2>/dev/null || exit 64 fi @@ -32,6 +32,20 @@ download_verified() { esac } +# 러너 기본 node(Forgejo linux-builder는 18.x)는 .nvmrc(24.19.0)보다 낮다. +bootstrap_node() { + local node_root="$tools_root/node-v24.19.0-linux-x64" + if [[ ! -x "$node_root/bin/node" ]]; then + local archive + archive="$(mktemp "${TMPDIR:-/tmp}/d3ro-node.XXXXXX.tar.gz")" + download_verified 'https://nodejs.org/dist/v24.19.0/node-v24.19.0-linux-x64.tar.gz' 'f625d97cd707df4ff96254916fbc5ff014f09c09effe5a1e0ca8f6d41a8789d4' "$archive" + tar --extract --gzip --file "$archive" --directory "$tools_root" + rm -f "$archive" + fi + export PATH="$node_root/bin:$PATH" + [[ "$(node --version)" == "v$(cat .nvmrc)" ]] +} + bootstrap_dotnet() { export DOTNET_ROOT="$tools_root/dotnet-sdk-10.0.302" if [[ ! -x "$DOTNET_ROOT/dotnet" ]]; then @@ -125,6 +139,7 @@ bootstrap_android() { } case "$mode" in + node) bootstrap_node ;; dotnet) bootstrap_dotnet ;; deno) bootstrap_deno ;; android) bootstrap_android ;;