ci-app.yml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391
  1. # name: Node CI for app development
  2. # on:
  3. # push:
  4. # branches-ignore:
  5. # - release/**
  6. # - rc/**
  7. # - chore/**
  8. # - support/prepare-v**
  9. # paths:
  10. # - .github/workflows/ci-app.yml
  11. # - .eslint*
  12. # - tsconfig.base.json
  13. # - yarn.lock
  14. # - packages/app/**
  15. # - '!packages/app/docker/**'
  16. # - packages/codemirror-textlint/**
  17. # - packages/core/**
  18. # - packages/remark-*/**
  19. # - packages/slack/**
  20. # - packages/ui/**
  21. # jobs:
  22. # lint:
  23. # runs-on: ubuntu-latest
  24. # strategy:
  25. # matrix:
  26. # node-version: [16.x]
  27. # steps:
  28. # - uses: actions/checkout@v3
  29. # - uses: actions/setup-node@v3
  30. # with:
  31. # node-version: ${{ matrix.node-version }}
  32. # cache: 'yarn'
  33. # cache-dependency-path: '**/yarn.lock'
  34. # - name: Cache/Restore node_modules
  35. # id: cache-dependencies
  36. # uses: actions/cache@v3
  37. # with:
  38. # path: |
  39. # **/node_modules
  40. # key: node_modules-${{ runner.OS }}-node${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('packages/app/package.json') }}
  41. # restore-keys: |
  42. # node_modules-${{ runner.OS }}-node${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}-
  43. # node_modules-${{ runner.OS }}-node${{ matrix.node-version }}-
  44. # - name: lerna bootstrap
  45. # run: |
  46. # npx lerna bootstrap -- --frozen-lockfile
  47. # - name: lerna run lint for dependent packages
  48. # run: |
  49. # yarn lerna run lint --scope @growi/codemirror-textlint --scope @growi/core --scope @growi/hackmd --scope @growi/preset-themes --scope @growi/remark-* --scope @growi/slack --scope @growi/ui
  50. # - name: build dependent packages
  51. # run: |
  52. # yarn lerna run build --scope @growi/preset-themes
  53. # - name: lerna run lint for app
  54. # run: |
  55. # yarn lerna run lint --scope @growi/app
  56. # - name: Slack Notification
  57. # uses: weseek/ghaction-slack-notification@master
  58. # if: failure()
  59. # with:
  60. # type: ${{ job.status }}
  61. # job_name: '*Node CI for growi - lint (${{ matrix.node-version }})*'
  62. # channel: '#ci'
  63. # isCompactMode: true
  64. # url: ${{ secrets.SLACK_WEBHOOK_URL }}
  65. # test:
  66. # runs-on: ubuntu-latest
  67. # strategy:
  68. # matrix:
  69. # node-version: [16.x]
  70. # services:
  71. # mongodb:
  72. # image: mongo:4.4
  73. # ports:
  74. # - 27017/tcp
  75. # steps:
  76. # - uses: actions/checkout@v3
  77. # - uses: actions/setup-node@v3
  78. # with:
  79. # node-version: ${{ matrix.node-version }}
  80. # cache: 'yarn'
  81. # cache-dependency-path: '**/yarn.lock'
  82. # - name: Cache/Restore node_modules
  83. # id: cache-dependencies
  84. # uses: actions/cache@v3
  85. # with:
  86. # path: |
  87. # **/node_modules
  88. # key: node_modules-${{ runner.OS }}-node${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('packages/app/package.json') }}
  89. # restore-keys: |
  90. # node_modules-${{ runner.OS }}-node${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}-
  91. # node_modules-${{ runner.OS }}-node${{ matrix.node-version }}-
  92. # - name: lerna bootstrap
  93. # run: |
  94. # npx lerna bootstrap -- --frozen-lockfile
  95. # - name: lerna run test for plugins
  96. # run: |
  97. # yarn lerna run test --scope @growi/remark-*
  98. # - name: Test app
  99. # working-directory: ./packages/app
  100. # run: |
  101. # yarn test:ci --selectProjects unit server ; yarn test:ci --selectProjects server-v5
  102. # env:
  103. # MONGO_URI: mongodb://localhost:${{ job.services.mongodb.ports['27017'] }}/growi_test
  104. # - name: Upload coverage report as artifact
  105. # uses: actions/upload-artifact@v3
  106. # with:
  107. # name: Coverage Report
  108. # path: |
  109. # packages/app/coverage
  110. # packages/remark-growi-plugin/coverage
  111. # - name: Slack Notification
  112. # uses: weseek/ghaction-slack-notification@master
  113. # if: failure()
  114. # with:
  115. # type: ${{ job.status }}
  116. # job_name: '*Node CI for growi - test (${{ matrix.node-version }})*'
  117. # channel: '#ci'
  118. # isCompactMode: true
  119. # url: ${{ secrets.SLACK_WEBHOOK_URL }}
  120. # launch-dev:
  121. # runs-on: ubuntu-latest
  122. # strategy:
  123. # matrix:
  124. # node-version: [16.x]
  125. # services:
  126. # mongodb:
  127. # image: mongo:4.4
  128. # ports:
  129. # - 27017/tcp
  130. # steps:
  131. # - uses: actions/checkout@v3
  132. # - uses: actions/setup-node@v3
  133. # with:
  134. # node-version: ${{ matrix.node-version }}
  135. # cache: 'yarn'
  136. # cache-dependency-path: '**/yarn.lock'
  137. # - name: Cache/Restore node_modules and next cache files
  138. # id: cache-dependencies
  139. # uses: actions/cache@v3
  140. # with:
  141. # path: |
  142. # **/node_modules
  143. # ${{ github.workspace }}/packages/app/.next/cache
  144. # key: dev-${{ runner.OS }}-node${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('packages/app/package.json') }}
  145. # restore-keys: |
  146. # dev-${{ runner.OS }}-node${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}-
  147. # dev-${{ runner.OS }}-node${{ matrix.node-version }}-
  148. # - name: lerna bootstrap
  149. # run: |
  150. # npx lerna bootstrap -- --frozen-lockfile
  151. # - name: yarn dev:ci
  152. # working-directory: ./packages/app
  153. # run: |
  154. # cp config/ci/.env.local.for-ci .env.development.local
  155. # yarn dev:ci
  156. # env:
  157. # MONGO_URI: mongodb://localhost:${{ job.services.mongodb.ports['27017'] }}/growi_dev
  158. # - name: Slack Notification
  159. # uses: weseek/ghaction-slack-notification@master
  160. # if: failure()
  161. # with:
  162. # type: ${{ job.status }}
  163. # job_name: '*Node CI for growi - launch-dev (${{ matrix.node-version }})*'
  164. # channel: '#ci'
  165. # isCompactMode: true
  166. # url: ${{ secrets.SLACK_WEBHOOK_URL }}
  167. =======
  168. name: Node CI for app development
  169. on:
  170. push:
  171. branches-ignore:
  172. - release/**
  173. - rc/**
  174. - chore/**
  175. - support/prepare-v**
  176. paths:
  177. - .github/workflows/ci-app.yml
  178. - .eslint*
  179. - tsconfig.base.json
  180. - yarn.lock
  181. - packages/app/**
  182. - '!packages/app/docker/**'
  183. - packages/codemirror-textlint/**
  184. - packages/core/**
  185. - packages/remark-*/**
  186. - packages/slack/**
  187. - packages/ui/**
  188. jobs:
  189. lint:
  190. runs-on: ubuntu-latest
  191. strategy:
  192. matrix:
  193. node-version: [16.x]
  194. steps:
  195. - uses: actions/checkout@v3
  196. - uses: actions/setup-node@v3
  197. with:
  198. node-version: ${{ matrix.node-version }}
  199. cache: 'yarn'
  200. cache-dependency-path: '**/yarn.lock'
  201. - name: Cache/Restore node_modules
  202. id: cache-dependencies
  203. uses: actions/cache@v3
  204. with:
  205. path: |
  206. **/node_modules
  207. key: node_modules-${{ runner.OS }}-node${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('packages/app/package.json') }}
  208. restore-keys: |
  209. node_modules-${{ runner.OS }}-node${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}-
  210. node_modules-${{ runner.OS }}-node${{ matrix.node-version }}-
  211. - name: lerna bootstrap
  212. run: |
  213. npx lerna bootstrap -- --frozen-lockfile
  214. - name: lerna run lint for dependent packages
  215. run: |
  216. yarn lerna run lint --scope @growi/codemirror-textlint --scope @growi/core --scope @growi/hackmd --scope @growi/preset-themes --scope @growi/remark-* --scope @growi/slack --scope @growi/ui
  217. - name: build dependent packages
  218. run: |
  219. yarn lerna run build --scope @growi/preset-themes
  220. - name: lerna run lint for app
  221. run: |
  222. yarn lerna run lint --scope @growi/app
  223. - name: Slack Notification
  224. uses: weseek/ghaction-slack-notification@master
  225. if: failure()
  226. with:
  227. type: ${{ job.status }}
  228. job_name: '*Node CI for growi - lint (${{ matrix.node-version }})*'
  229. channel: '#ci'
  230. isCompactMode: true
  231. url: ${{ secrets.SLACK_WEBHOOK_URL }}
  232. test:
  233. runs-on: ubuntu-latest
  234. strategy:
  235. matrix:
  236. node-version: [16.x]
  237. services:
  238. mongodb:
  239. image: mongo:4.4
  240. ports:
  241. - 27017/tcp
  242. steps:
  243. - uses: actions/checkout@v3
  244. - uses: actions/setup-node@v3
  245. with:
  246. node-version: ${{ matrix.node-version }}
  247. cache: 'yarn'
  248. cache-dependency-path: '**/yarn.lock'
  249. - name: Cache/Restore node_modules
  250. id: cache-dependencies
  251. uses: actions/cache@v3
  252. with:
  253. path: |
  254. **/node_modules
  255. key: node_modules-${{ runner.OS }}-node${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('packages/app/package.json') }}
  256. restore-keys: |
  257. node_modules-${{ runner.OS }}-node${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}-
  258. node_modules-${{ runner.OS }}-node${{ matrix.node-version }}-
  259. - name: lerna bootstrap
  260. run: |
  261. npx lerna bootstrap -- --frozen-lockfile
  262. - name: lerna run test for plugins
  263. run: |
  264. yarn lerna run test --scope @growi/remark-*
  265. - name: Test app
  266. working-directory: ./packages/app
  267. run: |
  268. yarn test:ci --selectProjects unit server ; yarn test:ci --selectProjects server-v5
  269. env:
  270. MONGO_URI: mongodb://localhost:${{ job.services.mongodb.ports['27017'] }}/growi_test
  271. - name: Upload coverage report as artifact
  272. uses: actions/upload-artifact@v3
  273. with:
  274. name: Coverage Report
  275. path: |
  276. packages/app/coverage
  277. packages/remark-growi-directive/coverage
  278. - name: Slack Notification
  279. uses: weseek/ghaction-slack-notification@master
  280. if: failure()
  281. with:
  282. type: ${{ job.status }}
  283. job_name: '*Node CI for growi - test (${{ matrix.node-version }})*'
  284. channel: '#ci'
  285. isCompactMode: true
  286. url: ${{ secrets.SLACK_WEBHOOK_URL }}
  287. launch-dev:
  288. runs-on: ubuntu-latest
  289. strategy:
  290. matrix:
  291. node-version: [16.x]
  292. services:
  293. mongodb:
  294. image: mongo:4.4
  295. ports:
  296. - 27017/tcp
  297. steps:
  298. - uses: actions/checkout@v3
  299. - uses: actions/setup-node@v3
  300. with:
  301. node-version: ${{ matrix.node-version }}
  302. cache: 'yarn'
  303. cache-dependency-path: '**/yarn.lock'
  304. - name: Cache/Restore node_modules and next cache files
  305. id: cache-dependencies
  306. uses: actions/cache@v3
  307. with:
  308. path: |
  309. **/node_modules
  310. ${{ github.workspace }}/packages/app/.next/cache
  311. key: dev-${{ runner.OS }}-node${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('packages/app/package.json') }}
  312. restore-keys: |
  313. dev-${{ runner.OS }}-node${{ matrix.node-version }}-${{ hashFiles('**/yarn.lock') }}-
  314. dev-${{ runner.OS }}-node${{ matrix.node-version }}-
  315. - name: lerna bootstrap
  316. run: |
  317. npx lerna bootstrap -- --frozen-lockfile
  318. - name: yarn dev:ci
  319. working-directory: ./packages/app
  320. run: |
  321. cp config/ci/.env.local.for-ci .env.development.local
  322. yarn dev:ci
  323. env:
  324. MONGO_URI: mongodb://localhost:${{ job.services.mongodb.ports['27017'] }}/growi_dev
  325. - name: Slack Notification
  326. uses: weseek/ghaction-slack-notification@master
  327. if: failure()
  328. with:
  329. type: ${{ job.status }}
  330. job_name: '*Node CI for growi - launch-dev (${{ matrix.node-version }})*'
  331. channel: '#ci'
  332. isCompactMode: true
  333. url: ${{ secrets.SLACK_WEBHOOK_URL }}