Skip to content

Commit

Permalink
ci: clean up and lock benchmark node version
Browse files Browse the repository at this point in the history
  • Loading branch information
fi3ework committed Oct 10, 2024
1 parent 93d150d commit 690ece0
Show file tree
Hide file tree
Showing 5 changed files with 102 additions and 55 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ jobs:
- name: Install Pnpm
run: corepack enable

- name: Setup Node.js 18.x
- name: Setup Node.js 18
uses: actions/setup-node@v4
with:
node-version: 18.x
node-version: 18
cache: 'pnpm'

- name: Install Dependencies
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: Setup Node.js 18
uses: actions/setup-node@v4
with:
node-version: '18'
node-version: 18
cache: 'pnpm'

- name: Install Dependencies
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
- name: Setup Node.js 18
uses: actions/setup-node@v4
with:
node-version: '18'
node-version: 18
cache: 'pnpm'

- name: Install Dependencies
Expand Down
87 changes: 64 additions & 23 deletions .github/workflows/test-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@ on:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# ======== ut ========
ut-ubuntu:
# ======== caculate changes ========
changes:
runs-on: ubuntu-latest
outputs:
changed: ${{ steps.changes.outputs.changed }}
strategy:
matrix:
node-version: [18.x]
node-version: [18]

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
Expand All @@ -44,27 +46,45 @@ jobs:
- "!**/_meta.json"
- "!**/dictionary.txt"
# ======== ut ========
ut-ubuntu:
runs-on: ubuntu-latest
needs: changes
if: ${{ needs.changes.outputs.changed == 'true' }}
strategy:
matrix:
node-version: [18, 20, 22]

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 10

- name: Install Pnpm
run: corepack enable

- name: Setup Node.js ${{ matrix.node-version }}
if: steps.changes.outputs.changed == 'true'
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'

- name: Install Dependencies
if: steps.changes.outputs.changed == 'true'
run: pnpm install

- name: Unit Test
if: steps.changes.outputs.changed == 'true'
run: pnpm run test:unit

# ======== integration && e2e ========
integration-e2e-ubuntu:
runs-on: ubuntu-latest
needs: changes
if: ${{ needs.changes.outputs.changed == 'true' }}
strategy:
matrix:
node-version: [18.x]
node-version: [18, 20, 22]

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
Expand All @@ -76,40 +96,61 @@ jobs:
- name: Install Pnpm
run: corepack enable

- uses: dorny/paths-filter@v3
id: changes
with:
predicate-quantifier: 'every'
filters: |
changed:
- "!**/*.md"
- "!**/*.mdx"
- "!**/_meta.json"
- "!**/dictionary.txt"
- name: Setup Node.js ${{ matrix.node-version }}
if: steps.changes.outputs.changed == 'true'
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'

- name: Install Dependencies
if: steps.changes.outputs.changed == 'true'
run: pnpm install && cd ./tests && npx playwright install

- name: Integration Test (Vitest)
if: steps.changes.outputs.changed == 'true'
run: pnpm run test:integration

- name: E2E Test (Playwright)
if: steps.changes.outputs.changed == 'true'
run: pnpm run test:e2e

# only run benchmark in Ubuntu
- name: Benchmarks (Vitest)
uses: CodSpeedHQ/action@v3
if: steps.changes.outputs.changed == 'true'
with:
run: pnpm run test:benchmark
# token retrieved from the CodSpeed app at the previous step
token: ${{ secrets.CODSPEED_TOKEN }}

# ======== benchmark ========
benchemark-ubuntu:
runs-on: ubuntu-latest
needs: [integration-e2e-ubuntu]
strategy:
matrix:
# 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.
node-version: [20.04]

# Steps represent a sequence of tasks that will be executed as part of the job
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 && npx playwright install

# 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
Expand Down
62 changes: 34 additions & 28 deletions .github/workflows/test-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,17 @@ on:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# ======== ut ========
ut-windows:
# ======== caculate changes ========
changes:
runs-on: windows-latest
outputs:
changed: ${{ steps.changes.outputs.changed }}
strategy:
matrix:
node-version: [18.x]
node-version: [18]

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Git config
shell: bash
run: |
git config --system core.longpaths true
- name: Checkout
uses: actions/checkout@v4
with:
Expand All @@ -49,27 +46,50 @@ jobs:
- "!**/_meta.json"
- "!**/dictionary.txt"
# ======== ut ========
ut-windows:
runs-on: windows-latest
needs: changes
if: ${{ needs.changes.outputs.changed == 'true' }}
strategy:
matrix:
node-version: [18]

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Git config
shell: bash
run: |
git config --system core.longpaths true
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 10

- name: Install Pnpm
run: corepack enable

- name: Setup Node.js ${{ matrix.node-version }}
if: steps.changes.outputs.changed == 'true'
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'

- name: Install Dependencies
if: steps.changes.outputs.changed == 'true'
run: pnpm install

- name: Unit Test
if: steps.changes.outputs.changed == 'true'
run: pnpm run test:unit

# # ======== integration && e2e ========
# ======== integration && e2e ========
integration-e2e-windows:
runs-on: windows-latest
needs: changes
if: ${{ needs.changes.outputs.changed == 'true' }}
strategy:
matrix:
node-version: [18.x]
node-version: [18]

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
Expand All @@ -86,31 +106,17 @@ jobs:
- name: Install Pnpm
run: corepack enable

- uses: dorny/paths-filter@v3
id: changes
with:
predicate-quantifier: 'every'
filters: |
changed:
- "!**/*.md"
- "!**/*.mdx"
- "!**/_meta.json"
- "!**/dictionary.txt"
- name: Setup Node.js ${{ matrix.node-version }}
if: steps.changes.outputs.changed == 'true'
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'

- name: Install Dependencies
if: steps.changes.outputs.changed == 'true'
run: pnpm install && cd ./tests && npx playwright install

- name: Integration Test (Vitest)
if: steps.changes.outputs.changed == 'true'
run: pnpm run test:integration

- name: E2E Test (Playwright)
if: steps.changes.outputs.changed == 'true'
run: pnpm run test:e2e

0 comments on commit 690ece0

Please sign in to comment.