Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 12, 2026

The workflow used incompatible action versions for legacy Python, lacked support for Python 3.10+, and published to PyPI on every push instead of releases only.

Changes

Job Structure

  • Split into test-legacy (Python 3.5-3.7, ubuntu-20.04, setup-python@v4) and test-modern (Python 3.8-3.13, ubuntu-latest, setup-python@v5)
  • Add publish job that depends on both test jobs and only runs on release events
  • Enable fail-fast: false for independent version testing

Codecov Configuration

  • Upgrade codecov/codecov-action v4 → v5
  • Fix coverage file path: ./coverage1.xml,./coverage2.xml./coverage.xml
  • Remove deprecated pip install codecov

Security

  • Add explicit GITHUB_TOKEN permissions: contents: read for test jobs, contents: read + id-token: write for publish

Workflow Triggers

on:
  push:
  release:
    types: [published]

Publish job conditional:

if: github.event_name == 'release'
needs: [test-legacy, test-modern]
Original prompt

问题描述

当前的 GitHub Actions workflow 配置 (.github/workflows/python.yml) 存在以下问题:

  1. Python 版本配置问题

    • 使用 actions/setup-python@v5,但该版本不支持 Python 3.5 和 3.6
    • 缺少对 Python 3.10、3.11、3.12、3.13 的测试
  2. Ubuntu 版本问题

    • ubuntu-20.04 即将停止支持(2025年4月)
    • 新版 Python 需要使用更新的 Ubuntu
  3. Codecov 配置问题

    • codecov/codecov-action@v4 已有 v5 版本
    • files 参数指定的文件 (coverage1.xml,coverage2.xml) 与 pytest 生成的文件 (coverage.xml) 不匹配
  4. 发布逻辑问题

    • 当前每次 push 都会尝试发布到 PyPI,应该只在 release 时发布

需要的修改

将 workflow 分成两个 job:

1. test-legacy job

  • 使用 ubuntu-20.04actions/setup-python@v4
  • 测试 Python 3.5、3.6、3.7

2. test-modern job

  • 使用 ubuntu-latestactions/setup-python@v5
  • 测试 Python 3.8、3.9、3.10、3.11、3.12、3.13

3. publish job

  • 依赖 test-legacytest-modern 都成功
  • 只在 release 事件发布时触发
  • 发布包到 PyPI

其他修改

  • 更新 codecov/codecov-action 到 v5
  • 修正 coverage 文件路径为 ./coverage.xml
  • 移��过时的 pip install codecov
  • 添加 fail-fast: false 以便所有版本都能完成测试

This pull request was created from Copilot chat.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits January 12, 2026 01:19
…and release-only publish

Co-authored-by: supercoderhawk <10846896+supercoderhawk@users.noreply.github.com>
Co-authored-by: supercoderhawk <10846896+supercoderhawk@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix GitHub Actions workflow configuration issues Split GitHub Actions workflow into legacy/modern Python jobs and fix publish logic Jan 12, 2026
Copilot AI requested a review from supercoderhawk January 12, 2026 01:22
@supercoderhawk supercoderhawk marked this pull request as ready for review January 12, 2026 01:31
@supercoderhawk supercoderhawk merged commit d862dd2 into master Jan 12, 2026
6 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants