php.yml 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. name: PHP
  2. on: ["push", "pull_request", "workflow_dispatch"]
  3. jobs:
  4. build_and_test:
  5. name: Build and test web3.php with ${{ matrix.php-version }}
  6. strategy:
  7. matrix:
  8. php-version: ["7.3", "7.4", "8.0"]
  9. runs-on: ubuntu-latest
  10. steps:
  11. - name: Setup PHP
  12. uses: shivammathur/setup-php@v2
  13. with:
  14. php-version: ${{ matrix.php-version }}
  15. - name: PHP version
  16. run: |
  17. php --version
  18. - name: Install nodejs and ganache-cli
  19. run: |
  20. sudo apt-get update -y
  21. sudo apt-get install -y nodejs
  22. sudo npm install -g ganache-cli
  23. - uses: actions/checkout@v2
  24. - name: Validate composer.json and composer.lock
  25. run: composer validate
  26. - name: Cache Composer packages
  27. id: composer-cache
  28. uses: actions/cache@v2
  29. with:
  30. path: vendor
  31. key: ${{ runner.os }}-php-${{ matrix.php-version }}-${{ hashFiles('**/composer.lock') }}
  32. restore-keys: |
  33. ${{ runner.os }}-php-${{ matrix.php-version }}-
  34. - name: Install dependencies
  35. if: steps.composer-cache.outputs.cache-hit != 'true'
  36. run: composer install --prefer-dist --no-progress --no-suggest
  37. - name: Run test suite
  38. run: sudo scripts/test.sh