Skip to content

Commit

Permalink
Merge pull request #606 from ulue/dev2
Browse files Browse the repository at this point in the history
  • Loading branch information
inhere authored May 7, 2021
2 parents 33b3a4e + 2a5774d commit 8b1a0b7
Show file tree
Hide file tree
Showing 183 changed files with 4,391 additions and 709 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,22 @@ jobs:
ports:
- 3306
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3
# https://docs.github.com/en/actions/guides/creating-redis-service-containers
redis:
image: redis
ports:
- 6379/tcp
- 16379:6379 # export 16379 the port
options: --health-cmd="redis-cli ping" --health-interval=10s --health-timeout=5s --health-retries=3
strategy:
fail-fast: true # fast fail
matrix:
php: [7.2, 7.3, 7.4]
php: [7.2, 7.3, 7.4, 8.0]
os: [ubuntu-latest] # , macOS-latest, windows-latest
swoole-versions: [''] # latest
include:
- os: 'ubuntu-latest'
php: '7.1'
swoole-versions: '-4.5.10'
swoole-versions: '-4.5.11'

steps:
- uses: actions/checkout@v2
Expand All @@ -54,7 +55,7 @@ jobs:

- name: Display swoole extensions
timeout-minutes: 1
run: php --ri swoole && php --re swoole | grep class
run: php --ri swoole
# sudo pecl install -f swoole
# echo 'no' | pecl install -f redis
# sudo pecl update-channels && pecl install -f msgpack && pecl install -f igbinary && php -m
Expand All @@ -67,4 +68,4 @@ jobs:

- name: Run test suite
run: | # && composer run test
pwd && ./phpunit.sh nodb
pwd && ./phpunit.sh nodb && ./phpunit.sh redis
62 changes: 62 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Tag-release

on:
push:
tags:
- v*

jobs:
release:
name: Test on php ${{ matrix.php}}
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
fail-fast: true
matrix:
php: [7.3]

steps:
- name: Checkout
uses: actions/checkout@v2

- 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
run: |
echo "RELEASE_TAG=${GITHUB_REF:10}" >> $GITHUB_ENV
echo "RELEASE_NAME=$GITHUB_WORKFLOW" >> $GITHUB_ENV
# usage refer https://github.com/shivammathur/setup-php
- name: Setup PHP
timeout-minutes: 5
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php}}
tools: pecl, php-cs-fixer, phpunit
extensions: mbstring, dom, fileinfo, mysql, 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 # eg: v1.0.3
run: |
tag1=${GITHUB_REF#refs/*/}
echo "release tag: ${tag1}"
composer install --no-progress --no-suggest
# Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit"
# Docs: https://getcomposer.org/doc/articles/scripts.md

# - name: Build phar and send to github assets
# run: |
# echo $RELEASE_TAG
# echo $RELEASE_NAME
# php -d phar.readonly=0 bin/kite phar:pack -o kite-${RELEASE_TAG}.phar --no-progress
# php kite-${RELEASE_TAG}.phar -V

# https://github.com/actions/create-release
- uses: meeDamian/[email protected]
with:
gzip: false
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ env.RELEASE_TAG }}
name: ${{ env.RELEASE_TAG }}
# files: kite-${{ env.RELEASE_TAG }}.phar
2 changes: 1 addition & 1 deletion .php_cs → .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
'void_return' => true, // add :void for method
];

return PhpCsFixer\Config::create()
return (new PhpCsFixer\Config())
->setRiskyAllowed(true)
->setRules($rules)
->setFinder(
Expand Down
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,14 @@ classdoc:
# gen docs
php sami.phar update ./script/sami.doc.inc

test-all: ## Run all unit tests
test-all:
./phpunit.sh all

test-nodb: ## Run unit tests without db tests
test-nodb:
./phpunit.sh nodb

all: ## Run update, addrmt, fpush and release
all: update addrmt fpush release

5 changes: 3 additions & 2 deletions README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export RUN_SERVER_TEST=ws,http,tcp; ./phpunit.sh websocket-server
### 自动发布

使用 Github PR 评论发布组件新版本。
[swoft/swoft-component][component][swoft/swoft-ext][ext] 下的PR评论即发布相应仓库的代码

评论格式:

Expand All @@ -105,10 +106,10 @@ export RUN_SERVER_TEST=ws,http,tcp; ./phpunit.sh websocket-server

```text
# 所有的组件
@swoftbot release v2.0.8 all
@swoftbot release v2.0.11 all
# 指定的组件
@swoftbot release v2.0.8 bean,event
@swoftbot release v2.0.11 bean,event
```

### 手动发布
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
"nikic/php-parser": "~4.2"
},
"require-dev": {
"phpunit/phpunit": "^7.5",
"phpunit/phpunit": "^7.5 || ^8.0",
"swoft/swoole-ide-helper": "dev-master"
},
"replace": {
Expand Down
54 changes: 54 additions & 0 deletions src/annotation/.github/workflows/php.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#
# Github actions for swoft component tests
# https://github.com/marketplace?type=actions
#
name: Unit-tests

on: [push, pull_request]

# usage refer https://github.com/shivammathur/setup-php
jobs:
test:
name: Test on php ${{ matrix.php}} and ${{ matrix.os }} OS
runs-on: ${{ matrix.os }}
timeout-minutes: 20
env:
SWOFT_DEBUG: 0
strategy:
fail-fast: true # fast fail
matrix:
php: [7.2, 7.3, 7.4, 8.0]
os: [ubuntu-latest] # , macOS-latest, windows-latest
swoole-versions: [''] # latest
include:
- os: 'ubuntu-latest'
php: '7.1'
swoole-versions: '-4.5.11'

steps:
- uses: actions/checkout@v2
# usage refer https://github.com/shivammathur/setup-php
- name: Setup PHP
timeout-minutes: 5
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php}}
extensions: mbstring, dom, fileinfo, mysql, openssl, redis, swoole${{ matrix.swoole-versions }} #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: Display swoole extensions
timeout-minutes: 1
run: php --ri swoole
# sudo pecl install -f swoole
# echo 'no' | pecl install -f redis
# sudo pecl update-channels && pecl install -f msgpack && pecl install -f igbinary && php -m

- name: Install dependencies
run: composer install --no-progress --no-suggest

# Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit"
# Docs: https://getcomposer.org/doc/articles/scripts.md

- name: Run test suite
run: composer run test
62 changes: 62 additions & 0 deletions src/annotation/.github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Tag-release

on:
push:
tags:
- v*

jobs:
release:
name: Test on php ${{ matrix.php}}
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
fail-fast: true
matrix:
php: [7.3]

steps:
- name: Checkout
uses: actions/checkout@v2

- 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
run: |
echo "RELEASE_TAG=${GITHUB_REF:10}" >> $GITHUB_ENV
echo "RELEASE_NAME=$GITHUB_WORKFLOW" >> $GITHUB_ENV
# usage refer https://github.com/shivammathur/setup-php
- name: Setup PHP
timeout-minutes: 5
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php}}
tools: pecl, php-cs-fixer, phpunit
extensions: mbstring, dom, fileinfo, mysql, 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 # eg: v1.0.3
run: |
tag1=${GITHUB_REF#refs/*/}
echo "release tag: ${tag1}"
composer install --no-progress --no-suggest
# Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit"
# Docs: https://getcomposer.org/doc/articles/scripts.md

# - name: Build phar and send to github assets
# run: |
# echo $RELEASE_TAG
# echo $RELEASE_NAME
# php -d phar.readonly=0 bin/kite phar:pack -o kite-${RELEASE_TAG}.phar --no-progress
# php kite-${RELEASE_TAG}.phar -V

# https://github.com/actions/create-release
- uses: meeDamian/[email protected]
with:
gzip: false
token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ env.RELEASE_TAG }}
name: ${{ env.RELEASE_TAG }}
# files: kite-${{ env.RELEASE_TAG }}.phar
4 changes: 2 additions & 2 deletions src/annotation/composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "swoft/annotation",
"type": "library",
"version": "v2.0.10",
"version": "v2.0.11",
"keywords": [
"php",
"swoole",
Expand All @@ -23,7 +23,7 @@
}
},
"require-dev": {
"phpunit/phpunit": "^7.5"
"phpunit/phpunit": "^7.5 || ^8.0"
},
"autoload-dev": {
"psr-4": {
Expand Down
54 changes: 54 additions & 0 deletions src/aop/.github/workflows/php.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
#
# Github actions for swoft component tests
# https://github.com/marketplace?type=actions
#
name: Unit-tests

on: [push, pull_request]

# usage refer https://github.com/shivammathur/setup-php
jobs:
test:
name: Test on php ${{ matrix.php}} and ${{ matrix.os }} OS
runs-on: ${{ matrix.os }}
timeout-minutes: 20
env:
SWOFT_DEBUG: 0
strategy:
fail-fast: true # fast fail
matrix:
php: [7.2, 7.3, 7.4, 8.0]
os: [ubuntu-latest] # , macOS-latest, windows-latest
swoole-versions: [''] # latest
include:
- os: 'ubuntu-latest'
php: '7.1'
swoole-versions: '-4.5.11'

steps:
- uses: actions/checkout@v2
# usage refer https://github.com/shivammathur/setup-php
- name: Setup PHP
timeout-minutes: 5
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php}}
extensions: mbstring, dom, fileinfo, mysql, openssl, redis, swoole${{ matrix.swoole-versions }} #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: Display swoole extensions
timeout-minutes: 1
run: php --ri swoole
# sudo pecl install -f swoole
# echo 'no' | pecl install -f redis
# sudo pecl update-channels && pecl install -f msgpack && pecl install -f igbinary && php -m

- name: Install dependencies
run: composer install --no-progress --no-suggest

# Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit"
# Docs: https://getcomposer.org/doc/articles/scripts.md

- name: Run test suite
run: composer run test
Loading

0 comments on commit 8b1a0b7

Please sign in to comment.