tests.yml 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. name: PHP Tests
  2. on:
  3. push:
  4. branches: [ develop ]
  5. pull_request:
  6. branches: [ develop ]
  7. jobs:
  8. test:
  9. runs-on: ${{ matrix.os }}
  10. strategy:
  11. matrix:
  12. php: [ 7.4, 7.3, 7.2 ]
  13. os: [ubuntu-latest]
  14. steps:
  15. - uses: actions/checkout@v2
  16. - name: Setup PHP
  17. uses: shivammathur/setup-php@v2
  18. with:
  19. php-version: ${{ matrix.php }}
  20. extensions: opcache, gd
  21. coverage: none
  22. - name: Validate composer.json and composer.lock
  23. run: composer validate
  24. - name: Get composer cache directory
  25. id: composer-cache
  26. run: echo "::set-output name=dir::$(composer config cache-files-dir)"
  27. - name: Cache dependencies
  28. uses: actions/cache@v2
  29. with:
  30. path: ${{ steps.composer-cache.outputs.dir }}
  31. key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
  32. restore-keys: ${{ runner.os }}-composer-
  33. - name: Install dependencies
  34. run: composer install --prefer-dist --no-progress
  35. - name: Run test suite
  36. run: vendor/bin/codecept run
  37. - name: Slack Notification
  38. uses: 8398a7/action-slack@v3
  39. with:
  40. status: custom
  41. fields: workflow,job,commit,repo,ref,author,took
  42. custom_payload: |
  43. {
  44. username: 'action-slack',
  45. icon_emoji: ':octocat:',
  46. attachments: [{
  47. color: '${{ job.status }}' === 'success' ? 'good' : '${{ job.status }}' === 'failure' ? 'danger' : 'warning',
  48. text: `${process.env.AS_WORKFLOW}\n${process.env.AS_JOB} (${process.env.AS_COMMIT}) of ${process.env.AS_REPO}@${process.env.AS_REF} by ${process.env.AS_AUTHOR} succeeded in ${process.env.AS_TOOK}`,
  49. }]
  50. }
  51. env:
  52. SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} # required
  53. if: always() # Pick up events even if the job fails or is canceled.