Skip to content

Commit

Permalink
ci: 规范工作流程
Browse files Browse the repository at this point in the history
  • Loading branch information
geekact committed Jul 21, 2024
1 parent 2088231 commit 44658ce
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 20 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Lint

on: [push]

jobs:
git-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
cache: 'pnpm'
node-version-file: 'package.json'
- run: pnpm install
- if: github.event_name == 'pull_request'
run: pnpm exec commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose
- if: github.event_name == 'push'
run: echo "${{ github.event.head_commit.message }}" | pnpm exec commitlint --verbose
type-checking:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ts: [5.0.x, 5.1.x, 5.2.x, 5.3.x, 5.4.x, 5.5.x]
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
cache: 'pnpm'
node-version-file: 'package.json'
- name: Use Typescript@${{ matrix.ts }}
run: |
pnpm install
pnpm install typescript@${{ matrix.ts }}
- run: pnpm exec tsc
code-format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
cache: 'pnpm'
node-version-file: 'package.json'
- run: pnpm install
- run: pnpm exec prettier --cache --check .
bundle:
needs: [git-commit, type-checking, code-format]
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
node: [18, 20, 22]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
cache: 'pnpm'
node-version: ${{ matrix.node }}
- run: pnpm install
- run: pnpm build
20 changes: 0 additions & 20 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,6 @@ on:
branches:

jobs:
type-checking:
if: "!contains(toJson(github.event.commits), '[skip ci]')"
strategy:
matrix:
node-version: [18.x, 20.x, 22.x]
ts-version: [5.0.x, 5.1.x, 5.2.x, 5.3.x, 5.4.x, 5.5.x]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
- name: Use Node.js ${{ matrix.node-version }} & Typescript ${{ matrix.ts-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- run: |
pnpm install
pnpm add typescript@${{ matrix.ts-version }} -D
- run: pnpm tsc

test:
if: "!contains(toJson(github.event.commits), '[skip ci]')"
strategy:
Expand Down

0 comments on commit 44658ce

Please sign in to comment.