From b10a8ef27d0d9256eddd17d1e8eba3464ea19f31 Mon Sep 17 00:00:00 2001 From: liangbowen Date: Mon, 12 Jun 2023 09:02:09 +0800 Subject: [PATCH] [KYUUBI #4948] [BUILD] Reuse versions of NodeJS and Pnpm from maven properties ### _Why are the changes needed?_ - fetch versions for NodeJS and Pnpm from Maven properties - enabled npm dependency caching for global packages and web-ui module, as the step above takes extra time in builds. ### _How was this patch tested?_ - [ ] Add some test cases that check the changes thoroughly including negative and positive cases if possible - [ ] Add screenshots for manual tests if appropriate - [x] [Run test](https://kyuubi.readthedocs.io/en/master/develop_tools/testing.html#running-tests) locally before make a pull request Closes #4948 from bowenliang123/pnpm-version. Closes #4948 80b0f6934 [liangbowen] Reuse versions of NodeJS and Pnpm from maven properties Authored-by: liangbowen Signed-off-by: liangbowen --- .github/workflows/web-ui.yml | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/.github/workflows/web-ui.yml b/.github/workflows/web-ui.yml index 13d072321..9de7a599d 100644 --- a/.github/workflows/web-ui.yml +++ b/.github/workflows/web-ui.yml @@ -21,14 +21,35 @@ jobs: steps: - name: checkout uses: actions/checkout@v3 - - name: setup npm + - name: Setup JDK 8 + uses: actions/setup-java@v3 + with: + distribution: temurin + java-version: 8 + - name: Setup Maven + uses: ./.github/actions/setup-maven + - name: Get NodeJS and PNPM version + run: | + NODEJS_VERSION=$(build/mvn help:evaluate -Dexpression=node.version -q -DforceStdout) + PNPM_VERSION=$(build/mvn help:evaluate -Dexpression=pnpm.version -q -DforceStdout) + echo "NODEJS_VERSION=${NODEJS_VERSION}" >> "$GITHUB_ENV" + echo "PNPM_VERSION=${PNPM_VERSION}" >> "$GITHUB_ENV" + - name: Setup Nodejs and NPM uses: actions/setup-node@v3 with: - node-version: 18 + node-version: ${{env.NODEJS_VERSION}} + cache: npm + cache-dependency-path: ./kyuubi-server/web-ui/package.json + - name: Cache NPM dependencies + uses: actions/cache@v3 + with: + path: ./kyuubi-server/web-ui/node_modules + key: webui-dependencies-${{ hashFiles('kyuubi-server/web-ui/pnpm-lock.yaml') }} + restore-keys: webui-dependencies- - name: npm run coverage & build run: | cd ./kyuubi-server/web-ui - npm install pnpm@8 -g + npm install pnpm@${PNPM_VERSION} -g pnpm install pnpm run coverage pnpm run build