reusable-app-reg-suit.yml 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  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. cypress-report-artifact-name:
  12. required: true
  13. type: string
  14. secrets:
  15. REG_NOTIFY_GITHUB_PLUGIN_CLIENTID:
  16. required: true
  17. AWS_ACCESS_KEY_ID:
  18. required: true
  19. AWS_SECRET_ACCESS_KEY:
  20. required: true
  21. SLACK_WEBHOOK_URL:
  22. required: true
  23. outputs:
  24. EXPECTED_IMAGES_EXIST:
  25. value: ${{ jobs.run-reg-suit.outputs.EXPECTED_IMAGES_EXIST }}
  26. jobs:
  27. run-reg-suit:
  28. # use secrets for "VRT" environment
  29. # https://github.com/weseek/growi/settings/environments/376165508/edit
  30. environment: VRT
  31. env:
  32. REG_NOTIFY_GITHUB_PLUGIN_CLIENTID: ${{ secrets.REG_NOTIFY_GITHUB_PLUGIN_CLIENTID }}
  33. AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
  34. AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
  35. SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
  36. runs-on: ubuntu-latest
  37. outputs:
  38. EXPECTED_IMAGES_EXIST: ${{ steps.check-expected-images.outputs.EXPECTED_IMAGES_EXIST }}
  39. steps:
  40. - uses: actions/checkout@v2
  41. with:
  42. ref: ${{ inputs.checkout-ref }}
  43. fetch-depth: 0
  44. - uses: actions/setup-node@v2
  45. with:
  46. node-version: ${{ inputs.node-version }}
  47. cache: 'yarn'
  48. cache-dependency-path: '**/yarn.lock'
  49. - name: Cache/Restore node_modules
  50. uses: actions/cache@v2
  51. with:
  52. path: |
  53. **/node_modules
  54. key: node_modules-${{ runner.OS }}-node${{ inputs.node-version }}-${{ hashFiles('**/yarn.lock') }}
  55. restore-keys: |
  56. node_modules-${{ runner.OS }}-node${{ inputs.node-version }}-
  57. - name: lerna bootstrap
  58. run: |
  59. npx lerna bootstrap -- --frozen-lockfile
  60. - name: Run reg-suit sync-expected
  61. if: ${{ inputs.run-sync-expected }}
  62. working-directory: ./packages/app
  63. run: |
  64. yarn reg-suit sync-expected
  65. - name: Check expected images exist
  66. if: ${{ inputs.run-sync-expected }}
  67. id: check-expected-images
  68. run: |
  69. echo "::set-output name=EXPECTED_IMAGES_EXIST::`if [ -d .reg/expected/screenshots ]; then echo true; fi`"
  70. - name: Download screenshots taken by cypress
  71. if: ${{ inputs.run-compare }}
  72. uses: actions/download-artifact@v2
  73. with:
  74. name: ${{ inputs.cypress-report-artifact-name }}
  75. path: packages/app/test/cypress
  76. - name: Run reg-suit compare
  77. if: ${{ inputs.run-compare }}
  78. working-directory: ./packages/app
  79. run: |
  80. yarn reg-suit compare
  81. - name: Run reg-suit publish
  82. if: ${{ inputs.run-publish }}
  83. working-directory: ./packages/app
  84. run: |
  85. yarn reg-suit publish -n
  86. - name: Slack Notification
  87. uses: weseek/ghaction-slack-notification@master
  88. if: failure()
  89. with:
  90. type: ${{ job.status }}
  91. job_name: '*Node CI for growi - run-reg-suit (${{ inputs.node-version }})*'
  92. channel: '#ci'
  93. isCompactMode: true
  94. url: ${{ secrets.SLACK_WEBHOOK_URL }}