ci: 简化CI/CD配置,移除冗余测试步骤和覆盖率上报
重构了GitHub Actions工作流,合并重复的CI任务,移除了预发布测试环节、多余的格式检查和安全审计任务,精简了 tox 测试命令与矩阵配置,同时删除了本地 tox 配置中的覆盖率和测试结果上报参数,优化整体流水线效率。
This commit is contained in:
@@ -3,16 +3,14 @@ name: CI
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: [ main, develop ]
|
branches: [ main, develop ]
|
||||||
pull_request:
|
|
||||||
branches: [ main, develop ]
|
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
group: ${{ github.workflow }}-${{ github.ref }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
lint:
|
lint-and-typecheck:
|
||||||
name: Lint (Ruff)
|
name: Lint & Typecheck
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
@@ -27,66 +25,15 @@ jobs:
|
|||||||
|
|
||||||
- run: uv sync
|
- run: uv sync
|
||||||
- run: uv run ruff check src tests
|
- run: uv run ruff check src tests
|
||||||
|
|
||||||
format-check:
|
|
||||||
name: Format Check (Ruff)
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- uses: astral-sh/setup-uv@v5
|
|
||||||
with:
|
|
||||||
enable-cache: true
|
|
||||||
|
|
||||||
- uses: actions/setup-python@v5
|
|
||||||
with:
|
|
||||||
python-version: '3.13'
|
|
||||||
|
|
||||||
- run: uv sync
|
|
||||||
- run: uv run ruff format --check src tests
|
|
||||||
|
|
||||||
typecheck:
|
|
||||||
name: Typecheck (Pyrefly)
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- uses: astral-sh/setup-uv@v5
|
|
||||||
with:
|
|
||||||
enable-cache: true
|
|
||||||
|
|
||||||
- uses: actions/setup-python@v5
|
|
||||||
with:
|
|
||||||
python-version: '3.13'
|
|
||||||
|
|
||||||
- run: uv sync
|
|
||||||
- run: uv run pyrefly check .
|
- run: uv run pyrefly check .
|
||||||
|
|
||||||
security-audit:
|
|
||||||
name: Security Audit
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- uses: astral-sh/setup-uv@v5
|
|
||||||
with:
|
|
||||||
enable-cache: true
|
|
||||||
|
|
||||||
- uses: actions/setup-python@v5
|
|
||||||
with:
|
|
||||||
python-version: '3.13'
|
|
||||||
|
|
||||||
- run: uv sync
|
|
||||||
- run: uv tool run pip-audit --desc on
|
|
||||||
|
|
||||||
test:
|
test:
|
||||||
name: Test (${{ matrix.os }} / py${{ matrix.python-version }})
|
name: Test (${{ matrix.os }})
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [ubuntu-latest, windows-latest, macos-latest]
|
os: [ubuntu-latest, windows-latest, macos-latest]
|
||||||
python-version: ['3.8', '3.10', '3.13']
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
@@ -96,42 +43,8 @@ jobs:
|
|||||||
|
|
||||||
- uses: actions/setup-python@v5
|
- uses: actions/setup-python@v5
|
||||||
with:
|
with:
|
||||||
python-version: ${{ matrix.python-version }}
|
python-version: |
|
||||||
|
3.8
|
||||||
|
3.13
|
||||||
|
|
||||||
- name: Run tests
|
- run: uvx tox run -e py38,py313
|
||||||
run: uvx tox run -e py${{ matrix.python-version }}
|
|
||||||
|
|
||||||
- name: Upload test results
|
|
||||||
uses: actions/upload-artifact@v7
|
|
||||||
if: always()
|
|
||||||
with:
|
|
||||||
name: test-results-${{ matrix.os }}-py${{ matrix.python-version }}
|
|
||||||
path: |
|
|
||||||
test-results-*.xml
|
|
||||||
coverage-*.xml
|
|
||||||
if-no-files-found: ignore
|
|
||||||
|
|
||||||
coverage:
|
|
||||||
name: Coverage Summary
|
|
||||||
needs: test
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
if: always()
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- uses: actions/download-artifact@v8
|
|
||||||
with:
|
|
||||||
path: artifacts
|
|
||||||
|
|
||||||
- name: Collect coverage files
|
|
||||||
run: |
|
|
||||||
find artifacts -name "coverage-*.xml" -exec cp {} . \;
|
|
||||||
ls -la coverage-*.xml 2>/dev/null || echo "No coverage files found"
|
|
||||||
|
|
||||||
- name: Publish test results
|
|
||||||
uses: EnricoMi/publish-unit-test-result-action@v2
|
|
||||||
if: always() && github.event_name == 'pull_request'
|
|
||||||
with:
|
|
||||||
files: artifacts/**/test-results-*.xml
|
|
||||||
comment_mode: off
|
|
||||||
fail_on: nothing
|
|
||||||
|
|||||||
@@ -9,25 +9,7 @@ permissions:
|
|||||||
id-token: write
|
id-token: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
|
||||||
name: Pre-release Test
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- uses: astral-sh/setup-uv@v5
|
|
||||||
with:
|
|
||||||
enable-cache: true
|
|
||||||
|
|
||||||
- uses: actions/setup-python@v5
|
|
||||||
with:
|
|
||||||
python-version: '3.13'
|
|
||||||
|
|
||||||
- run: uv sync
|
|
||||||
- run: uv run pytest -m "not slow" -n auto --cov=pyflowx
|
|
||||||
|
|
||||||
build:
|
build:
|
||||||
needs: test
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
outputs:
|
outputs:
|
||||||
version: ${{ steps.version.outputs.version }}
|
version: ${{ steps.version.outputs.version }}
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ uv_sync = true
|
|||||||
deps =
|
deps =
|
||||||
.[dev]
|
.[dev]
|
||||||
commands =
|
commands =
|
||||||
pytest -m "not slow" -n auto --cov=pyflowx --cov-report=term --cov-report=xml:coverage-{envname}.xml --junitxml=test-results-{envname}.xml {posargs}
|
pytest -m "not slow" {posargs}
|
||||||
passenv =
|
passenv =
|
||||||
CI
|
CI
|
||||||
GITHUB_*
|
GITHUB_*
|
||||||
@@ -19,4 +19,3 @@ passenv =
|
|||||||
setenv =
|
setenv =
|
||||||
PYTHONPATH = {toxinidir}/src
|
PYTHONPATH = {toxinidir}/src
|
||||||
PYTHONDONTWRITEBYTECODE = 1
|
PYTHONDONTWRITEBYTECODE = 1
|
||||||
COVERAGE_FILE = .coverage.{envname}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user