test-ci.yml 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. name: PHP CI with Composer
  2. on: [push, pull_request]
  3. concurrency: keep-only-one
  4. jobs:
  5. build:
  6. strategy:
  7. fail-fast: false
  8. max-parallel: 1
  9. matrix:
  10. php-versions: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2']
  11. runs-on: ubuntu-latest
  12. steps:
  13. - name: Checkout
  14. uses: actions/checkout@v2
  15. - name: Setup php for mock server
  16. uses: shivammathur/setup-php@v2
  17. with:
  18. php-version: '8.2'
  19. - name: Setup build-in server
  20. run: |
  21. nohup php -S localhost:9000 -t ./tests/mock-server/ > phpd.log 2>&1 &
  22. echo $! > mock-server.pid
  23. - name: Setup php
  24. uses: shivammathur/setup-php@v2
  25. with:
  26. php-version: ${{ matrix.php-versions }}
  27. - name: Install dependencies
  28. run: |
  29. composer self-update
  30. composer install --no-interaction --prefer-source --dev
  31. - name: Run cases
  32. run: |
  33. ./vendor/bin/phpcs --standard=PSR2 src
  34. ./vendor/bin/phpcs --standard=PSR2 examples
  35. ./vendor/bin/phpcs --standard=PSR2 tests
  36. ./vendor/bin/phpunit --coverage-clover=coverage.xml
  37. cat mock-server.pid | xargs kill
  38. env:
  39. QINIU_ACCESS_KEY: ${{ secrets.QINIU_ACCESS_KEY }}
  40. QINIU_SECRET_KEY: ${{ secrets.QINIU_SECRET_KEY }}
  41. QINIU_TEST_BUCKET: ${{ secrets.QINIU_TEST_BUCKET }}
  42. QINIU_TEST_DOMAIN: ${{ secrets.QINIU_TEST_DOMAIN }}
  43. - name: Print mock servion log
  44. if: ${{ failure() }}
  45. run: |
  46. cat phpd.log
  47. - name: After_success
  48. run: bash <(curl -s https://codecov.io/bash)