|
| 1 | +name: PHP-CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ master ] |
| 6 | + pull_request: |
| 7 | + branches: [ master ] |
| 8 | + |
| 9 | +jobs: |
| 10 | + build: |
| 11 | + name: Test on php ${{ matrix.php}} and ${{ matrix.os }} OS |
| 12 | + runs-on: ${{ matrix.os }} |
| 13 | + timeout-minutes: 20 |
| 14 | + env: |
| 15 | + SWOFT_DEBUG: 0 |
| 16 | + strategy: |
| 17 | + fail-fast: true # dont fast fail |
| 18 | + matrix: |
| 19 | + php: [7.1, 7.2, 7.3, 7.4] |
| 20 | + os: [ubuntu-latest] # , macOS-latest, windows-latest |
| 21 | + |
| 22 | + steps: |
| 23 | + - uses: actions/checkout@v2 |
| 24 | + |
| 25 | + - name: Install swoole extensions |
| 26 | + timeout-minutes: 5 |
| 27 | + run: | |
| 28 | + sudo pecl install -f swoole-4.4.19 && php -m |
| 29 | + # echo 'no' | pecl install -f redis |
| 30 | + # sudo pecl update-channels && pecl install -f msgpack && pecl install -f igbinary && php -m |
| 31 | + |
| 32 | + - name: Validate composer.json and composer.lock |
| 33 | + run: composer validate |
| 34 | + |
| 35 | + - name: Cache Composer packages |
| 36 | + id: composer-cache |
| 37 | + uses: actions/cache@v2 |
| 38 | + with: |
| 39 | + path: vendor |
| 40 | + key: ${{ runner.os }}-node-${{ hashFiles('**/composer.lock') }} |
| 41 | + restore-keys: | |
| 42 | + ${{ runner.os }}-node- |
| 43 | +
|
| 44 | + - name: Install dependencies |
| 45 | + if: steps.composer-cache.outputs.cache-hit != 'true' |
| 46 | + run: composer install --prefer-dist --no-progress --no-suggest |
| 47 | + |
| 48 | + # Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit" |
| 49 | + # Docs: https://getcomposer.org/doc/articles/scripts.md |
| 50 | + |
| 51 | + - name: Run test suite |
| 52 | + run: composer test0 |
| 53 | + |
| 54 | + - name: Deploy release assets |
| 55 | + If: matrix.php == '7.3' && matrix.os == 'ubuntu-latest' # run once |
| 56 | + run: php -d phar.readonly=0 bin/swoftcli phar:pack -o=swoftcli.phar --no-progress |
| 57 | + uses: xresloader/upload-to-github-release@v1 |
| 58 | + with: |
| 59 | + # The files or file patterns to upload. You can upload multiple files by split them by semicolon. You can use the glob pattern to find the files. |
| 60 | + file: swoftcli.phar # default is |
| 61 | + # If you need to overwrite existing files, add overwrite: true to the with. |
| 62 | + overwrite: # optional, default is false |
| 63 | + # The resultant deployment is a draft Release that only repository collaborators can see. This gives you an opportunity to examine and edit the draft release. |
| 64 | + draft: false # optional, default is true |
| 65 | + # The resultant deployment is a Prerelease. This gives you an opportunity to examine and edit the prerelease. |
| 66 | + prerelease: false # optional, default is false |
| 67 | + # With tags: true, your Releases deployment will trigger if and only if the build is a tagged build. |
| 68 | + tags: true # optional, default is false |
| 69 | + # Only work on these branches(splited by semicolon), set to nothing to accept all branches. |
| 70 | + branches: master # optional, default is |
| 71 | + # With verbose: true, be verbose. |
| 72 | + verbose: # optional, default is false |
| 73 | + # Set custom tag name. |
| 74 | + tag_name: # optional, default is |
| 75 | + # If try to update latest release. |
| 76 | + update_latest_release: # optional, default is false |
0 commit comments