reusable-app-reg-suit.yml 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  1. name: Reusable build app workflow for production
  2. on:
  3. workflow_call:
  4. inputs:
  5. node-version:
  6. required: true
  7. type: string
  8. checkout-ref:
  9. type: string
  10. default: ${{ github.head_ref }}
  11. skip-reg-suit:
  12. type: boolean
  13. cypress-report-artifact-name:
  14. required: true
  15. type: string
  16. secrets:
  17. REG_NOTIFY_GITHUB_PLUGIN_CLIENTID:
  18. required: true
  19. AWS_ACCESS_KEY_ID:
  20. required: true
  21. AWS_SECRET_ACCESS_KEY:
  22. required: true
  23. SLACK_WEBHOOK_URL:
  24. required: true
  25. outputs:
  26. EXPECTED_IMAGES_EXIST:
  27. value: ${{ jobs.run-reg-suit.outputs.EXPECTED_IMAGES_EXIST }}
  28. jobs:
  29. run-reg-suit:
  30. # use secrets for "VRT" environment
  31. # https://github.com/weseek/growi/settings/environments/376165508/edit
  32. environment: VRT
  33. if: ${{ !inputs.skip-reg-suit }}
  34. env:
  35. REG_NOTIFY_GITHUB_PLUGIN_CLIENTID: ${{ secrets.REG_NOTIFY_GITHUB_PLUGIN_CLIENTID }}
  36. AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
  37. AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
  38. SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
  39. runs-on: ubuntu-latest
  40. outputs:
  41. EXPECTED_IMAGES_EXIST: ${{ steps.check-expected-images.outputs.EXPECTED_IMAGES_EXIST }}
  42. steps:
  43. - uses: actions/checkout@v3
  44. with:
  45. ref: ${{ inputs.checkout-ref }}
  46. fetch-depth: 0
  47. - uses: actions/setup-node@v3
  48. with:
  49. node-version: ${{ inputs.node-version }}
  50. cache: 'yarn'
  51. cache-dependency-path: '**/yarn.lock'
  52. - name: Install turbo
  53. run: |
  54. yarn global add turbo
  55. - name: Prune repositories
  56. run: |
  57. turbo prune --scope=@growi/app
  58. rm -rf apps packages
  59. mv out/* .
  60. - name: Cache/Restore node_modules
  61. id: cache-dependencies
  62. uses: actions/cache@v3
  63. with:
  64. path: |
  65. **/node_modules
  66. key: node_modules-${{ runner.OS }}-node${{ inputs.node-version }}-${{ hashFiles('**/yarn.lock') }}
  67. restore-keys: |
  68. node_modules-${{ runner.OS }}-node${{ inputs.node-version }}-
  69. - name: Install dependencies
  70. run: |
  71. yarn global add node-gyp
  72. yarn --frozen-lockfile
  73. - name: Download screenshots taken by cypress
  74. uses: actions/download-artifact@v3
  75. with:
  76. name: ${{ inputs.cypress-report-artifact-name }}
  77. path: apps/app/test/cypress
  78. - name: Run reg-suit
  79. working-directory: ./apps/app
  80. run: |
  81. yarn reg:run
  82. - name: Slack Notification
  83. uses: weseek/ghaction-slack-notification@master
  84. if: failure()
  85. with:
  86. type: ${{ job.status }}
  87. job_name: '*Node CI for growi - run-reg-suit (${{ inputs.node-version }})*'
  88. channel: '#ci'
  89. isCompactMode: true
  90. url: ${{ secrets.SLACK_WEBHOOK_URL }}