Lock in $30 Savings on PRO—Offer Ends Soon! ⏳

GitHub Actions CI/CD Update

bakunyo
August 18, 2019

GitHub Actions CI/CD Update

bakunyo

August 18, 2019
Tweet

More Decks by bakunyo

Other Decks in Programming

Transcript

  1. ࠓճͷ಺༰ • GitHub Actions: ࡢ೥10݄ͷ GitHub Universe Ͱ ൃද͞Εͨ৽ػೳʢݱࡏ β

    ൛ʣ • 2݄ͷ Shinjuku.LT ͰͦΕʹ͍ͭͯൃද • https://blog.bakunyo.com/2019/02/26/github-actions-git-pr- release/ • ࠓճ͸ͦͷ UPDATE
  2. GitHub Special Product Announcement • 2019.08.08 GitHubHQ ͰΠϕϯτ͕։࠵͞Εͨ • ಺༰͸

    GitHub Actions ͷ࠷৽৘ใʹ͍ͭͯ • ϝΠϯ͸ built-in CI/CD ɺͦΕҎ֎΋৭ʑ
  3. Documentation Update • Core Concepts ͕੔ཧ͞Εͨ • Workflow ͷఆ͕ٛ HCL

    → YAML ʹมߋ • (چ) https://developer.github.com/actions/ • (৽) https://help.github.com/en/categories/ automating-your-workflow-with-github-actions
  4. Core Concepts ͕੔ཧ͞Εͨ name: Greet Everybody on: [push] jobs: build:

    name: Greeting runs-on: ubuntu-latest steps: - uses: actions/checkout@v1 - uses: ./hello-world-action with: who-to-greet: 'Octocat' id: hello - run: echo "The time was $ {{ steps.hello.outputs.time }}" workflow event job step instance workflow run
  5. Workflow ͷఆ͕ٛ HCL → YAML ʹมߋ ɾ⾠ HCL ͷαϙʔτ͸ 2019.9.30

    ·Ͱ
 ɾmigration tool ͕༻ҙ͞ΕͯΔ
 ɹhttps://help.github.com/en/articles/migrating-github-actions-from-hcl-syntax-to-yaml-syntax 

  6. ࣮ߦͯ͠Έͨ $ ~/Downloads/migrate-actions Created workflow .github/workflows/release.yml Created workflow .github/workflows/push.yml You

    can now delete your main.workflow file. If you have any .yml files in .github/workflows your main.workflow will be ignored. rm .github/main.workflow git add -A .github/main.workflow .github/workflows/*.yml git commit -m 'converted main.workflow to Actions V2 yml files' Thanks for being a ________.__ __ ___ ___ ___. _____ __ .__ / _____/|__|/ |_ / | \ __ _\_ |__ / _ \ _____/ |_|__| ____ ____ ______ / \ ___| \ __\/ ~ \ | \ __ \ / /_\ \_/ ___\ __\ |/ _ \ / \ / ___/ \ \_\ \ || | \ Y / | / \_\ \ / | \ \___| | | ( <_> ) | \\___ \ \______ /__||__| \___|_ /|____/|___ / \____|__ /\___ >__| |__|\____/|___| /____ > \/ \/ \/ \/ \/ \/ \/ __________ __ ___________ __ \______ \ _____/ |______ \__ ___/___ _______/ |_ ___________ | | _// __ \ __\__ \ | |_/ __ \ / ___/\ __\/ __ \_ __ \ | | \ ___/| | / __ \_ | |\ ___/ \___ \ | | \ ___/| | \/ |______ /\___ >__| (____ / |____| \___ >____ > |__| \___ >__| \/ \/ \/ \/ \/ \/ ɾWorkflow ຖʹYAMLϑΝΠϧ͕ࣗಈੜ੒͞ΕΔ
 ɾίϝϯτ͸ফ͑Δ
 ɾbranch Λ filter action Ͱఆظͨ͠ͱ͜Ζ͸ࣗ෼Ͱॻ͖׵͑ͨํ͕ྑͦ͞͏ʢޙड़ʣ
 ɾ֓Ͷ໰୊ͳ͠
  7. Before workflow "Create PR to master" { resolves = ["git-pr-release"]

    on = "push" } action "Filter branch" { uses = "actions/bin/filter@24a566c2524e05ebedadef0a285f72dc9b631411" args = "branch develop" } action "git-pr-release" { uses = "bakunyo/git-pr-release-action@master" needs = ["Filter branch"] secrets = [ "GITHUB_TOKEN", ] env = { GIT_PR_RELEASE_BRANCH_STAGING = "develop" } }
  8. After name: Create PR to master on: push: branches: -

    develop jobs: filterBranch: name: Filter branch runs-on: ubuntu-latest steps: - uses: actions/checkout@master - name: git-pr-release uses: bakunyo/git-pr-release-action@master env: GIT_PR_RELEASE_BRANCH_STAGING: develop GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  9. What’s built-in CI/CD? • ͜Ε·Ͱͷ GitHub Actions Ͱ΋޻෉࣍ୈͰ CI/ CD

    ͸͋Δఔ౓Ͱ͖ͨ • ࠓճͷൃදͰ CI/CD Λαϙʔτ͢Δػೳ͕૿͑ͨ • ػೳΛෳ߹తʹར༻͢Δ͜ͱͰɺbuilt-in CI/CD ͱݴ͍ͬͯΔʢʁʣ
  10. Matrix builds strategy: matrix: node: [6, 8, 10] os: [ubuntu-14.04,

    ubuntu-18.04] ɾOS΍ݴޠόʔδϣϯ͝ͱͷϏϧυΛฒྻͰͰ͖Δ ɾฒྻ਺͸ 1 repository 20 jobs ·Ͱ ɾˣͷ৔߹ɺ 3 x 2 = 6 jobs ΛฒྻͰ࣮ߦՄೳ
  11. Events on: push: branches: - master paths: - test/*
 schedule:

    - cron: '0 * * * *' ɾ͜Ε·Ͱಉ༷ɺGitHub ͷ֤छΠϕϯτΛൃՐ৚݅ʹͰ͖Δ ɾBranch ͷϑΟϧλָ͕ʹͳͬͨ
 ɹʢ͜Ε·Ͱ͸ϑΟϧλ༻ͷ GitHub Action Λ࢖͏ඞཁ͕͋ͬͨʣ ɾՃ͑ͯɺpath ࢦఆ΍ cron syntax ʹΑΔఆٛ΋Մೳʹͳͬͨ