-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #26 from FlowerBlackG/xym
CI: NPM Lint & Code-Style Check
- Loading branch information
Showing
3 changed files
with
96 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
name: Code Style Check | ||
|
||
on: | ||
push: | ||
branches: | ||
- main # 当代码推送到 main 分支时触发 | ||
pull_request: | ||
branches: | ||
- main # 当对 main 分支发起 Pull Request 时触发 | ||
|
||
jobs: | ||
lint: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 # 拉取代码仓库内容 | ||
|
||
- name: Set up Python environment | ||
uses: actions/setup-python@v4 # 设置 Python 环境 | ||
with: | ||
python-version: '3.10.13' # 指定 Python 版本 | ||
|
||
- name: Install flake8 | ||
run: pip install flake8 # 安装代码风格检测工具 flake8 | ||
|
||
- name: Run flake8 | ||
run: | | ||
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | ||
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | ||
- name: Upload flake8 report | ||
if: failure() | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: flake8-report | ||
path: flake8-report.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '16' | ||
|
||
- name: Install dependencies | ||
run: | | ||
npm install | ||
- name: Run tests | ||
run: | | ||
npm test | ||
lint: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '16' | ||
|
||
- name: Install dependencies | ||
run: | | ||
npm install | ||
- name: Run linter | ||
run: | | ||
npm run lint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters