reusable-app-reg-suit.yml 2.8 KB

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