Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Github、BehatやContinuous Integrationを含めてPull RequestのWordPressの開発ワークフロー

Db74875191d80e48eb75b29c54e4cd13?s=47 Scott
September 16, 2017

Github、BehatやContinuous Integrationを含めてPull RequestのWordPressの開発ワークフロー

2107 WordCamp 東京

Db74875191d80e48eb75b29c54e4cd13?s=128

Scott

September 16, 2017
Tweet

Transcript

  1. GITHUB, BEHAT, CIΛؚΊͯ ϫʔυϓϨεͷ։ൃϫʔΫϑϩʔ ॳ৺ऀͷPRϫʔΫϑϩʔ΁ͷཱྀ

  2. ϚοηΠείοτ 15೥ؒɿσϕϩούʔɺDevOpsɺͳͲ ෭ࣾ௕ɺΧελϚʔαΫηε

  3. PRϫʔΫϑϩʔ΁ͷཱྀ ./wp-cli

  4. GIT VS FTP git ftp ίʔυΛม͑Δ ॴʑʹҠಈ มߋͷه࿥ มߋͷϩʔϧόοΫ τϦΨʔ

    νʔϜͱ؆୯ͳγϯΫϩ ϒϥϯνͰมߋͰ͖Δ
  5. GITΛ࢖͋͏͜ͱ ˎˎʢ࢖͍ํͷϦϯΫΛϓϨθϯʹఴ෇͏͢Δʣ εςοϓ̍ͷ໨ඪ

  6. COMPOSER ຊ൪ ϩʔΧϧ

  7. COMPOSER ‣ ϓϥάΠϯͷόʔδϣϯɺ৘ใ͸؅ཧ͕Ͱ͖Δ ‣ ϓϥάΠϯ͸ΠϯετʔϧɺΞοϓσʔτ͕Ͱ͖Δ

  8. εςοϓ̎ͷ໨ඪ ˎˎʢ࢖͍ํͷϦϯΫΛϓϨθϯʹఴ෇͏͢Δʣ ίϯϙʔβʔΛ࢖͏͜ͱ

  9. WP-CLI # ϓϥάΠϯΛ༗ޮԽ͢Δ
 $ wp plugin activate wp-cfm # ϙετΛ࡟আ͢Δ


    $ wp post delete 123 # ϩʔϧΛදࣔ
 $ wp role list
 administrator ./wp-cli
  10. εΫϦϓτ΋࡞ΕΔ #URLͷஔ׵ͱݕࡧ
 #!/bin/bash 
 wp search-replace ‘http://live.example.com' ‘http://test.example.com' ./wp-cli

  11. εςοϓ̏ͷ໨ඪ ˎˎʢ࢖͍ํͷϦϯΫΛϓϨθϯʹఴ෇͏͢Δʣ WP-CLIΛ࢖͏͜ͱ

  12. WP-CFMϓϥάΠϯ ϓϥάΠϯɺςʔϚͷઃఆͳͲΛΤΫεϙʔτɺΠϯϙʔτ Ͱ͖·͢ $ wp config push plugin-settings-yoast gitͰDEV͔ΒLIVE·ͰҠಈͯ͠
 $

    wp config pull plugin-settings-yoast
  13. εςοϓ̐ͷ໨ඪ ˎˎʢ࢖͍ํͷϦϯΫΛϓϨθϯʹఴ෇͏͢Δʣ WP-CFMΛ࢖ͬͯઃఆΛҠಈ͢Δ͜ͱ

  14. ࣗಈͷςετ ‣ PHPͷϑΝϯΫγϣϯ΍Ϋϥε͕ςετͰ͖Δ΋ͷ ‣ αΠτͷػೳ͕ςετͰ͖Δ΋ͷɻ

  15. BDD W/BEHAT Behavior Driven Development (ސ٬ͷཁٻ࢓༷ʹج͍ͮͨςετ)

  16. Scenario: As a user with the editor role I can

    publish blog posts Given I am logged in as "editor-qa"
 When I follow "Posts"
 And I follow "Add New"
 And I press "Text"
 And I fill in "post_title" with “͜Μʹͪ͸ʂ"
 And I press "Publish"
 Then I should see "Post published" BDDͷςετʢྫʣ
  17. ؆୯ͳςετΛ࢖͍ॳΊΔ͜ͱ εςοϓ̑ͷ໨ඪ

  18. ΠϯςάϨʔγϣ ϯ ͷαʔϏε ‣ ໨త஍ʂ ‣ σϞϯετϨʔγϣϯʂ

  19. σϞϯετϨʔγϣϯ λΠϜ

  20. ͋Γ͕ͱ͏͍͟͝·ͨ͠ʂ ‣ τϥΠ͍ͨ͠ํ͸ͪ͜Β ‣ scott@astrocolossal.com ‣ github/twitter: sukottokun

  21. ϦϯΫ ➤ ൃදͨ͠ྫΛશମͰؾʹߏஙɿhttps://github.com/pantheon-systems/example-wordpress-composer ➤ GIT: ʢӳޠ͚ͩͲɺ͓͢͢Ίʣhttps://www.codeschool.com/courses/try-git ➤ GIT: http://rogerdudler.github.io/git-guide/index.ja.html ➤

    ίϯϙʔβʔͱWP: http://qiita.com/atomita/items/37825ea00ef41ff6c884 ➤ WPϓϥάΠϯͷϨϙδτϦɿhttps://wpackagist.org/ ➤ ίϯϙʔβʔʢӳޠʣhttps://pantheon.io/docs/composer/ ➤ Behat: https://firegoby.jp/archives/6871 ➤ WPCFMʢӳޠʣ: https://wordpress.org/plugins/wp-cfm/ ➤ WPCFMʢӳޠʣ: https://pantheon.io/docs/wp-cfm/ ➤ σϞϯετϨʔγϣϯͷಈըɿhttps://youtu.be/PZbriZ0H0pk