Skip to content

Commit

Permalink
chore: 更新 GitHub Workflows 并添加 Prettier 和 ESLint 检查 (#117)
Browse files Browse the repository at this point in the history
  • Loading branch information
st1020 authored Mar 23, 2024
1 parent 12e3fea commit 364aa53
Show file tree
Hide file tree
Showing 7 changed files with 91 additions and 36 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,20 @@ on:
branches:
- master
paths-ignore:
- "examples/**"
- 'examples/**'
pull_request:
paths-ignore:
- "examples/**"
- 'examples/**'
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: pdm-project/setup-pdm@v3
- uses: pdm-project/setup-pdm@v4
name: Setup PDM
with:
python-version: 3.9
Expand All @@ -43,7 +43,7 @@ jobs:
- name: Build VuePress site
run: pnpm docs:build

- uses: actions/upload-pages-artifact@v1
- uses: actions/upload-pages-artifact@v3
if: github.event_name != 'pull_request'
with:
path: docs/.vitepress/dist
Expand All @@ -67,4 +67,4 @@ jobs:
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
uses: actions/deploy-pages@v4
47 changes: 47 additions & 0 deletions .github/workflows/lint-other.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Lint Other Files

on:
push:
branches:
- master
paths-ignore:
- '**.py'
pull_request:
paths-ignore:
- '**.py'
workflow_dispatch:

jobs:
prettier:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v3
with:
version: latest
- uses: actions/setup-node@v4
with:
node-version: latest
cache: pnpm
- run: pnpm install
shell: bash

- run: pnpm run prettier

eslint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v3
with:
version: latest
- uses: actions/setup-node@v4
with:
node-version: latest
cache: pnpm
- run: pnpm install
shell: bash

- run: pnpm run eslint
30 changes: 15 additions & 15 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ on:
branches:
- master
paths:
- "**.py"
- '**.py'
pull_request:
paths:
- "**.py"
- '**.py'
workflow_dispatch:

jobs:
ruff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: pdm-project/setup-pdm@v3
- uses: pdm-project/setup-pdm@v4
name: Setup PDM
with:
python-version: 3.9
Expand All @@ -33,9 +33,9 @@ jobs:
pylint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: pdm-project/setup-pdm@v3
- uses: pdm-project/setup-pdm@v4
name: Setup PDM
with:
python-version: 3.9
Expand All @@ -50,23 +50,23 @@ jobs:
pyright:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: pdm-project/setup-pdm@v3
- uses: pdm-project/setup-pdm@v4
name: Setup PDM
with:
python-version: 3.9
cache: true
- name: Install dependencies
run: pdm install -G dev -G lint -G typing -G test

- uses: pnpm/action-setup@v2
- uses: pnpm/action-setup@v3
with:
version: ^6.10.0
- uses: actions/setup-node@v3
version: latest
- uses: actions/setup-node@v4
with:
node-version: "16"
cache: "pnpm"
node-version: latest
cache: pnpm
- run: pnpm install
shell: bash

Expand All @@ -77,9 +77,9 @@ jobs:
mypy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: pdm-project/setup-pdm@v3
- uses: pdm-project/setup-pdm@v4
name: Setup PDM
with:
python-version: 3.9
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ jobs:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: pdm-project/setup-pdm@v3
- uses: pdm-project/setup-pdm@v4
name: Setup PDM
with:
python-version: 3.9
Expand All @@ -30,9 +30,9 @@ jobs:
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
commit-message: "docs: 更新 API 文档"
title: "docs: 更新 API 文档"
body: "自动更新 API 文档"
commit-message: 'docs: 更新 API 文档'
title: 'docs: 更新 API 文档'
body: 自动更新 API 文档
branch: docs/update-api-docs
base: master

Expand All @@ -42,9 +42,9 @@ jobs:
permissions:
id-token: write
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: pdm-project/setup-pdm@v3
- uses: pdm-project/setup-pdm@v4
name: Setup PDM
with:
python-version: 3.9
Expand Down
15 changes: 8 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ on:
- master
pull_request:
paths:
- "**.py"
- "!docs/**"
- "!examples/**"
- '**.py'
- '!docs/**'
- '!examples/**'

jobs:
test:
Expand All @@ -19,17 +19,17 @@ jobs:
cancel-in-progress: true
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
os: [ubuntu-latest, windows-latest, macos-latest]
fail-fast: false
env:
OS: ${{ matrix.os }}
PYTHON_VERSION: ${{ matrix.python-version }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- uses: pdm-project/setup-pdm@v3
- uses: pdm-project/setup-pdm@v4
name: Setup PDM
with:
python-version: ${{ matrix.python-version }}
Expand All @@ -41,9 +41,10 @@ jobs:
run: pdm run pytest -n auto --cov-report xml

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
env_vars: OS,PYTHON_VERSION
fail_ci_if_error: true
files: ./coverage.xml
flags: unittests
token: ${{ secrets.CODECOV_TOKEN }}
6 changes: 6 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
pnpm-lock.yaml
docs/api/
docs/dev-api/
**/*.ts
**/*.js
**/*.vue
**/*.jsonc
3 changes: 2 additions & 1 deletion .prettierrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"trailingComma": "es5"
"semi": false,
"singleQuote": true
}

0 comments on commit 364aa53

Please sign in to comment.