CI.yml 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  1. name: CI
  2. on: [push, pull_request]
  3. jobs:
  4. dotenv_lint:
  5. name: Dotenv Lint
  6. runs-on: ubuntu-latest
  7. steps:
  8. - name: Checkout
  9. uses: actions/checkout@v2
  10. - name: Run dotenv-linter
  11. uses: dotenv-linter/action-dotenv-linter@v2
  12. with:
  13. github_token: ${{ secrets.github_token }}
  14. dotenv_linter_flags: --skip UnorderedKey
  15. markdown_lint:
  16. name: Markdown Lint
  17. runs-on: ubuntu-latest
  18. steps:
  19. - name: Checkout
  20. uses: actions/checkout@v2
  21. - name: Run markdownlint
  22. uses: docker://avtodev/markdown-lint:v1
  23. with:
  24. args: './README.md'
  25. phpcs:
  26. name: PHPCS
  27. runs-on: ubuntu-latest
  28. container:
  29. image: baijunyao/php:8.0-local
  30. volumes:
  31. - /__w/laravel-bjyblog/laravel-bjyblog:/app
  32. steps:
  33. - name: Checkout
  34. uses: actions/checkout@v2
  35. - name: Get Composer Cache Directory
  36. id: composer-cache
  37. run: |
  38. echo "::set-output name=dir::$(composer config cache-files-dir)"
  39. - uses: actions/cache@v1
  40. with:
  41. path: ${{ steps.composer-cache.outputs.dir }}
  42. key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
  43. restore-keys: |
  44. ${{ runner.os }}-composer-
  45. - name: Initial
  46. run: |
  47. cp .env.actions .env
  48. composer install
  49. - name: PHP CS Fixer
  50. run: |
  51. ./vendor/bin/php-cs-fixer fix --verbose --show-progress=dots --dry-run --diff
  52. phpstan:
  53. name: PHPStan
  54. runs-on: ubuntu-latest
  55. container:
  56. image: baijunyao/php:8.0-local
  57. volumes:
  58. - /__w/laravel-bjyblog/laravel-bjyblog:/app
  59. steps:
  60. - name: Checkout
  61. uses: actions/checkout@v2
  62. - name: Get Composer Cache Directory
  63. id: composer-cache
  64. run: |
  65. echo "::set-output name=dir::$(composer config cache-files-dir)"
  66. - uses: actions/cache@v1
  67. with:
  68. path: ${{ steps.composer-cache.outputs.dir }}
  69. key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
  70. restore-keys: |
  71. ${{ runner.os }}-composer-
  72. - name: Initial
  73. run: |
  74. cp .env.actions .env
  75. composer install
  76. - name: PHPStan
  77. run: |
  78. ./vendor/bin/phpstan analyse --ansi
  79. helm_lint:
  80. name: Helm Lint
  81. runs-on: ubuntu-latest
  82. steps:
  83. - name: Checkout
  84. uses: actions/checkout@v2
  85. - name: Set up Helm
  86. uses: azure/setup-helm@v1
  87. - name: Run Helm lint
  88. run: |
  89. cd deploy/helm
  90. helm lint
  91. ansible_lint:
  92. name: Ansible Lint
  93. runs-on: ubuntu-latest
  94. steps:
  95. - name: Checkout
  96. uses: actions/checkout@v2
  97. - name: Run Ansible lint
  98. run: |
  99. pip3 install ansible
  100. pip3 install ansible-lint
  101. GITHUB_ACTIONS=true; ansible-lint -p deploy/ansible
  102. php_8_0_mysql_5_6:
  103. name: PHP8.0+MySQL5.6
  104. runs-on: ubuntu-latest
  105. services:
  106. mysql:
  107. image: mysql:5.6
  108. env:
  109. MYSQL_ROOT_PASSWORD: laravel_bjyblog
  110. MYSQL_DATABASE: laravel_bjyblog
  111. container:
  112. image: baijunyao/php:8.0-local
  113. volumes:
  114. - /__w/laravel-bjyblog/laravel-bjyblog:/app
  115. steps:
  116. - name: Checkout
  117. uses: actions/checkout@v2
  118. - name: Get Composer Cache Directory
  119. id: composer-cache
  120. run: |
  121. echo "::set-output name=dir::$(composer config cache-files-dir)"
  122. - uses: actions/cache@v1
  123. with:
  124. path: ${{ steps.composer-cache.outputs.dir }}
  125. key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
  126. restore-keys: |
  127. ${{ runner.os }}-composer-
  128. - name: Initial
  129. run: |
  130. cp .env.actions .env
  131. composer install
  132. php artisan key:generate
  133. php artisan passport:keys
  134. php artisan migrate
  135. php artisan db:seed
  136. php artisan storage:link --relative
  137. - name: Test
  138. run: |
  139. composer test
  140. php_8_0_mysql_5_7:
  141. name: PHP8.0+MySQL5.7
  142. runs-on: ubuntu-latest
  143. services:
  144. mysql:
  145. image: mysql:5.7
  146. env:
  147. MYSQL_ROOT_PASSWORD: laravel_bjyblog
  148. MYSQL_DATABASE: laravel_bjyblog
  149. container:
  150. image: baijunyao/php:8.0-local
  151. volumes:
  152. - /__w/laravel-bjyblog/laravel-bjyblog:/app
  153. steps:
  154. - name: Checkout
  155. uses: actions/checkout@v2
  156. - name: Get Composer Cache Directory
  157. id: composer-cache
  158. run: |
  159. echo "::set-output name=dir::$(composer config cache-files-dir)"
  160. - uses: actions/cache@v1
  161. with:
  162. path: ${{ steps.composer-cache.outputs.dir }}
  163. key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
  164. restore-keys: |
  165. ${{ runner.os }}-composer-
  166. - name: Initial
  167. run: |
  168. cp .env.actions .env
  169. composer install
  170. php artisan key:generate
  171. php artisan passport:keys
  172. php artisan migrate
  173. php artisan db:seed
  174. php artisan storage:link --relative
  175. - name: Test
  176. run: |
  177. composer test
  178. php_8_0_mysql_8_0:
  179. name: PHP8.0+MySQL8.0
  180. runs-on: ubuntu-latest
  181. services:
  182. mysql:
  183. image: baijunyao/mysql:8.0
  184. env:
  185. MYSQL_ROOT_PASSWORD: laravel_bjyblog
  186. MYSQL_DATABASE: laravel_bjyblog
  187. container:
  188. image: baijunyao/php:8.0-local
  189. volumes:
  190. - /__w/laravel-bjyblog/laravel-bjyblog:/app
  191. steps:
  192. - name: Checkout
  193. uses: actions/checkout@v2
  194. - name: Get Composer Cache Directory
  195. id: composer-cache
  196. run: |
  197. echo "::set-output name=dir::$(composer config cache-files-dir)"
  198. - uses: actions/cache@v1
  199. with:
  200. path: ${{ steps.composer-cache.outputs.dir }}
  201. key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
  202. restore-keys: |
  203. ${{ runner.os }}-composer-
  204. - name: Initial
  205. run: |
  206. cp .env.actions .env
  207. composer install
  208. php artisan key:generate
  209. php artisan passport:keys
  210. php artisan migrate
  211. php artisan db:seed
  212. php artisan storage:link --relative
  213. - name: Test
  214. run: |
  215. composer test:coverage-xml
  216. - name: Upload coverage to Codecov
  217. uses: codecov/codecov-action@v1
  218. with:
  219. files: storage/framework/testing/coverage.xml
  220. notify:
  221. name: Slack Notify
  222. runs-on: ubuntu-latest
  223. needs: [phpcs, phpstan, helm_lint, ansible_lint, php_8_0_mysql_5_6, php_8_0_mysql_5_7, php_8_0_mysql_8_0,]
  224. if: always()
  225. steps:
  226. - name: Slack Notify
  227. uses: baijunyao/action-slack-notify@v3.0.0
  228. if: ${{ github.event_name == 'push' }}
  229. with:
  230. slack_channel_id: CEWJP77BP
  231. slack_bot_token: ${{ secrets.SLACK_BOT_TOKEN }}
  232. github_context: ${{ toJson(github) }}