reusable-app-reg-suit.yml 2.8 KB

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