定制 tomzx/php-semver-checker-git 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

tomzx/php-semver-checker-git

Composer 安装命令:

composer require tomzx/php-semver-checker-git

包简介

PHP Semantic Versioning Checker for GIT

README 文档

README

License Latest Stable Version Latest Unstable Version Build Status Code Coverage Total Downloads

PHP Semantic Versioning Checker for git is a console/library which allows you to inspect a set of before and after source code using GIT.

The command line utility will use an existing git repository to compare to changesets using anything git checkout would accept (sha1, branch, tag). It will checkout in detached mode in order not to pollute your list of branches.

Note It is strongly suggested you do not run this directly on any repository you do not want to lose. Make a copy of it beforehand and run php-semver-checker-git on that copy instead.

Getting started

As this is still an alpha package, it is not suggested to include php-semver-checker-git directly in your composer.json. There are however a couple ways to use the tool:

  1. Preferred method Download the latest .phar build. Note that the .phar build is generally less bleeding edge than the following methods.
  2. php composer.phar create-project tomzx/php-semver-checker-git --stability=dev will clone to a new php-semver-checker-git folder in your current working directory
  3. git clone https://github.com/tomzx/php-semver-checker-git.git and php composer.phar install in the newly cloned directory.

See the example section for examples of how to use the tool.

Building php-semver-checker-git.phar

First, make sure you have box installed. Then, in the base directory, you can run the following command which will generate the php-semver-checker-git.phar file.

box build

Using php-semver-checker-git with GitHub actions

It is very easy to add php-semver-checker-git to your build process and to get a nice report you can check in the GitHub actions logs. In a file under .github/workflows/, add the following:

name: Continuous integration

on: [push]

jobs:
  build:
    runs-on: ubuntu-latest
    
    steps:
    - name: Checkout code
      uses: actions/checkout@v2
      with:
        fetch-depth: 0

    - name: Setup PHP
      uses: shivammathur/setup-php@v2
      with:
          php-version: ${{ matrix.php }}
          tools: composer:v2
          coverage: xdebug

    # Your own CI configuration goes here

    - name: Evaluate semantic versioning
      run: |
        wget https://psvcg.coreteks.org/php-semver-checker-git.phar
        php php-semver-checker-git.phar suggest -vvv --include-before=src --include-after=src --details --allow-detached

In order to simplify the above call to php-semver-checker-git, we suggest you create a php-semver-checker-git.yml configuration file at the root of your project. In it, you can put the following:

allow-detached: true
details: true
include-before: src
include-after: src

With this configuration file, you can update the configuration file created previously:

Before:

  # Your own CI configuration goes here

    - name: Evaluate semantic versioning
      run: |
        wget https://psvcg.coreteks.org/php-semver-checker-git.phar
        php php-semver-checker-git.phar suggest -vvv --include-before=src --include-after=src --details --allow-detached

After:

  # Your own CI configuration goes here

    - name: Evaluate semantic versioning
      run: |
        wget https://psvcg.coreteks.org/php-semver-checker-git.phar
        php php-semver-checker-git.phar suggest -vvv

Example

Compare two commits (without semantic versioning)

# arguments are: before-commit/branch/tag after-commit/branch/tag
php bin/php-semver-checker-git compare v1.6.4 v2.0.0 --include-before=src --include-after=src

Compare HEAD against your latest semantic version tag

php bin/php-semver-checker-git suggest --allow-detached --include-before=src --include-after=src

Note: --allow-detached is very useful when you are running this command on GitHub actions or any other continuous integration provider. It is necessary when a checkout is done on a particular commit, which makes HEAD become detached. If this option is not passed to the command, it will abort. This is done because it is impossible to revert the original detached branch when the suggest command completes.

Compare HEAD against a specific tag constraint

php bin/php-semver-checker-git suggest --allow-detached --include-before=src --include-after=src  --tag=~5.0

Note: --tag supports any semantic versioning constraint such as <, <=, >=, '>', ~x.y.z, ^x.y.z x.y.*.

License

The code is licensed under the MIT license. See LICENSE.

tomzx/php-semver-checker-git 适用场景与选型建议

tomzx/php-semver-checker-git 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 69 次下载、GitHub Stars 达 28, 最近一次更新时间为 2015 年 01 月 11 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「git」 「semver」 「semantic versioning」 「checker」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 tomzx/php-semver-checker-git 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 tomzx/php-semver-checker-git 我们能提供哪些服务?
定制开发 / 二次开发

基于 tomzx/php-semver-checker-git 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 69
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 28
  • 点击次数: 24
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 28
  • Watchers: 1
  • Forks: 5
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-01-11