tests.yml 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. name: Automated tests
  2. on:
  3. push:
  4. branches: [ edge ]
  5. pull_request:
  6. branches: [ edge ]
  7. jobs:
  8. composer:
  9. # https://github.com/actions/virtual-environments
  10. runs-on: ubuntu-latest
  11. steps:
  12. - uses: actions/checkout@v2
  13. - name: Check PHP syntax
  14. run: find . -name '*.php' -print0 | xargs -0 -n1 -P4 php -l 1>/dev/null
  15. - name: Check PHTML syntax
  16. run: find . -name '*.phtml' -print0 | xargs -0 -n1 -P4 php -l 1>/dev/null
  17. - name: Check translations syntax
  18. run: cli/manipulate.translation.php -a format && git diff --exit-code
  19. - name: Use Composer cache
  20. id: composer-cache
  21. uses: actions/cache@v2
  22. with:
  23. path: vendor
  24. key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
  25. restore-keys: |
  26. ${{ runner.os }}-php-
  27. - run: composer install --prefer-dist --no-progress
  28. if: steps.composer-cache.outputs.cache-hit != 'true'
  29. - name: Run PHP tests
  30. run: composer run-script test
  31. npm:
  32. runs-on: ubuntu-latest
  33. steps:
  34. - uses: actions/checkout@v2
  35. - name: Uses Node.js
  36. uses: actions/setup-node@v2
  37. with:
  38. # https://nodejs.org/en/about/releases/
  39. node-version: '14'
  40. cache: 'npm'
  41. - run: npm install
  42. - name: Check JavaScript syntax
  43. run: npm run eslint
  44. - name: Check Markdown syntax
  45. run: npm run markdownlint
  46. - name: Check Right-to-left CSS
  47. run: npm run rtlcss && git diff --exit-code
  48. - name: Check CSS syntax
  49. run: npm run stylelint
  50. shell:
  51. runs-on: ubuntu-latest
  52. steps:
  53. - uses: actions/checkout@v2
  54. - name: Use shell cache
  55. id: shell-cache
  56. uses: actions/cache@v2
  57. with:
  58. path: bin
  59. key: ${{ runner.os }}-bin-shfmt@v3.4.0c-hadolint@v2.7.0
  60. - name: Add ./bin/ to $PATH
  61. run: mkdir -p bin/ && echo "${PWD}/bin" >> $GITHUB_PATH
  62. - name: Setup Go
  63. # Multiple Go versions are pre-installed but the default 1.15 is too old
  64. # https://github.com/actions/setup-go
  65. uses: actions/setup-go@v2
  66. with:
  67. go-version: '1.17'
  68. - name: Install shfmt
  69. if: steps.shell-cache.outputs.cache-hit != 'true'
  70. run: GOBIN=${PWD}/bin/ go install mvdan.cc/sh/v3/cmd/shfmt@v3.4.0
  71. - name: Check shell script syntax
  72. # shellcheck is pre-installed https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-README.md
  73. run: ./tests/shellchecks.sh
  74. - name: Install hadolint
  75. if: steps.shell-cache.outputs.cache-hit != 'true'
  76. run: curl -sL -o ./bin/hadolint "https://github.com/hadolint/hadolint/releases/download/v2.7.0/hadolint-$(uname -s)-$(uname -m)" && chmod 700 ./bin/hadolint
  77. - name: Check Dockerfile syntax
  78. run: find . -name 'Dockerfile*' -print0 | xargs -0 -n1 ./bin/hadolint --failure-threshold warning