diff --git a/.github/changelog.yml b/.github/changelog.yml new file mode 100644 index 0000000..06048e3 --- /dev/null +++ b/.github/changelog.yml @@ -0,0 +1,36 @@ +title: '## Change Log' +# style allow: simple, markdown(mkdown), ghr(gh-release) +style: gh-release +# group names +names: [Refactor, Fixed, Feature, Update, Other] +#repo_url: https://github.com/gookit/gcli + +filters: + # message length should >= 12 + - name: msg_len + min_len: 12 + # message words should >= 3 + - name: words_len + min_len: 3 + - name: keyword + keyword: format code + exclude: true + - name: keywords + keywords: format code, action test + exclude: true + +# group match rules +# not matched will use 'Other' group. +rules: + - name: Refactor + start_withs: [refactor, break] + contains: ['refactor:', 'break:'] + - name: Fixed + start_withs: [fix] + contains: ['fix:'] + - name: Feature + start_withs: [feat, new] + contains: ['feat:', 'new:'] + - name: Update + start_withs: [up] + contains: ['update:', 'up:'] diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 438cb6f..fc10f0b 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,5 +1,11 @@ version: 2 updates: + - package-ecosystem: composer + directory: "/" + schedule: + interval: daily + open-pull-requests-limit: 10 + - package-ecosystem: "github-actions" directory: "/" schedule: diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index de24d03..38c2331 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -1,5 +1,6 @@ -name: Unit-tests +name: Unit-Tests +# https://docs.github.com/cn/actions/reference/workflow-syntax-for-github-actions on: push: paths: @@ -15,9 +16,9 @@ jobs: strategy: fail-fast: true matrix: - php: [8.0, 8.1] -# os: [ubuntu-latest, macOS-latest] # windows-latest, -# include: + php: [8.0, 8.1] # 7.2, 7.3, +# os: [ubuntu-latest] # macOS-latest, windows-latest, +# include: # will not testing on php 7.2 # - os: 'ubuntu-latest' # php: '7.2' # phpunit: '8.5.13' @@ -26,23 +27,30 @@ jobs: - name: Checkout uses: actions/checkout@v3 + - name: Set ENV vars + # https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable + run: | + echo "RELEASE_TAG=${GITHUB_REF:10}" >> $GITHUB_ENV + echo "RELEASE_NAME=$GITHUB_WORKFLOW" >> $GITHUB_ENV + + - name: Display Env + run: env + # usage refer https://github.com/shivammathur/setup-php - name: Setup PHP - timeout-minutes: 10 + timeout-minutes: 5 uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php}} tools: pecl, php-cs-fixer, phpunit:${{ matrix.phpunit }} - extensions: mbstring, dom, fileinfo, mysql, openssl, igbinary, redis, swoole-4.6.7 # , swoole-4.4.19 #optional, setup extensions + extensions: mbstring, dom, fileinfo, openssl # , swoole-4.4.19 #optional, setup extensions ini-values: post_max_size=56M, short_open_tag=On #optional, setup php.ini configuration coverage: none #optional, setup coverage driver: xdebug, none - - name: Install dependencies - run: | - composer install --no-progress - # Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit" # Docs: https://getcomposer.org/doc/articles/scripts.md + - name: Install dependencies + run: composer update --no-progress - name: Run test suite run: phpunit --debug diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 19eaeec..7b4db6f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,17 +7,15 @@ on: jobs: release: - name: Test on php ${{ matrix.php}} + name: Tag release runs-on: ubuntu-latest - timeout-minutes: 5 - strategy: - fail-fast: true - matrix: - php: [8.0] + timeout-minutes: 10 steps: - name: Checkout uses: actions/checkout@v3 + with: + fetch-depth: 0 - name: Set ENV for github-release # https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#setting-an-environment-variable @@ -25,13 +23,11 @@ jobs: echo "RELEASE_TAG=${GITHUB_REF:10}" >> $GITHUB_ENV echo "RELEASE_NAME=$GITHUB_WORKFLOW" >> $GITHUB_ENV - # more see https://github.com/inhere/kite - - name: Generate changelog file - id: changelog + - name: Generate changelog run: | - wget -c -q https://github.com/inhere/kite/releases/latest/download/kite.phar - php kite.phar git cl prev last --style gh-release --no-merges --fetch-tags --unshallow --file changelog.md - cat changelog.md + curl https://github.com/gookit/gitw/releases/latest/download/chlog-linux-amd64 -L -o /usr/local/bin/chlog + chmod a+x /usr/local/bin/chlog + chlog -c .github/changelog.yml -o changelog.md prev last # https://github.com/softprops/action-gh-release - name: Create release and upload assets @@ -41,4 +37,4 @@ jobs: tag_name: ${{ env.RELEASE_TAG }} body_path: changelog.md env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file