設定だけでCircleCIの実行時間を短縮できるかもしれない話

 設定だけでCircleCIの実行時間を短縮できるかもしれない話

設定だけでCircleCIの実行時間を短縮できるかもしれない話

書き起こし
https://github.com/operando/Notes/tree/master/note_%E7%A4%BE%E5%86%85LT_2020-06-26

E77b6a5f919f7366d94f21eee9a014f5?s=128

operandoOS

June 26, 2020
Tweet

Transcript

  1. ઃఆ͚ͩͰ
 CircleCIͷ࣮ߦ࣌ؒΛ
 ୹ॖͰ͖Δ͔΋͠Εͳ͍ ࿩ note ࣾ಺LT

  2. CIճͯ͠·͔͢ʁ

  3. CircleCIͷϓϥϯ • PerformanceϓϥϯͰ͢ • ͬ͘͟Γ͍͏ͱैྔ՝ۚϞσϧ • https://circleci.com/ja/pricing/

  4. ࡉ͔͍͜ͱ͸ ؾʹ͠ͳ͍Ͱ͍ͩ͘͞

  5. ઃఆ͚ͩͰCircleCIͷ࣮ߦ࣌ؒΛ ୹ॖͤ͞Δखஈ • resource_class • cache • parallelism • Workflow

    • DLC
  6. • resource_class • cache • parallelism • Workflow • DLC

    noteͰ͸ͦΕͧΕΛ͏·͘׆༻͍ͯ͠·͢
  7. ঺հ͢Δͷ͸جຊతʹ config.ymlΛ
 มߋ͢Δ͚ͩͰ࢖͑·͢

  8. cache • ੒Ռ෺Λcacheͯ͠ɺ࣍ͷϏϧυʹ΋׆༻͢Δతͳ͋Ε • มߋ͕ͳ͚Ε͹ಉ݁͡Ռ͕ಘΒΕΔ৔໘Ͱ׆༻Ͱ͖·͢ • ґଘؔ܎ͷϥΠϒϥϦΩϟογϡͱ͔·͞ʹͦΕ • yarnͱ͔Bundlerͱ͔ͦ͏Ͱ͢Ͷ

  9. resource_class • CIΛ࣮ߦ͢ΔϚγϯͷύϫʔΛઃఆ͢Δ΋ͷ • σϑΥϧτ mediumʢCPU 2 ϝϞϦ 4Gʣ •

    Ϛγϯύϫʔ্͛ΔͱϏϧυͱ͔ૣ͘ͳΔ؀ڥͰ͸͔ͳΓ ໾ཱͭ • AndroidͰ͸ xlargeʢCPU 8 ϝϞϦ 16Gʣ࢖༻ • job͝ͱʹࢦఆͰ͖·͢
  10. resource_class • Ϛγϯύϫʔ্͕ΔͷͰɺͦͷ෼ैྔ՝ۚͷ ͓஋ஈ΋্͕Γ·͢ • ૿͠૿͠ʹͯ͠΋CPUͱϝϞϦΛ׆༻͖͠Ε ͳ͍৔߹ʹ͸ෆ޲͖

  11. resource_class https://circleci.com/docs/ja/2.0/ configuration-reference/#resource_class

  12. parallelism • jobͷ࣮ߦΛෳ਺ͷϚγϯͰ
 ࣮ߦ͍ͤͨ͞৔߹ʹઃఆ • ओʹςετͷฒྻ࣮ߦͰ࢖ΘΕΔ • noteͷRails͸ݱࡏ parallelism 3

  13. parallelism • ͋Δఔ౓·Ͱ͸ฒྻԽ͢Δͱૣ͘ͳΔ • ฒྻԽͯ͠΋ଟগͷภΓ͸ى͖Δ • AϚγϯͱBϚγϯͰ࣮ߦ࣌ؒʹ͕ࠩग़Δ • ࠩΛௐ੔͢Δ࢓૊Έͱͯ͠ɺTiming Data͕ଘࡏ͢Δ

    • ฒྻԽ͗͢͠Δͱ࣌ؒ୹ॖͱैྔ՝ۚͷίετ͕
 ݟ߹Θͳ͘ͳΔ
  14. parallelism https://circleci.com/docs/ja/2.0/ configuration-reference/#parallelism

  15. Running Tests in Parallel https://circleci.com/docs/2.0/parallelism- faster-jobs/

  16. Workflow • jobͷ࣮ߦॱংΛఆٛͯ͠ɺ͍͍ײ͡ʹjobΛ
 ฒྻ࣮ߦͨ͠Γΰχϣΰχϣ͢Δ • ͪΐͬͱෳࡶ͚ͩͲ׳Εͯ͘Δͱศར • ஞ࣮࣍ߦͯͨ͠΋ͷΛฒྻ࣮ߦͤ͞ΒΕΔΑ͏ʹͳΔͱ ޮՌग़ͯ͘Δ •

    ঢ়گʹԠ࣮ͯ͡ߦ͢ΔWorkflowΛม͑ͨΓ͢Δͱศར
  17. • Ϗϧυͯ͠ɺͦͷ݁ՌΛ2ͭͷjobʹڞ௨ͯ͠ɺ jobΛฒྻ࣮ߦͯ͠Δ • ஞ࣮࣍ߦΑΓ30min͘Β͍ૣ͘ͳΔ Workflowྫ

  18. Workflow • ΍Γ͗͢஫ҙ

  19. Workflow https://circleci.com/docs/ja/2.0/workflows/

  20. ͓ۚͷ࿩ • ݸਓతʹ͸ؾʹ͠ͳͯ͘΋͍͍ͱࢥͬͯΔ • ແବ͸μϝ" • ͓ۚΑΓ͕࣌ؒ୹ॖͰ͖Δํ͕࠷ߴ • Time is

    money
  21. ·ͱΊ • CI͸ੜ͖෺Ͱ͢ɺҭ੒͠·͠ΐ͏ • ʮ஗͘Ͷʁʯͱࢥͬͨͦͷ͕࣌ΧΠθϯ࣌ظ • ͓ۚΛ͔͚Ε͹ૣ͘ͳΔ…͔΋