From fea1e4b9689eca2377ad934962dfcf600c47a57a Mon Sep 17 00:00:00 2001 From: fi3ework Date: Wed, 25 Dec 2024 16:22:23 +0800 Subject: [PATCH] ci: run benchmark daily and manually --- .github/workflows/benchmark.yml | 47 +++++++++++++++++++++++++++++++++ .github/workflows/lint.yml | 4 +-- .github/workflows/release.yml | 2 +- .github/workflows/test.yml | 44 +++--------------------------- 4 files changed, 54 insertions(+), 43 deletions(-) create mode 100644 .github/workflows/benchmark.yml diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml new file mode 100644 index 000000000..544a95cf9 --- /dev/null +++ b/.github/workflows/benchmark.yml @@ -0,0 +1,47 @@ +name: Benchmark + +on: + schedule: + - cron: '0 1 * * *' # 01:00 UTC + workflow_dispatch: + inputs: + ref: + description: 'head to bench (input branch, tag or SHA)' + required: true + default: 'main' + +jobs: + benchmark: + # Only Ubuntu 20.04 and 22.04 are supported at the moment. + # See https://github.com/CodSpeedHQ/action/blob/016456b513677f9d4a1c509c7f8a38d8dd55b2b0/.github/workflows/ci.yml#L19. + runs-on: ubuntu-22.04 + strategy: + matrix: + node-version: [20] + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 10 + ref: ${{ inputs.ref || 'main' }} + + - name: Install pnpm + run: corepack enable + + - name: Setup Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: 'pnpm' + + - name: Install Dependencies + run: pnpm install && cd ./tests && pnpm playwright install chromium + + # only run benchmark in Ubuntu + - name: Benchmarks (Vitest) + uses: CodSpeedHQ/action@v3 + with: + run: pnpm run test:benchmark + # token retrieved from the CodSpeed app at the previous step + token: ${{ secrets.CODSPEED_TOKEN }} diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 1acbcbfeb..338bffbc6 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -19,7 +19,7 @@ jobs: with: fetch-depth: 1 - - name: Install Pnpm + - name: Install pnpm run: corepack enable - name: Setup Node.js @@ -37,5 +37,5 @@ jobs: - name: Check Dependency Version run: pnpm run check-dependency-version - - name: Check Pnpm Dedupe + - name: Check pnpm Dedupe run: pnpm dedupe --check diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fa984db19..6caf27001 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -36,7 +36,7 @@ jobs: fetch-depth: 1 ref: ${{ github.event.inputs.branch }} - - name: Install Pnpm + - name: Install pnpm run: corepack enable - name: Setup Node.js diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 00be3358f..4d21950e4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -25,7 +25,7 @@ jobs: with: fetch-depth: 10 - - name: Install Pnpm + - name: Install pnpm run: corepack enable - uses: dorny/paths-filter@v3.0.2 @@ -64,7 +64,7 @@ jobs: run: | git config --system core.longpaths true - - name: Install Pnpm + - name: Install pnpm run: corepack enable - name: Setup Node.js ${{ matrix.node-version }} @@ -104,7 +104,7 @@ jobs: with: fetch-depth: 10 - - name: Install Pnpm + - name: Install pnpm run: corepack enable - name: Setup Node.js ${{ matrix.node-version }} @@ -122,46 +122,10 @@ jobs: - name: E2E Test (Playwright) run: pnpm run test:e2e - # ======== benchmark ======== - benchmark: - # Only Ubuntu 20.04 and 22.04 are supported at the moment. - # See https://github.com/CodSpeedHQ/action/blob/016456b513677f9d4a1c509c7f8a38d8dd55b2b0/.github/workflows/ci.yml#L19. - runs-on: ubuntu-22.04 - needs: [integration-e2e] - strategy: - matrix: - node-version: [20] - - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 10 - - - name: Install Pnpm - run: corepack enable - - - name: Setup Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node-version }} - cache: 'pnpm' - - - name: Install Dependencies - run: pnpm install && cd ./tests && pnpm playwright install chromium - - # only run benchmark in Ubuntu - - name: Benchmarks (Vitest) - uses: CodSpeedHQ/action@v3 - with: - run: pnpm run test:benchmark - # token retrieved from the CodSpeed app at the previous step - token: ${{ secrets.CODSPEED_TOKEN }} - # ======== exit ======== pr-check-required: if: (!cancelled() && !failure()) - needs: [ut, integration-e2e, benchmark] + needs: [ut, integration-e2e] runs-on: ubuntu-latest name: Test passed or skipped steps: