ci: 优化 GitHub Actions 工作流
This commit is contained in:
parent
39766aa1dc
commit
feaa3fca36
|
|
@ -5,9 +5,14 @@
|
||||||
*.sh text eol=lf
|
*.sh text eol=lf
|
||||||
*.py text eol=lf
|
*.py text eol=lf
|
||||||
*.md text eol=lf
|
*.md text eol=lf
|
||||||
|
*.yml text eol=lf
|
||||||
|
|
||||||
Dockerfile text eol=lf
|
Dockerfile text eol=lf
|
||||||
.dockerignore text eol=lf
|
.dockerignore text eol=lf
|
||||||
|
|
||||||
|
.gitignore text eol=lf
|
||||||
|
.gitattributes text eol=lf
|
||||||
|
|
||||||
# Windows scripts - use CRLF
|
# Windows scripts - use CRLF
|
||||||
*.bat text eol=crlf
|
*.bat text eol=crlf
|
||||||
*.cmd text eol=crlf
|
*.cmd text eol=crlf
|
||||||
|
|
|
||||||
|
|
@ -25,3 +25,7 @@ jobs:
|
||||||
- name: Check formatting with ruff
|
- name: Check formatting with ruff
|
||||||
run: |
|
run: |
|
||||||
ruff format --check .
|
ruff format --check .
|
||||||
|
|
||||||
|
- name: Check import sorting
|
||||||
|
run: |
|
||||||
|
ruff check . --select I
|
||||||
|
|
@ -60,13 +60,13 @@ run_lint() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Run code style check (linter)
|
# Run code style check (linter - import sorting)
|
||||||
run_ruff_lint() {
|
run_ruff_lint_import() {
|
||||||
print_info "Running code style check (ruff check)..."
|
print_info "Running import sorting check (ruff check --select I)..."
|
||||||
if ruff check .; then
|
if ruff check . --select I; then
|
||||||
print_success "Code style check passed"
|
print_success "Import sorting check passed"
|
||||||
else
|
else
|
||||||
print_error "Code style check failed. Please fix the issues above"
|
print_error "Import sorting check failed. Please run 'ruff check --select I --fix .' to fix import issues"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
@ -138,7 +138,7 @@ main() {
|
||||||
# Run code checks
|
# Run code checks
|
||||||
if [ "$SKIP_LINT" = false ]; then
|
if [ "$SKIP_LINT" = false ]; then
|
||||||
run_lint
|
run_lint
|
||||||
run_ruff_lint
|
run_ruff_lint_import
|
||||||
else
|
else
|
||||||
print_info "Skipping code checks"
|
print_info "Skipping code checks"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue