Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(CI): modify test ci yaml to make pr merge correctly #747

Merged
merged 2 commits into from
Feb 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ on:

workflow_dispatch:

permissions:
contents: read

jobs:
lint:
runs-on: ubuntu-latest
Expand All @@ -27,7 +30,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 22
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 @@ -44,7 +44,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 22
cache: 'pnpm'

- name: Install Dependencies
Expand Down
89 changes: 39 additions & 50 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,43 +9,13 @@ on:

workflow_dispatch:

jobs:
# ======== calculate changes ========
changes:
runs-on: ubuntu-latest
outputs:
changed: ${{ steps.changes.outputs.changed }}
strategy:
matrix:
node-version: [18]

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 10

- name: Install pnpm
run: |
npm install -g corepack@latest --force
corepack enable

- uses: dorny/[email protected]
id: changes
with:
predicate-quantifier: 'every'
filters: |
changed:
- "!**/*.md"
- "!**/*.mdx"
- "!**/_meta.json"
- "!**/dictionary.txt"
permissions:
contents: read

jobs:
# ======== ut ========
ut:
runs-on: ${{ matrix.os }}
needs: changes
if: ${{ needs.changes.outputs.changed == 'true' }}
strategy:
matrix:
os: [ubuntu-latest]
Expand All @@ -58,7 +28,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 10
fetch-depth: 1

- name: Git config
if: ${{ matrix.os == 'windows-latest' }}
Expand All @@ -71,26 +41,39 @@ jobs:
npm install -g corepack@latest --force
corepack enable

- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
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

- name: Type Check
if: steps.changes.outputs.changed == 'true'
run: pnpm run type-check

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

# ======== integration && e2e ========
integration-e2e:
runs-on: ${{ matrix.os }}
needs: changes
if: ${{ needs.changes.outputs.changed == 'true' }}
strategy:
matrix:
os: [ubuntu-latest]
Expand All @@ -100,42 +83,48 @@ jobs:
os: windows-latest

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Git config
if: ${{ matrix.os == 'windows-latest' }}
shell: bash
run: |
git config --system core.longpaths true

- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 10

- name: Install pnpm
run: |
npm install -g corepack@latest --force
corepack enable

- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
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 && pnpm playwright install chromium

- 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

# ======== exit ========
pr-check-required:
if: (!cancelled() && !failure())
needs: [ut, integration-e2e]
runs-on: ubuntu-latest
name: Test passed or skipped
steps:
- run: echo "All tests passed or skipped."
Loading