phpunit.yml 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. name: PHPUnit
  2. # Controls when the workflow will run.
  3. # Run this workflow every time a new commit is pushed to your repository
  4. on: [push, pull_request]
  5. jobs:
  6. run-tests:
  7. # The type of runner that the job will run on
  8. runs-on: ubuntu-latest
  9. # Matrix Build for this job.
  10. strategy:
  11. matrix:
  12. php-versions: ['7.1', '7.2']
  13. # Name the matrix build so we can tell them apart.
  14. name: PHPUnit Testing (PHP ${{ matrix.php-versions }})
  15. # Service containers to run with `run-tests`
  16. services:
  17. # Label used to access the service container
  18. postgres:
  19. # Docker Hub image
  20. image: postgres
  21. env:
  22. POSTGRES_USER: tripaladmin
  23. POSTGRES_PASSWORD: somesupersecurepassword
  24. POSTGRES_DB: testdb
  25. # Set health checks to wait until postgres has started
  26. options: >-
  27. --health-cmd pg_isready
  28. --health-interval 10s
  29. --health-timeout 5s
  30. --health-retries 5
  31. ports:
  32. # Maps tcp port 5432 on service container to the host
  33. - 5432:5432
  34. steps:
  35. # Checkout the repository and setup workspace.
  36. - uses: actions/checkout@v2
  37. # Setup PHP according to the version passed in.
  38. - name: Setup PHP
  39. uses: shivammathur/setup-php@v2
  40. with:
  41. php-version: ${{ matrix.php-versions }}
  42. extensions: mbstring, intl, php-pgsql, php-gd, php-xml
  43. ini-values: memory_limit=2G
  44. coverage: xdebug
  45. tools: composer, phpunit
  46. # Install Drush/Drupal/Tripal
  47. - name: Setup Drush, Drupal 7.x, Tripal 3.x
  48. id: tripalsetup
  49. uses: tripal/setup-tripal-action@7.x-3.x-1.0
  50. with:
  51. postgres_user: tripaladmin
  52. postgres_pass: somesupersecurepassword
  53. postgres_db: testdb
  54. # Install Tripal Extension Module.
  55. - name: Install Tripal Extension Module
  56. id: installextension
  57. env:
  58. DRUSH: ${{ steps.tripalsetup.outputs.drush_path }}
  59. DRUPAL_ROOT: ${{ steps.tripalsetup.outputs.drupal_root }}
  60. run: |
  61. mkdir -p $DRUPAL_ROOT/sites/all/modules/tripal_jbrowse
  62. cp -R * $DRUPAL_ROOT/sites/all/modules/tripal_jbrowse
  63. cd $DRUPAL_ROOT
  64. $DRUSH en -y tripal_jbrowse_mgmt tripal_jbrowse_page
  65. # Runs the PHPUnit tests.
  66. # https://github.com/mheap/phpunit-github-actions-printer is used
  67. # to report PHPUnit fails in a meaningful way to github in PRs.
  68. - name: PHPUnit Tests
  69. env:
  70. DRUSH: ${{ steps.tripalsetup.outputs.drush_path }}
  71. DRUPAL_ROOT: ${{ steps.tripalsetup.outputs.drupal_root }}
  72. run: |
  73. cd $DRUPAL_ROOT/sites/all/modules/tripal_jbrowse
  74. composer require --dev mheap/phpunit-github-actions-printer --quiet
  75. composer update --quiet
  76. ./vendor/bin/phpunit --printer mheap\\GithubActionsReporter\\Printer