Skip to content

Conversation

@asterwyx
Copy link
Contributor

@asterwyx asterwyx commented Jun 9, 2025

Use VERSION file to manage DTK version. VERSION file defines package
version. It also decides the initial value of cached variable
DTK_VERSION which controls the project version in cmake build system.
VERSION file is not synchronized to DTK6, as DTK6 has its own VERSION
file. One can still pass version to DTK_VERSION when running cmake
configure. This is helpful for developers.

Signed-off-by: Yixue Wang [email protected]

Summary by Sourcery

Manage the project version via an external VERSION file in the CMake build and set up an automated GitHub Actions workflow for releases

New Features:

  • Configure CMake to read the project version from a top-level VERSION file and set DTK_VERSION cache accordingly
  • Introduce a reusable GitHub Actions workflow (call-auto-release.yml) to automate project releases with manual dispatch

Chores:

  • Add scaffolding files (VERSION, VERSION.in, .syncexclude, .reuse/dep5) to support version management and release processes

deepin-ci-robot added a commit to linuxdeepin/dtk6declarative that referenced this pull request Jun 9, 2025
Synchronize source files from linuxdeepin/dtkdeclarative.

Source-pull-request: linuxdeepin/dtkdeclarative#490
@sourcery-ai
Copy link

sourcery-ai bot commented Jun 9, 2025

Reviewer's Guide

This PR externalizes the project version into a standalone VERSION file, updates the CMake build to read and cache that file, and adds an automated GitHub workflow along with supporting files for release and sync exclusion.

Sequence Diagram for CMake Project Version Initialization

sequenceDiagram
    participant CMakeLists.txt
    participant FileSystem
    participant CMakeCache

    CMakeLists.txt->>FileSystem: Read "${CMAKE_CURRENT_SOURCE_DIR}/VERSION"
    FileSystem-->>CMakeLists.txt: Return file content (DTK_FILE_VERSION)
    CMakeLists.txt->>CMakeLists.txt: Strip whitespace from DTK_FILE_VERSION
    CMakeLists.txt->>CMakeCache: Set DTK_VERSION = DTK_FILE_VERSION
Loading

Sequence Diagram for Auto Release Workflow Trigger

sequenceDiagram
    actor User
    participant GitHub_UI as "GitHub UI/API"
    participant CallAutoReleaseWorkflow as "call-auto-release.yml"
    participant ReusableAutoReleaseWorkflow as "linuxdeepin/.../auto-release.yml"

    User->>GitHub_UI: Trigger 'Auto Release' (workflow_dispatch)
    GitHub_UI->>CallAutoReleaseWorkflow: Start workflow with inputs (version, name, email, timezone)
    CallAutoReleaseWorkflow->>ReusableAutoReleaseWorkflow: Call with inputs & secrets
    ReusableAutoReleaseWorkflow-->>CallAutoReleaseWorkflow: (Performs release tasks)
    CallAutoReleaseWorkflow-->>GitHub_UI: Workflow status
Loading

File-Level Changes

Change Details Files
Switch CMake to read version from VERSION file
  • Removed hard-coded DTK_VERSION cache default
  • Added file(READ) to load VERSION content
  • Stripped whitespace and set DTK_VERSION from file
CMakeLists.txt
Add GitHub auto-release workflow
  • Created a dispatchable workflow with inputs (version, name, email, timezone)
  • Enabled workflow_call to allow reuse by other workflows
  • Defined a job that leverages an external auto-release template and passes inputs
.github/workflows/call-auto-release.yml
Introduce version management and sync configuration files
  • Added a VERSION file to declare the package version
  • Provided a VERSION.in template for future automation
  • Excluded sync targets via .syncexclude
VERSION
VERSION.in
.syncexclude

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @asterwyx - I've reviewed your changes - here's some feedback:

  • Consider adding FORCE to the set(DTK_VERSION "${DTK_FILE_VERSION}" CACHE STRING "Define project version" FORCE) call so that the cached variable updates when the VERSION file changes.
  • Pin the uses: linuxdeepin/.github/.github/workflows/auto-release.yml@master reference to a specific commit or tag instead of master to prevent unexpected CI breakages from upstream changes.
Here's what I looked at during the review
  • 🟡 General issues: 1 issue found
  • 🟢 Security: all looks good
  • 🟢 Testing: all looks good
  • 🟢 Complexity: all looks good
  • 🟢 Documentation: all looks good

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.


jobs:
auto_release:
uses: linuxdeepin/.github/.github/workflows/auto-release.yml@master
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (bug_risk): Pin the reusable workflow to a specific tag or commit

Referencing 'master' can introduce instability if upstream changes unexpectedly. Use a fixed tag or commit SHA to ensure consistent workflow behavior.

Suggested implementation:

    uses: linuxdeepin/.github/.github/workflows/[email protected]

Replace v1.2.3 with the actual tag or commit SHA you want to pin to, based on the version of the reusable workflow you intend to use.

asterwyx added 2 commits June 9, 2025 18:04
Use VERSION file to manage DTK version. VERSION file defines package
version. It also decides the initial value of cached variable
DTK_VERSION which controls the project version in cmake build system.
VERSION file is not synchronized to DTK6, as DTK6 has its own VERSION
file. One can still pass version to DTK_VERSION when running cmake
configure. This is helpful for developers.

Signed-off-by: Yixue Wang <[email protected]>
Log: as title
Signed-off-by: Yixue Wang <[email protected]>
@deepin-ci-robot
Copy link
Contributor

deepin pr auto review

代码审查意见:

  1. .github/workflows/call-auto-release.yml文件中,workflow_dispatchworkflow_callinputs定义重复,可以考虑合并以简化代码。
  2. CMakeLists.txt文件中,读取VERSION文件并设置DTK_VERSION,这是一个好的做法,但是需要确保VERSION文件的内容格式正确,并且VERSION.in文件在构建过程中被正确替换为实际的版本号。
  3. .reuse/dep5文件中,新增的.syncexclude文件应该有相应的注释说明其用途。
  4. CMakeLists.txt文件中,set(DTK_VERSION "${DTK_FILE_VERSION}" CACHE STRING "Define project version")这行代码中,DTK_FILE_VERSION变量在设置之前应该进行错误检查,确保读取的版本号是有效的。
  5. CMakeLists.txt文件中,project(DtkDeclarative VERSION "${DTK_VERSION}" DESCRIPTION "DTK Declarative module")这行代码中,VERSION应该与VERSION.in文件中的版本号保持一致,以避免版本号不一致的问题。

总体来说,代码改动看起来是合理的,但是需要确保所有新增的文件和变量都有正确的用途和格式,并且与现有的构建流程和版本管理策略保持一致。

deepin-ci-robot added a commit to linuxdeepin/dtk6declarative that referenced this pull request Jun 9, 2025
Synchronize source files from linuxdeepin/dtkdeclarative.

Source-pull-request: linuxdeepin/dtkdeclarative#490
@asterwyx
Copy link
Contributor Author

/retest

@deepin-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: asterwyx, zccrs

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@zccrs zccrs merged commit 5b377a9 into linuxdeepin:master Jun 11, 2025
19 of 21 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.

3 participants