tests.yml 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. name: Tests
  2. on: [push]
  3. jobs:
  4. Composer:
  5. runs-on: ubuntu-latest
  6. steps:
  7. - name: Checkout
  8. uses: actions/checkout@v2
  9. - name: Validate composer.json and composer.lock
  10. run: composer validate
  11. - name: Install dependencies
  12. run: composer install --prefer-dist --no-dev
  13. PHPunit:
  14. runs-on: ubuntu-latest
  15. strategy:
  16. matrix:
  17. php-versions: ['5.6', '7.0', '7.1', '7.2', '7.3', '7.4']
  18. name: PHP ${{ matrix.php-versions }} unit tests on ${{ matrix.operating-system }}
  19. steps:
  20. - name: Checkout
  21. uses: actions/checkout@v2
  22. - name: Setup PHP
  23. uses: shivammathur/setup-php@v2
  24. with:
  25. php-version: ${{ matrix.php-versions }}
  26. extensions: gd, sqlite3
  27. # composer cache
  28. - name: Remove composer lock
  29. run: rm composer.lock
  30. - name: Get composer cache directory
  31. id: composer-cache
  32. run: echo "::set-output name=dir::$(composer config cache-files-dir)"
  33. # http://man7.org/linux/man-pages/man1/date.1.html
  34. # https://github.com/actions/cache#creating-a-cache-key
  35. - name: Get Date
  36. id: get-date
  37. run: |
  38. echo "::set-output name=date::$(/bin/date -u "+%Y%m%d")"
  39. shell: bash
  40. - name: Cache dependencies
  41. uses: actions/cache@v2
  42. with:
  43. path: ${{ steps.composer-cache.outputs.dir }}
  44. key: ${{ runner.os }}-composer-${{ steps.get-date.outputs.date }}-${{ hashFiles('**/composer.lock') }}
  45. restore-keys: ${{ runner.os }}-composer-
  46. # composer
  47. - name: Setup PHPunit
  48. run: composer install -n
  49. - name: Install Google Cloud Storage
  50. run: composer require google/cloud-storage
  51. # testing
  52. - name: Run unit tests
  53. run: ../vendor/bin/phpunit --no-coverage
  54. working-directory: tst
  55. Mocha:
  56. runs-on: ubuntu-latest
  57. steps:
  58. - name: Checkout
  59. uses: actions/checkout@v2
  60. - name: Setup Node
  61. uses: actions/setup-node@v1
  62. with:
  63. node-version: '12'
  64. - name: Setup Mocha
  65. run: npm install -g mocha
  66. - name: Setup Node modules
  67. run: npm install
  68. working-directory: js
  69. - name: Run unit tests
  70. run: mocha
  71. working-directory: js