Slide 1

Slide 1 text

ZOZOTOWNの開発で試した
 UIの確認/検証の効率化
 2020/10/21(Wed) Chatwork Tech Talk #1 
 株式会社ZOZOテクノロジーズ
 ZOZOTOWN部 Androidチーム Tech Lead
 堀江 亮介 
 Copyright © ZOZO Technologies, Inc.

Slide 2

Slide 2 text

© ZOZO Technologies, Inc. 株式会社ZOZOテクノロジーズ
 ZOZOTOWN部 Androidチーム
 Tech Lead 堀江 亮介
 ● 自動化とビールが好き ● @Horie1024 ● 昔Androidテスト全書という本を書きました 
 2

Slide 3

Slide 3 text

© ZOZO Technologies, Inc. 開発中のUIの確認/検証をどう行っていますか?
 3

Slide 4

Slide 4 text

© ZOZO Technologies, Inc. 4 1. 開発
 2. 確認/検証用アプリの用意と配布
 3. デザイナーへ確認/検証の依頼
 4. 問題があれば修正、なければ完了
 ZOZOTOWN Androidの場合


Slide 5

Slide 5 text

© ZOZO Technologies, Inc. 5 1. 問題の把握と修正
 2. 確認/検証用アプリの用意と配布
 3. デザイナーへ確認/検証の依頼
 4. 問題があれば修正、なければ完了
 もし問題があれば・・
 問題の把握と修正から再開


Slide 6

Slide 6 text

© ZOZO Technologies, Inc. 6 1. 問題の把握と修正
 2. 確認/検証用アプリの用意と配布
 3. デザイナーへ確認/検証の依頼
 4. 問題があれば修正、なければ完了
 もし問題があれば・・
 問題の把握と修正から再開
 問題の修正から完了までのフローを効率化したい

Slide 7

Slide 7 text

© ZOZO Technologies, Inc. 7 1. 問題の把握と修正
 2. 確認/検証用アプリの用意と配布
 3. デザイナーへ確認/検証の依頼
 4. 問題があれば修正、なければ完了
 効率化するポイントを探す


Slide 8

Slide 8 text

© ZOZO Technologies, Inc. 8 1. 問題の把握と修正
 2. 確認/検証用アプリの用意と配布
 3. デザイナーへ確認/検証の依頼
 4. 問題があれば修正、なければ完了
 効率化するポイントを探す
 手動でAPKのビルドと配布を行っていた


Slide 9

Slide 9 text

© ZOZO Technologies, Inc. 9 APKのビルド Googleドライブへの アップロード デザイナーへリンクを共有 確認/検証用アプリの用意と配布の自動化


Slide 10

Slide 10 text

© ZOZO Technologies, Inc. 10 APKのビルド Googleドライブへの アップロード デザイナーへリンクを共有 確認/検証用アプリの用意と配布の自動化
 
 この部分を自動化する


Slide 11

Slide 11 text

© ZOZO Technologies, Inc. 11 APKのビルド Googleドライブへの アップロード デザイナーへリンクを共有 確認/検証用アプリの用意と配布の自動化
 
 CIサーバー + アプリ配布サービス で容易に自動化


Slide 12

Slide 12 text

© ZOZO Technologies, Inc. 12 APKのビルド Googleドライブへの アップロード デザイナーへリンクを共有 確認/検証用アプリの用意と配布の自動化
 
 GitHub Actions
 DeployGate
 GitHub Actions + DeployGate で実現


Slide 13

Slide 13 text

© ZOZO Technologies, Inc. 13 確認/検証用アプリの用意と配布の自動化
 
 ● デザイナーへの共有にはDeployGateの配布ページを利用
 ● 2次元バーコードの読み取りでインストールできるので簡単
 ● 簡単なのがとても重要


Slide 14

Slide 14 text

© ZOZO Technologies, Inc. 14 確認/検証用アプリの用意と配布の自動化
 
 ● デザイナーへの共有にはDeployGateの配布ページを利用
 ● 2次元バーコードの読み取りでインストールできるので簡単
 ● 簡単なのがとても重要
 複雑・煩雑だと使われなくなってしまう


Slide 15

Slide 15 text

© ZOZO Technologies, Inc. 15 1. 問題の把握と修正
 2. 確認/検証用アプリの用意と配布
 3. デザイナーへ確認/検証の依頼
 4. 問題があれば修正、なければ完了
 確認/検証用アプリの用意と配布の自動化
 
 GitHub Actions + DeployGateで自動化


Slide 16

Slide 16 text

© ZOZO Technologies, Inc. 16 1. 問題の把握と修正
 2. 確認/検証用アプリの用意と配布
 3. デザイナーへ確認/検証の依頼
 4. 問題があれば修正、なければ完了
 確認/検証用アプリの用意と配布の自動化
 
 GitHub Actions + DeployGateで自動化
 GitHub Actionsのビルドトリガーをどこに置くか?

Slide 17

Slide 17 text

© ZOZO Technologies, Inc. 17 GitHub Actionsのビルドトリガー
 何らかのイベント

Slide 18

Slide 18 text

© ZOZO Technologies, Inc. 18 GitHub Actionsのビルドトリガー
 何らかのイベント GitHub上で発生するイベントと相性が良い


Slide 19

Slide 19 text

© ZOZO Technologies, Inc. GitHub上で発生するイベント = 開発で発生するイベント
 19

Slide 20

Slide 20 text

© ZOZO Technologies, Inc. 20 1. 問題の把握と修正
 2. 確認/検証用アプリの用意と配布
 3. デザイナーへ確認/検証の依頼
 4. 問題があれば修正、なければ完了
 確認/検証用アプリの用意と配布の自動化
 
 開発で行っている作業(GitHubを使用する作業)を書き出す


Slide 21

Slide 21 text

© ZOZO Technologies, Inc. 21 1. 問題の把握と修正
 2. Pull Requestのオープン
 3. 確認/検証用アプリの用意と配布
 4. デザイナーへ確認/検証の依頼
 5. 問題があれば修正、なければ完了
 6. Pull Requestのクローズ
 確認/検証用アプリの用意と配布の自動化
 


Slide 22

Slide 22 text

© ZOZO Technologies, Inc. 22 1. 問題の把握と修正
 2. Pull Requestのオープン
 3. 確認/検証用アプリの用意と配布
 4. デザイナーへ確認/検証の依頼
 5. 問題があれば修正、なければ完了
 6. Pull Requestのクローズ
 確認/検証用アプリの用意と配布の自動化
 


Slide 23

Slide 23 text

© ZOZO Technologies, Inc. 23 ● 配布のライフサイクル
 ○ Pull Requestのオープン → APKをビルドし配布開始
 ○ Pull Requestのクローズ → APKの配布終了
 確認/検証用アプリの用意と配布の自動化
 


Slide 24

Slide 24 text

© ZOZO Technologies, Inc. 24 1. 問題の把握と修正
 2. Pull Requestのオープン → APKのビルドと配布ページ作成
 3. デザイナーへ確認/検証の依頼 → 配布ページのURLを共有
 4. 問題があれば修正、なければ完了
 5. Pull Requestのクローズ → 配布ページ削除
 実現したいUIの確認/検証フロー
 
 これを実現するようGitHub ActionsのWorkflowを組む


Slide 25

Slide 25 text

© ZOZO Technologies, Inc. デモ
 サンプルプロジェクトで実際にPull Requestを作成し、
 配布ページが自動で作られる様子を紹介します。
 25

Slide 26

Slide 26 text

© ZOZO Technologies, Inc. GitHub Actionsの設定
 26

Slide 27

Slide 27 text

© ZOZO Technologies, Inc. 27 ● 2つのWorkflowを用意
 ○ Pull Request作成時に実行
 ○ Pull Requestクローズ時に実行
 GitHub Actionsの設定


Slide 28

Slide 28 text

© ZOZO Technologies, Inc. 28 ● 2つのWorkflowを用意
 ○ Pull Request作成時に実行
 ■ APKのビルド
 ■ DeployGateへAPKのアップロード・配布ページの作成
 ■ Pull Requestへ配布ページURLをコメント
 ○ Pull Requestクローズ時に実行
 ■ DeployGate配布ページを削除
 GitHub Actionsの設定


Slide 29

Slide 29 text

© ZOZO Technologies, Inc. Pull Request作成時に実行されるWorkflow
 29

Slide 30

Slide 30 text

© ZOZO Technologies, Inc. 30 name: Android CI on Pull Request Open on: [pull_request] jobs: build: runs-on: ubuntu-latest outputs: distribution_page_url: ${{ steps.distribute_app.outputs.distribution_page_url }} steps: - uses: actions/checkout@v2 - name: set up JDK 1.8 uses: actions/setup-java@v1 with: java-version: 1.8 - name: Build with Gradle run: ./gradlew assembleDebug - name: Distribute App id: distribute_app run: | distribution_page_url=$(curl \ -F "token=${{secrets.DEPLOYGATE_TOKEN}}" \ -F "file=@app/build/outputs/apk/debug/app-debug.apk" \ -F "message=git-hash:`git rev-parse --short $GITHUB_SHA`" \ -F "distribution_name=$GITHUB_HEAD_REF" \ https://deploygate.com/api/users/${{secrets.DEPLOYGATE_USER}}/apps | jq -r .results.distribution.url) echo "::set-output name=distribution_page_url::$distribution_page_url" - name: Comment to Pull Request uses: actions/github-script@v3 with: github-token: ${{secrets.GITHUB_TOKEN}} script: | const comments = await github.paginate(github.issues.listComments, { issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, }) for (const comment of comments) { if (comment.body.includes("https://deploygate.com/distributions/")) { return // The URL for the distribution page has already been posted. } } github.issues.createComment({ issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, body: '配布ページを作成しました\n${{ steps.distribute_app.outputs.distribution_page_url }}' })

Slide 31

Slide 31 text

© ZOZO Technologies, Inc. 31 name: Android CI on Pull Request Open on: [pull_request] jobs: build: runs-on: ubuntu-latest outputs: distribution_page_url: ${{ steps.distribute_app.outputs.distribution_page_url }} steps: - uses: actions/checkout@v2 - name: set up JDK 1.8 uses: actions/setup-java@v1 with: java-version: 1.8 - name: Build with Gradle run: ./gradlew assembleDebug - name: Distribute App id: distribute_app run: | distribution_page_url=$(curl \ -F "token=${{secrets.DEPLOYGATE_TOKEN}}" \ -F "file=@app/build/outputs/apk/debug/app-debug.apk" \ -F "message=git-hash:`git rev-parse --short $GITHUB_SHA`" \ -F "distribution_name=$GITHUB_HEAD_REF" \ https://deploygate.com/api/users/${{secrets.DEPLOYGATE_USER}}/apps | jq -r .results.distribution.url) echo "::set-output name=distribution_page_url::$distribution_page_url" - name: Comment to Pull Request uses: actions/github-script@v3 with: github-token: ${{secrets.GITHUB_TOKEN}} script: | const comments = await github.paginate(github.issues.listComments, { issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, }) for (const comment of comments) { if (comment.body.includes("https://deploygate.com/distributions/")) { return // The URL for the distribution page has already been posted. } } github.issues.createComment({ issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, body: '配布ページを作成しました\n${{ steps.distribute_app.outputs.distribution_page_url }}' })

Slide 32

Slide 32 text

© ZOZO Technologies, Inc. on: [pull_request] 32 Pull Requestが作成されたタイミングでWorkflowをトリガー

Slide 33

Slide 33 text

© ZOZO Technologies, Inc. 33 name: Android CI on Pull Request Open on: [pull_request] jobs: build: runs-on: ubuntu-latest outputs: distribution_page_url: ${{ steps.distribute_app.outputs.distribution_page_url }} steps: - uses: actions/checkout@v2 - name: set up JDK 1.8 uses: actions/setup-java@v1 with: java-version: 1.8 - name: Build with Gradle run: ./gradlew assembleDebug - name: Distribute App id: distribute_app run: | distribution_page_url=$(curl \ -F "token=${{secrets.DEPLOYGATE_TOKEN}}" \ -F "file=@app/build/outputs/apk/debug/app-debug.apk" \ -F "message=git-hash:`git rev-parse --short $GITHUB_SHA`" \ -F "distribution_name=$GITHUB_HEAD_REF" \ https://deploygate.com/api/users/${{secrets.DEPLOYGATE_USER}}/apps | jq -r .results.distribution.url) echo "::set-output name=distribution_page_url::$distribution_page_url" - name: Comment to Pull Request uses: actions/github-script@v3 with: github-token: ${{secrets.GITHUB_TOKEN}} script: | const comments = await github.paginate(github.issues.listComments, { issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, }) for (const comment of comments) { if (comment.body.includes("https://deploygate.com/distributions/")) { return // The URL for the distribution page has already been posted. } } github.issues.createComment({ issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, body: '配布ページを作成しました\n${{ steps.distribute_app.outputs.distribution_page_url }}' })

Slide 34

Slide 34 text

© ZOZO Technologies, Inc. 34 name: Android CI on Pull Request Open on: [pull_request] jobs: build: runs-on: ubuntu-latest outputs: distribution_page_url: ${{ steps.distribute_app.outputs.distribution_page_url }} steps: - uses: actions/checkout@v2 - name: set up JDK 1.8 uses: actions/setup-java@v1 with: java-version: 1.8 - name: Build with Gradle run: ./gradlew assembleDebug - name: Distribute App id: distribute_app run: | distribution_page_url=$(curl \ -F "token=${{secrets.DEPLOYGATE_TOKEN}}" \ -F "file=@app/build/outputs/apk/debug/app-debug.apk" \ -F "message=git-hash:`git rev-parse --short $GITHUB_SHA`" \ -F "distribution_name=$GITHUB_HEAD_REF" \ https://deploygate.com/api/users/${{secrets.DEPLOYGATE_USER}}/apps | jq -r .results.distribution.url) echo "::set-output name=distribution_page_url::$distribution_page_url" - name: Comment to Pull Request uses: actions/github-script@v3 with: github-token: ${{secrets.GITHUB_TOKEN}} script: | const comments = await github.paginate(github.issues.listComments, { issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, }) for (const comment of comments) { if (comment.body.includes("https://deploygate.com/distributions/")) { return // The URL for the distribution page has already been posted. } } github.issues.createComment({ issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, body: '配布ページを作成しました\n${{ steps.distribute_app.outputs.distribution_page_url }}' })

Slide 35

Slide 35 text

© ZOZO Technologies, Inc. jobs: build: runs-on: ubuntu-latest outputs: distribution_page_url: ${{ steps.distribute_app.outputs.distribution_page_url }} steps: - uses: actions/checkout@v2 - name: set up JDK 1.8 uses: actions/setup-java@v1 with: java-version: 1.8 - name: Build with Gradle run: ./gradlew assembleDebug - name: Distribute App id: distribute_app run: | distribution_page_url=$(curl \ -F "token=${{secrets.DEPLOYGATE_TOKEN}}" \ -F "file=@app/build/outputs/apk/debug/app-debug.apk" \ -F "message=git-hash:`git rev-parse --short $GITHUB_SHA`" \ -F "distribution_name=$GITHUB_HEAD_REF" \ https://deploygate.com/api/users/${{secrets.DEPLOYGATE_USER}}/apps | \ jq -r .results.distribution.url) echo "::set-output name=distribution_page_url::$distribution_page_url" 35

Slide 36

Slide 36 text

© ZOZO Technologies, Inc. jobs: build: runs-on: ubuntu-latest outputs: distribution_page_url: ${{ steps.distribute_app.outputs.distribution_page_url }} steps: - uses: actions/checkout@v2 - name: set up JDK 1.8 uses: actions/setup-java@v1 with: java-version: 1.8 - name: Build with Gradle run: ./gradlew assembleDebug - name: Distribute App id: distribute_app run: | distribution_page_url=$(curl \ -F "token=${{secrets.DEPLOYGATE_TOKEN}}" \ -F "file=@app/build/outputs/apk/debug/app-debug.apk" \ -F "message=git-hash:`git rev-parse --short $GITHUB_SHA`" \ -F "distribution_name=$GITHUB_HEAD_REF" \ https://deploygate.com/api/users/${{secrets.DEPLOYGATE_USER}}/apps | \ jq -r .results.distribution.url) echo "::set-output name=distribution_page_url::$distribution_page_url" 36 配布ページURLを下流のstepに共有する設定

Slide 37

Slide 37 text

© ZOZO Technologies, Inc. jobs: build: runs-on: ubuntu-latest outputs: distribution_page_url: ${{ steps.distribute_app.outputs.distribution_page_url }} steps: - uses: actions/checkout@v2 - name: set up JDK 1.8 uses: actions/setup-java@v1 with: java-version: 1.8 - name: Build with Gradle run: ./gradlew assembleDebug - name: Distribute App id: distribute_app run: | distribution_page_url=$(curl \ -F "token=${{secrets.DEPLOYGATE_TOKEN}}" \ -F "file=@app/build/outputs/apk/debug/app-debug.apk" \ -F "message=git-hash:`git rev-parse --short $GITHUB_SHA`" \ -F "distribution_name=$GITHUB_HEAD_REF" \ https://deploygate.com/api/users/${{secrets.DEPLOYGATE_USER}}/apps | \ jq -r .results.distribution.url) echo "::set-output name=distribution_page_url::$distribution_page_url" 37

Slide 38

Slide 38 text

© ZOZO Technologies, Inc. jobs: build: runs-on: ubuntu-latest outputs: distribution_page_url: ${{ steps.distribute_app.outputs.distribution_page_url }} steps: - uses: actions/checkout@v2 - name: set up JDK 1.8 uses: actions/setup-java@v1 with: java-version: 1.8 - name: Build with Gradle run: ./gradlew assembleDebug - name: Distribute App id: distribute_app run: | distribution_page_url=$(curl \ -F "token=${{secrets.DEPLOYGATE_TOKEN}}" \ -F "file=@app/build/outputs/apk/debug/app-debug.apk" \ -F "message=git-hash:`git rev-parse --short $GITHUB_SHA`" \ -F "distribution_name=$GITHUB_HEAD_REF" \ https://deploygate.com/api/users/${{secrets.DEPLOYGATE_USER}}/apps | \ jq -r .results.distribution.url) echo "::set-output name=distribution_page_url::$distribution_page_url" 38 ビルドを実行してAPKを生成

Slide 39

Slide 39 text

© ZOZO Technologies, Inc. jobs: build: runs-on: ubuntu-latest outputs: distribution_page_url: ${{ steps.distribute_app.outputs.distribution_page_url }} steps: - uses: actions/checkout@v2 - name: set up JDK 1.8 uses: actions/setup-java@v1 with: java-version: 1.8 - name: Build with Gradle run: ./gradlew assembleDebug - name: Distribute App id: distribute_app run: | distribution_page_url=$(curl \ -F "token=${{secrets.DEPLOYGATE_TOKEN}}" \ -F "file=@app/build/outputs/apk/debug/app-debug.apk" \ -F "message=git-hash:`git rev-parse --short $GITHUB_SHA`" \ -F "distribution_name=$GITHUB_HEAD_REF" \ https://deploygate.com/api/users/${{secrets.DEPLOYGATE_USER}}/apps | \ jq -r .results.distribution.url) echo "::set-output name=distribution_page_url::$distribution_page_url" 39

Slide 40

Slide 40 text

© ZOZO Technologies, Inc. jobs: build: runs-on: ubuntu-latest outputs: distribution_page_url: ${{ steps.distribute_app.outputs.distribution_page_url }} steps: - uses: actions/checkout@v2 - name: set up JDK 1.8 uses: actions/setup-java@v1 with: java-version: 1.8 - name: Build with Gradle run: ./gradlew assembleDebug - name: Distribute App id: distribute_app run: | distribution_page_url=$(curl \ -F "token=${{secrets.DEPLOYGATE_TOKEN}}" \ -F "file=@app/build/outputs/apk/debug/app-debug.apk" \ -F "message=git-hash:`git rev-parse --short $GITHUB_SHA`" \ -F "distribution_name=$GITHUB_HEAD_REF" \ https://deploygate.com/api/users/${{secrets.DEPLOYGATE_USER}}/apps | \ jq -r .results.distribution.url) echo "::set-output name=distribution_page_url::$distribution_page_url" 40 DeployGateへAPKをアップロード/配布ページ作成

Slide 41

Slide 41 text

© ZOZO Technologies, Inc. jobs: build: runs-on: ubuntu-latest outputs: distribution_page_url: ${{ steps.distribute_app.outputs.distribution_page_url }} steps: - uses: actions/checkout@v2 - name: set up JDK 1.8 uses: actions/setup-java@v1 with: java-version: 1.8 - name: Build with Gradle run: ./gradlew assembleDebug - name: Distribute App id: distribute_app run: | distribution_page_url=$(curl \ -F "token=${{secrets.DEPLOYGATE_TOKEN}}" \ -F "file=@app/build/outputs/apk/debug/app-debug.apk" \ -F "message=git-hash:`git rev-parse --short $GITHUB_SHA`" \ -F "distribution_name=$GITHUB_HEAD_REF" \ https://deploygate.com/api/users/${{secrets.DEPLOYGATE_USER}}/apps | \ jq -r .results.distribution.url) echo "::set-output name=distribution_page_url::$distribution_page_url" 41 ブランチ名で配布ページを作成

Slide 42

Slide 42 text

© ZOZO Technologies, Inc. jobs: build: runs-on: ubuntu-latest outputs: distribution_page_url: ${{ steps.distribute_app.outputs.distribution_page_url }} steps: - uses: actions/checkout@v2 - name: set up JDK 1.8 uses: actions/setup-java@v1 with: java-version: 1.8 - name: Build with Gradle run: ./gradlew assembleDebug - name: Distribute App id: distribute_app run: | distribution_page_url=$(curl \ -F "token=${{secrets.DEPLOYGATE_TOKEN}}" \ -F "file=@app/build/outputs/apk/debug/app-debug.apk" \ -F "message=git-hash:`git rev-parse --short $GITHUB_SHA`" \ -F "distribution_name=$GITHUB_HEAD_REF" \ https://deploygate.com/api/users/${{secrets.DEPLOYGATE_USER}}/apps | \ jq -r .results.distribution.url) echo "::set-output name=distribution_page_url::$distribution_page_url" 42 レスポンスから配布ページURLを取得 jqがデフォルトで使えるので利用

Slide 43

Slide 43 text

© ZOZO Technologies, Inc. jobs: build: runs-on: ubuntu-latest outputs: distribution_page_url: ${{ steps.distribute_app.outputs.distribution_page_url }} steps: - uses: actions/checkout@v2 - name: set up JDK 1.8 uses: actions/setup-java@v1 with: java-version: 1.8 - name: Build with Gradle run: ./gradlew assembleDebug - name: Distribute App id: distribute_app run: | distribution_page_url=$(curl \ -F "token=${{secrets.DEPLOYGATE_TOKEN}}" \ -F "file=@app/build/outputs/apk/debug/app-debug.apk" \ -F "message=git-hash:`git rev-parse --short $GITHUB_SHA`" \ -F "distribution_name=$GITHUB_HEAD_REF" \ https://deploygate.com/api/users/${{secrets.DEPLOYGATE_USER}}/apps | \ jq -r .results.distribution.url) echo "::set-output name=distribution_page_url::$distribution_page_url" 43 配布ページURLを下流のstepで利用できるようset

Slide 44

Slide 44 text

© ZOZO Technologies, Inc. 44 name: Android CI on Pull Request Open on: [pull_request] jobs: build: runs-on: ubuntu-latest outputs: distribution_page_url: ${{ steps.distribute_app.outputs.distribution_page_url }} steps: - uses: actions/checkout@v2 - name: set up JDK 1.8 uses: actions/setup-java@v1 with: java-version: 1.8 - name: Build with Gradle run: ./gradlew assembleDebug - name: Distribute App id: distribute_app run: | distribution_page_url=$(curl \ -F "token=${{secrets.DEPLOYGATE_TOKEN}}" \ -F "file=@app/build/outputs/apk/debug/app-debug.apk" \ -F "message=git-hash:`git rev-parse --short $GITHUB_SHA`" \ -F "distribution_name=$GITHUB_HEAD_REF" \ https://deploygate.com/api/users/${{secrets.DEPLOYGATE_USER}}/apps | jq -r .results.distribution.url) echo "::set-output name=distribution_page_url::$distribution_page_url" - name: Comment to Pull Request uses: actions/github-script@v3 with: github-token: ${{secrets.GITHUB_TOKEN}} script: | const comments = await github.paginate(github.issues.listComments, { issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, }) for (const comment of comments) { if (comment.body.includes("https://deploygate.com/distributions/")) { return // The URL for the distribution page has already been posted. } } github.issues.createComment({ issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, body: '配布ページを作成しました\n${{ steps.distribute_app.outputs.distribution_page_url }}' })

Slide 45

Slide 45 text

© ZOZO Technologies, Inc. 45 name: Android CI on Pull Request Open on: [pull_request] jobs: build: runs-on: ubuntu-latest outputs: distribution_page_url: ${{ steps.distribute_app.outputs.distribution_page_url }} steps: - uses: actions/checkout@v2 - name: set up JDK 1.8 uses: actions/setup-java@v1 with: java-version: 1.8 - name: Build with Gradle run: ./gradlew assembleDebug - name: Distribute App id: distribute_app run: | distribution_page_url=$(curl \ -F "token=${{secrets.DEPLOYGATE_TOKEN}}" \ -F "file=@app/build/outputs/apk/debug/app-debug.apk" \ -F "message=git-hash:`git rev-parse --short $GITHUB_SHA`" \ -F "distribution_name=$GITHUB_HEAD_REF" \ https://deploygate.com/api/users/${{secrets.DEPLOYGATE_USER}}/apps | jq -r .results.distribution.url) echo "::set-output name=distribution_page_url::$distribution_page_url" - name: Comment to Pull Request uses: actions/github-script@v3 with: github-token: ${{secrets.GITHUB_TOKEN}} script: | const comments = await github.paginate(github.issues.listComments, { issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, }) for (const comment of comments) { if (comment.body.includes("https://deploygate.com/distributions/")) { return // The URL for the distribution page has already been posted. } } github.issues.createComment({ issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, body: '配布ページを作成しました\n${{ steps.distribute_app.outputs.distribution_page_url }}' })

Slide 46

Slide 46 text

© ZOZO Technologies, Inc. 46 - name: Comment to Pull Request uses: actions/github-script@v3 with: github-token: ${{secrets.GITHUB_TOKEN}} script: | const comments = await github.paginate(github.issues.listComments, { issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, }) for (const comment of comments) { if (comment.body.includes("https://deploygate.com/distributions/")) { return // The URL for the distribution page has already been posted. } } github.issues.createComment({ issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, body: '配布ページを作成しました\n' + '${{ steps.distribute_app.outputs.distribution_page_url }}' })

Slide 47

Slide 47 text

© ZOZO Technologies, Inc. 47 - name: Comment to Pull Request uses: actions/github-script@v3 with: github-token: ${{secrets.GITHUB_TOKEN}} script: | const comments = await github.paginate(github.issues.listComments, { issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, }) for (const comment of comments) { if (comment.body.includes("https://deploygate.com/distributions/")) { return // The URL for the distribution page has already been posted. } } github.issues.createComment({ issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, body: '配布ページを作成しました\n' + '${{ steps.distribute_app.outputs.distribution_page_url }}' }) octokit/rest.jsをstep内から実行可能にするaction JavaScriptでGitHub APIを制御

Slide 48

Slide 48 text

© ZOZO Technologies, Inc. 48 - name: Comment to Pull Request uses: actions/github-script@v3 with: github-token: ${{secrets.GITHUB_TOKEN}} script: | const comments = await github.paginate(github.issues.listComments, { issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, }) for (const comment of comments) { if (comment.body.includes("https://deploygate.com/distributions/")) { return // The URL for the distribution page has already been posted. } } github.issues.createComment({ issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, body: '配布ページを作成しました\n' + '${{ steps.distribute_app.outputs.distribution_page_url }}' })

Slide 49

Slide 49 text

© ZOZO Technologies, Inc. 49 - name: Comment to Pull Request uses: actions/github-script@v3 with: github-token: ${{secrets.GITHUB_TOKEN}} script: | const comments = await github.paginate(github.issues.listComments, { issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, }) for (const comment of comments) { if (comment.body.includes("https://deploygate.com/distributions/")) { return // The URL for the distribution page has already been posted. } } github.issues.createComment({ issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, body: '配布ページを作成しました\n' + '${{ steps.distribute_app.outputs.distribution_page_url }}' }) 配布ページURLをPull Requestへコメント

Slide 50

Slide 50 text

© ZOZO Technologies, Inc. 50

Slide 51

Slide 51 text

© ZOZO Technologies, Inc. 51 - name: Comment to Pull Request uses: actions/github-script@v3 with: github-token: ${{secrets.GITHUB_TOKEN}} script: | const comments = await github.paginate(github.issues.listComments, { issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, }) for (const comment of comments) { if (comment.body.includes("https://deploygate.com/distributions/")) { return // The URL for the distribution page has already been posted. } } github.issues.createComment({ issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, body: '配布ページを作成しました\n' + '${{ steps.distribute_app.outputs.distribution_page_url }}' })

Slide 52

Slide 52 text

© ZOZO Technologies, Inc. 52 - name: Comment to Pull Request uses: actions/github-script@v3 with: github-token: ${{secrets.GITHUB_TOKEN}} script: | const comments = await github.paginate(github.issues.listComments, { issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, }) for (const comment of comments) { if (comment.body.includes("https://deploygate.com/distributions/")) { return // The URL for the distribution page has already been posted. } } github.issues.createComment({ issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, body: '配布ページを作成しました\n' + '${{ steps.distribute_app.outputs.distribution_page_url }}' }) Pull Requestへのコメント一覧を取得

Slide 53

Slide 53 text

© ZOZO Technologies, Inc. 53 - name: Comment to Pull Request uses: actions/github-script@v3 with: github-token: ${{secrets.GITHUB_TOKEN}} script: | const comments = await github.paginate(github.issues.listComments, { issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, }) for (const comment of comments) { if (comment.body.includes("https://deploygate.com/distributions/")) { return // The URL for the distribution page has already been posted. } } github.issues.createComment({ issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, body: '配布ページを作成しました\n' + '${{ steps.distribute_app.outputs.distribution_page_url }}' })

Slide 54

Slide 54 text

© ZOZO Technologies, Inc. 54 - name: Comment to Pull Request uses: actions/github-script@v3 with: github-token: ${{secrets.GITHUB_TOKEN}} script: | const comments = await github.paginate(github.issues.listComments, { issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, }) for (const comment of comments) { if (comment.body.includes("https://deploygate.com/distributions/")) { return // The URL for the distribution page has already been posted. } } github.issues.createComment({ issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, body: '配布ページを作成しました\n' + '${{ steps.distribute_app.outputs.distribution_page_url }}' }) コメントに配布ページURLが含まれているか確認 含まれていればreturn

Slide 55

Slide 55 text

© ZOZO Technologies, Inc. Pull Requestクローズ時に実行されるWorkflow
 55

Slide 56

Slide 56 text

© ZOZO Technologies, Inc. 56 name: Android CI on Pull Request Close on: pull_request: types: [closed] jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: set up JDK 1.8 uses: actions/setup-java@v1 with: java-version: 1.8 - name: Delete distribution page run: | curl \ -X DELETE \ -F "token=${{secrets.DEPLOYGATE_TOKEN}}" \ -F "distribution_name=$GITHUB_HEAD_REF" \ https://deploygate.com/api/users/${{secrets.DEPLOYGATE_USER}}/platforms/android/apps/com.horie1024.githubactionssample/distributions

Slide 57

Slide 57 text

© ZOZO Technologies, Inc. 57 name: Android CI on Pull Request Close on: pull_request: types: [closed] jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: set up JDK 1.8 uses: actions/setup-java@v1 with: java-version: 1.8 - name: Delete distribution page run: | curl \ -X DELETE \ -F "token=${{secrets.DEPLOYGATE_TOKEN}}" \ -F "distribution_name=$GITHUB_HEAD_REF" \ https://deploygate.com/api/users/${{secrets.DEPLOYGATE_USER}}/platforms/android/apps/com.horie1024.githubactionssample/distributions

Slide 58

Slide 58 text

© ZOZO Technologies, Inc. on: pull_request: types: [closed] 58 Pull Requestがクローズされたタイミングで Workflowをトリガー

Slide 59

Slide 59 text

© ZOZO Technologies, Inc. 59 name: Android CI on Pull Request Close on: pull_request: types: [closed] jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: set up JDK 1.8 uses: actions/setup-java@v1 with: java-version: 1.8 - name: Delete distribution page run: | curl \ -X DELETE \ -F "token=${{secrets.DEPLOYGATE_TOKEN}}" \ -F "distribution_name=$GITHUB_HEAD_REF" \ https://deploygate.com/api/users/${{secrets.DEPLOYGATE_USER}}/platforms/android/apps/com.horie1024.githubactionssample/distributions

Slide 60

Slide 60 text

© ZOZO Technologies, Inc. 60 name: Android CI on Pull Request Close on: pull_request: types: [closed] jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: set up JDK 1.8 uses: actions/setup-java@v1 with: java-version: 1.8 - name: Delete distribution page run: | curl \ -X DELETE \ -F "token=${{secrets.DEPLOYGATE_TOKEN}}" \ -F "distribution_name=$GITHUB_HEAD_REF" \ https://deploygate.com/api/users/${{secrets.DEPLOYGATE_USER}}/platforms/android/apps/com.horie1024.githubactionssample/distributions

Slide 61

Slide 61 text

© ZOZO Technologies, Inc. 61 name: Android CI on Pull Request Close on: pull_request: types: [closed] jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: set up JDK 1.8 uses: actions/setup-java@v1 with: java-version: 1.8 - name: Delete distribution page run: | curl \ -X DELETE \ -F "token=${{secrets.DEPLOYGATE_TOKEN}}" \ -F "distribution_name=$GITHUB_HEAD_REF" \ https://deploygate.com/api/users/${{secrets.DEPLOYGATE_USER}}/platforms/android/apps/com.horie1024.githubactionssample/distributions ブランチ名を指定して配布ページを削除

Slide 62

Slide 62 text

© ZOZO Technologies, Inc. 62 ● これでGitHub Actionsの設定は完了
 ● サンプルリポジトリはこちら
 ● https://github.com/horie1024/github_actions_android_sample
 GitHub Actionsの設定


Slide 63

Slide 63 text

© ZOZO Technologies, Inc. 導入した結果
 63

Slide 64

Slide 64 text

© ZOZO Technologies, Inc. 64 ● ZOZOTOWNアプリチームではKPTを定期的に行っている
 ○ iOS/Android/API/デザインの各チーム毎のKPT
 ○ 各チームを横断した全体のKPT
 ● 配布ページの件はデザイナーチームからKeepとしてフィードバック
 KPT(Keep Problem Try)


Slide 65

Slide 65 text

© ZOZO Technologies, Inc. 65 「AndroidアプリのDeployGateによるデザイン確認を、2次元バーコードでインス トール画面に飛べるようにしてもらったので大変楽になりました。」
 デザイナーからのフィードバック


Slide 66

Slide 66 text

© ZOZO Technologies, Inc. まとめ
 66

Slide 67

Slide 67 text

© ZOZO Technologies, Inc. 67 まとめ
 ● GitHub Actions + DeployGateでAPKのビルドと配布を自動化
 ● デザイナーチームからポジティブなフィードバックを得た
 ● UIの確認/検証の効率化につながっている


Slide 68

Slide 68 text

No content