tests.yml 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. name: Automated tests
  2. on:
  3. push:
  4. branches: [ edge ]
  5. pull_request:
  6. branches: [ edge ]
  7. jobs:
  8. tests:
  9. # https://github.com/actions/virtual-environments
  10. runs-on: ubuntu-24.04
  11. steps:
  12. - name: Git checkout source code
  13. uses: actions/checkout@v6
  14. # Composer tests
  15. - name: Check PHP syntax
  16. run: composer run-script php-lint
  17. - name: Check PHTML syntax
  18. run: composer run-script phtml-lint
  19. - name: Check translations syntax
  20. run: composer run-script translations && git diff --exit-code
  21. - name: Use Composer cache
  22. id: composer-cache
  23. uses: actions/cache@v5
  24. with:
  25. path: vendor
  26. key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
  27. restore-keys: |
  28. ${{ runner.os }}-php-
  29. - name: Run Composer install
  30. run: composer install --prefer-dist --no-progress
  31. if: steps.composer-cache.outputs.cache-hit != 'true'
  32. - name: Run PHP unit tests
  33. run: composer run-script phpunit -- --no-progress
  34. - name: PHP_CodeSniffer
  35. run: composer run-script phpcs
  36. - name: PHPStan
  37. run: composer run-script phpstan -- --no-progress
  38. # - name: PHPStan Next
  39. # run: composer run-script phpstan-next -- --no-progress
  40. # NPM tests
  41. - name: Uses Node.js
  42. uses: actions/setup-node@v6
  43. with:
  44. # https://nodejs.org/en/about/previous-releases
  45. node-version: lts/*
  46. cache: npm
  47. - run: npm ci
  48. - name: Check JavaScript syntax
  49. run: npm run --silent eslint
  50. - name: Check Markdown syntax
  51. run: npm run --silent markdownlint
  52. - name: Check CSS syntax
  53. run: npm run --silent stylelint
  54. - name: Check Right-to-left CSS
  55. run: npm run --silent rtlcss && git diff --exit-code
  56. # Shell tests
  57. - name: Use shell cache
  58. id: shell-cache
  59. uses: actions/cache@v5
  60. with:
  61. path: bin
  62. key: ${{ runner.os }}-bin-shfmt@v3.8.0-hadolint@v2.12.0-typos@v1.29.9
  63. - name: Add ./bin/ to $PATH
  64. run: mkdir -p bin/ && echo "${PWD}/bin" >> $GITHUB_PATH
  65. - name: Install shfmt
  66. if: steps.shell-cache.outputs.cache-hit != 'true'
  67. run: GOBIN=${PWD}/bin/ go install mvdan.cc/sh/v3/cmd/shfmt@v3.8.0
  68. - name: Check shell script syntax
  69. # shellcheck is pre-installed https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2204-Readme.md
  70. run: ./tests/shellchecks.sh
  71. - name: Install hadolint
  72. if: steps.shell-cache.outputs.cache-hit != 'true'
  73. run: curl -sL -o ./bin/hadolint "https://github.com/hadolint/hadolint/releases/download/v2.12.0/hadolint-$(uname -s)-$(uname -m)" && chmod 700 ./bin/hadolint
  74. - name: Check Dockerfile syntax
  75. run: find . -name 'Dockerfile*' -print0 | xargs -0 -n1 ./bin/hadolint --failure-threshold warning
  76. - name: Install typos
  77. if: steps.shell-cache.outputs.cache-hit != 'true'
  78. run: |
  79. cd bin ;
  80. wget -q 'https://github.com/crate-ci/typos/releases/download/v1.29.9/typos-v1.29.9-x86_64-unknown-linux-musl.tar.gz' &&
  81. tar -xvf *.tar.gz './typos' &&
  82. chmod +x typos &&
  83. rm *.tar.gz ;
  84. cd ..
  85. - name: Check spelling
  86. run: bin/typos