Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build with cake #11

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open

Build with cake #11

wants to merge 9 commits into from

Conversation

clansty
Copy link
Contributor

@clansty clansty commented Jan 20, 2025

我在想要不要把现在的 AquaMai.Build 也合并进去

Summary by Sourcery

将 Cake 构建自动化集成到项目中,更新构建流程和 CI 工作流以使用新的脚本。修改 README 以指导开发者使用新的构建系统。

构建:

  • 引入 Cake 构建脚本以自动化构建过程。

CI:

  • 更新 GitHub Actions 工作流,使用浅克隆并修改构建命令以使用新的构建脚本。

文档:

  • 更新 README 以反映使用 Cake 脚本的新构建流程。
Original summary in English

Summary by Sourcery

Integrate Cake build automation into the project, updating the build process and CI workflow to utilize the new script. Modify the README to guide developers on using the new build system.

Build:

  • Introduce a Cake build script to automate the build process.

CI:

  • Update GitHub Actions workflow to use a shallow clone and modify the build command to use the new build script.

Documentation:

  • Update README to reflect the new build process using the Cake script.

Copy link

sourcery-ai bot commented Jan 20, 2025

审阅者指南 by Sourcery

此拉取请求引入了使用 Cake 和 PowerShell 脚本的新构建流程,更新了 GitHub Actions 工作流,并修改了 BuildInfo 类以包含动态版本控制。同时简化了 README 中的开发设置说明。

显示 BuildInfo 变更的类图

classDiagram
    class BuildInfo {
        +string Name
        +string Description
        +string Author
        +string Company
        -string Version
        +string GitVersion
        +string BuildDate
        +string DownloadLink
    }
    note for BuildInfo "版本现在是自动生成的
增加了 GitVersion 和 BuildDate"
Loading

新构建流程的流程图

graph TD
    A[开始构建] --> B[还原 .NET 工具]
    B --> C[运行 Cake 脚本]
    C --> D[获取 Git 版本信息]
    D --> E[生成 BuildInfo.g.cs]
    E --> F[还原依赖项]
    F --> G[构建解决方案]
    G --> H[输出 AquaMai.dll]
Loading

文件级变更

变更 详情 文件
更新 GitHub Actions 工作流以构建 AquaMai
  • 删除了推送和拉取请求目标事件的分支规范
  • 为 actions/checkout 添加了 fetch-depth 选项
  • 将构建命令从 dotnet build 更改为 powershell ./build.ps1
  • 更新了检查主分支的 Telegram 通知条件
.github/workflows/aquamai.yaml
简化 README 中的开发说明
  • 删除了在 JetBrains Rider 中打开 AquaMai.sln 的步骤
  • 将构建解决方案步骤替换为运行 build.ps1 脚本
README.md
修改 BuildInfo 类结构和内容
  • 将 BuildInfo 类更改为部分类
  • 删除了 Version 常量
  • 添加了 GitVersion 和 BuildDate 常量
AquaMai/BuildInfo.cs
AquaMai.Core/BuildInfo.cs
更新 AssemblyInfo 以使用 GitVersion
  • 在 MelonInfo 属性中将 BuildInfo.Version 替换为 BuildInfo.GitVersion
AquaMai/Properties/AssemblyInfo.cs
引入 Cake 构建脚本
  • 添加 build.cake 脚本以实现构建自动化
  • 定义了还原、预构建和构建任务
  • 生成包含版本和构建日期的 BuildInfo.g.cs 文件
build.cake
添加用于构建流程的 PowerShell 脚本
  • 创建 build.ps1 以执行 Cake 构建脚本
build.ps1

提示和命令

与 Sourcery 交互

  • 触发新的审阅: 在拉取请求中评论 @sourcery-ai review
  • 继续讨论: 直接回复 Sourcery 的审阅评论。
  • 从审阅评论生成 GitHub 问题: 通过回复评论,要求 Sourcery 创建一个问题。
  • 生成拉取请求标题: 在拉取请求标题的任何位置写 @sourcery-ai 以随时生成标题。
  • 生成拉取请求摘要: 在拉取请求正文的任何位置写 @sourcery-ai summary 以随时生成 PR 摘要。您还可以使用此命令指定摘要的插入位置。

自定义您的体验

访问您的仪表板以:

  • 启用或禁用审阅功能,如 Sourcery 生成的拉取请求摘要、审阅者指南等。
  • 更改审阅语言。
  • 添加、删除或编辑自定义审阅说明。
  • 调整其他审阅设置。

获取帮助

Original review guide in English

Reviewer's Guide by Sourcery

This pull request introduces a new build process using Cake and PowerShell scripts, updates the GitHub Actions workflow, and modifies the BuildInfo class to include dynamic versioning. It also simplifies the development setup instructions in the README.

Class diagram showing BuildInfo changes

classDiagram
    class BuildInfo {
        +string Name
        +string Description
        +string Author
        +string Company
        -string Version
        +string GitVersion
        +string BuildDate
        +string DownloadLink
    }
    note for BuildInfo "Version is now auto-generated
Added GitVersion and BuildDate"
Loading

Flow diagram of the new build process

graph TD
    A[Start Build] --> B[Restore .NET Tools]
    B --> C[Run Cake Script]
    C --> D[Get Git Version Info]
    D --> E[Generate BuildInfo.g.cs]
    E --> F[Restore Dependencies]
    F --> G[Build Solution]
    G --> H[Output AquaMai.dll]
Loading

File-Level Changes

Change Details Files
Updated GitHub Actions workflow for AquaMai build process
  • Removed branch specification for push and pull_request_target events
  • Added fetch-depth option to actions/checkout
  • Changed build command from dotnet build to powershell ./build.ps1
  • Updated condition for Telegram notification to check for main branch
.github/workflows/aquamai.yaml
Simplified development instructions in README
  • Removed step to open AquaMai.sln in JetBrains Rider
  • Replaced build solution step with running build.ps1 script
README.md
Modified BuildInfo class structure and content
  • Changed BuildInfo class to partial
  • Removed Version constant
  • Added GitVersion and BuildDate constants
AquaMai/BuildInfo.cs
AquaMai.Core/BuildInfo.cs
Updated AssemblyInfo to use GitVersion
  • Replaced BuildInfo.Version with BuildInfo.GitVersion in MelonInfo attribute
AquaMai/Properties/AssemblyInfo.cs
Introduced Cake build script
  • Added build.cake script for build automation
  • Defined tasks for Restore, PreBuild, and Build
  • Generated BuildInfo.g.cs file with version and build date
build.cake
Added PowerShell script for build process
  • Created build.ps1 to execute Cake build script
build.ps1

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.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a 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. You can also use
    this command to specify where the summary should be inserted.

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.

@clansty - 我已经审查了你的更改,看起来很棒!

以下是我在审查期间查看的内容
  • 🟡 一般性问题:发现1个问题
  • 🟢 安全性:一切看起来都很好
  • 🟢 测试:一切看起来都很好
  • 🟢 复杂性:一切看起来都很好
  • 🟢 文档:一切看起来都很好

Sourcery 对开源项目是免费的 - 如果你喜欢我们的评论,请考虑分享它们 ✨
帮助我变得更有用!请在每条评论上点击 👍 或 👎,我将使用这些反馈来改进你的评论。
Original comment in English

Hey @clansty - I've reviewed your changes and they look great!

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.

Task("PreBuild")
.Does(() =>
{
var gitDescribe = GitDescribe(".", GitDescribeStrategy.Tags).Substring(1); // 获取 git describe 的输出
Copy link

Choose a reason for hiding this comment

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

问题: 为 git describe 返回没有标签的情况添加错误处理

Substring(1) 调用可能会在仓库没有标签或 git describe 返回空字符串时抛出异常。请考虑添加适当的错误处理。

Original comment in English

issue: Add error handling for the case where git describe returns no tags

The Substring(1) call could throw an exception if the repository has no tags or if git describe returns an empty string. Consider adding appropriate error handling.

@clansty
Copy link
Contributor Author

clansty commented Jan 20, 2025

在 tag 上 build 也测了

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.

1 participant