From adbec4e8d06bae94ec9a651e45e2a377d75838cb Mon Sep 17 00:00:00 2001 From: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com> Date: Sat, 13 Dec 2025 05:37:56 -0500 Subject: [PATCH] =?UTF-8?q?=E5=88=86=E7=A6=BB=20workflow=20=E5=B9=B6?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=20Actions=20=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/test-pr.yml | 40 +++++++++++++++++++++++++++++++++++ .github/workflows/test.yml | 25 ++++++++++------------ 2 files changed, 51 insertions(+), 14 deletions(-) create mode 100644 .github/workflows/test-pr.yml diff --git a/.github/workflows/test-pr.yml b/.github/workflows/test-pr.yml new file mode 100644 index 000000000..a5340dd62 --- /dev/null +++ b/.github/workflows/test-pr.yml @@ -0,0 +1,40 @@ +name: Test Pull Request + +on: + pull_request: + types: [opened, reopened, synchronize] + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + # 拉取代码 + - name: Checkout + uses: actions/checkout@v6 + with: + fetch-depth: 1 + - name: Install Node.js + uses: actions/setup-node@v6 + with: + node-version: 24 + - name: Install pnpm + uses: pnpm/action-setup@v4 + with: + run_install: false + + - name: Get pnpm store directory + shell: bash + run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV + - name: Setup pnpm cache + uses: actions/cache@v5 + with: + path: ${{ env.STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- + + - name: Install + run: pnpm install --frozen-lockfile + + - name: Build + run: pnpm run build diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fdd0a8277..87b5d3226 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,10 +2,7 @@ name: Test on: push: - branches: - - "main" - pull_request: - types: [opened, reopened, synchronize] + branches: ["main"] jobs: deploy: @@ -13,13 +10,13 @@ jobs: steps: # 拉取代码 - name: Checkout - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: fetch-depth: 1 - name: Install Node.js - uses: actions/setup-node@v4 + uses: actions/setup-node@v6 with: - node-version: 20 + node-version: 24 - name: Install pnpm uses: pnpm/action-setup@v4 with: @@ -27,17 +24,17 @@ jobs: - name: Get pnpm store directory shell: bash - run: | - echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV + run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV - name: Setup pnpm cache - uses: actions/cache@v4 + uses: actions/cache@v5 with: path: ${{ env.STORE_PATH }} key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} restore-keys: | ${{ runner.os }}-pnpm-store- - - name: "Install" - run: "pnpm install --frozen-lockfile" - - name: "Build" - run: "pnpm run build" + - name: Install + run: pnpm install --frozen-lockfile + + - name: Build + run: pnpm run build