From 27955a9c8a93cf08e5fefe992f0d470b37399971 Mon Sep 17 00:00:00 2001 From: Yat Ho Date: Mon, 25 Nov 2024 09:51:13 +0800 Subject: [PATCH] fix: CI errors related to `REBUILD_WEB` (#7252) * ci: bump debian image from 11 to 12 debian 11 has npm 7.5.2, which is lower than our minimum required version 8.0.307. * build: find `npm.cmd` on Windows * chore: trigger CI * Revert "chore: trigger CI" This reverts commit adc8f4ec981c94c4eab3c1499ea0c555f554a1d2. * Revert "ci: bump debian image from 11 to 12" This reverts commit 4730d350b3789ec8ab750ff57e713a59c3389831. * ci: use `actions/setup-node` in debian 11 * ci: don't test `REBUILD_WEB` if only `libtransmission` changed * ci: don't test `REBUILD_WEB` if only `third-party` changed --- .github/workflows/actions.yml | 7 +++++-- CMakeLists.txt | 7 ++++++- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index 15c14d938..4c8ee9477 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -66,7 +66,7 @@ jobs: get_changes qt CMakeLists.txt cmake third-party libtransmission qt get_changes tests CMakeLists.txt cmake third-party libtransmission utils tests get_changes utils CMakeLists.txt cmake third-party libtransmission utils - get_changes web CMakeLists.txt cmake third-party libtransmission web + get_changes web CMakeLists.txt cmake web get_changes ci-actions .github/workflows/actions.yml cat "$GITHUB_OUTPUT" @@ -835,9 +835,12 @@ jobs: libpsl-dev \ libssl-dev \ ninja-build \ - npm \ pkg-config \ xz-utils + - name: Get NPM + uses: actions/setup-node@v4 + with: + node-version: lts/* - name: Get Dependencies (GTK) if: ${{ needs.what-to-make.outputs.make-gtk == 'true' }} run: apt-get install -y --no-install-recommends libglibmm-2.4-dev libgtkmm-3.0-dev diff --git a/CMakeLists.txt b/CMakeLists.txt index f530721be..82b0147a0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -557,7 +557,12 @@ set(TR_WEB_ASSETS ${PROJECT_SOURCE_DIR}/web/public_html) if(REBUILD_WEB) tr_get_required_flag(REBUILD_WEB NPM_IS_REQUIRED) - find_program(NPM npm) + if(WIN32) + find_program(NPM npm.cmd) + else() + find_program(NPM npm) + endif() + if ("${NPM}" STREQUAL "NPM-NOTFOUND") set(NPM_FOUND OFF) if(NPM_IS_REQUIRED)