> For the complete documentation index, see [llms.txt](https://help.autify.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.autify.com/nocode-mobile/using-autify-nocode-mobile/integrations/circleci-integration.md). Agents can also search and read this documentation through its [MCP server](https://help.autify.com/~gitbook/mcp).

# CircleCI 連携

Autify ではお手持ちのCircleCI workflow から簡単にビルドをアップロードしたりテストプランを実行できる公式のCircleCI Orb を提供しています。

## はじめてみよう

このドキュメントでは、皆さんのGit リポジトリでどのようにAutify のCircleCI 連携を利用するかを順に説明していきます。

### 前提条件

まず、すでにCircleCI workflow を使ってアプリケーションのビルドを行なっているものとします。そのビルドjob のすぐ後にAutify のテストを実行するjob を追加することで、新しくビルドされたアプリケーションがエンドツーエンドのユーザ体験を損ねていないことを確認できるようにします。

次に、[Autify NoCode Mobile](https://mobile-app.autify.com) でテストプランを作成する必要があります。テストプランまたはシナリオのURL (例: `https://mobile-app.autify.com/projects/AAA/scenarios/BBB`) をメモしておいてください、後ほど利用します。

さらに、[パーソナルアクセストークンを生成する](https://help.autify.com/nocode-mobile/using-autify-nocode-mobile/integrations/api-integration.md#api-authentication-token-generation-method)必要があります。後ほどEnvironment Variables (環境変数) に保存するために、生成されたトークンはどこかにメモしておいて下さい。

*注: パーソナルアクセストークンは1人のユーザに紐づいてしまうので、CI/CD 連携のために組織にマシンユーザを作って、そのパーソナルアクセストークンを使うことをお勧めします。*

### パーソナルアクセストークンをEnvironment Variables に保存

上で生成したパーソナルアクセストークンを[CircleCI のドキュメント](https://circleci.com/docs/ja/env-vars)に従って、Environment Variables (環境変数) に保存します。名前は任意ですが、`AUTIFY_MOBILE_ACCESS_TOKEN` と命名した場合はそれがデフォルトの名前なので後ほどこの名前を指定する必要がありません。ここではそうしたと仮定しておきます。

### Autify NoCode Mobileにビルドをアップロードしたりテストを実行するCircleCI job を追加

それでは、お手持ちのCircleCI workflow に新しいjob を追加しましょう。以下の例を参考にしてください。`autify-test-url` の値は、上でメモしたURL になります。

* [autify/autify-mobile CircleCI Orb](https://circleci.com/developer/orbs/orb/autify/autify-mobile)

***

新しいビルドファイルをアップロードしてテストを開始する (テストの完了は待たない):

```yaml
orbs:
  android: circleci/android@2.0
  autify-mobile: autify/autify-mobile@3

jobs:
  # Example build jobs. Needs to persist the build file to workspace.
  build-android:
    executor:
      name: android/android-machine
    steps:
      - ...
      - run: ./gradlew assembleRelease
      - persist_to_workspace:
          paths:
            - android-release.apk
          root: app/build/outputs/apk/release
  build-ios:
    macos:
      xcode: 13.4.1
    steps:
      - ...
      - run: xcodebuild -configuration Debug -target hello-world -arch x86_64 -sdk iphonesimulator
      - persist_to_workspace:
          paths:
            - hello-world.app
          root: build/Debug-iphonesimulator

workflows:
  test-run-andriod:
    jobs:
      - build-android
      - autify-mobile/test-run:
          requires:
            - build-android
          autify-test-url: 'https://mobile-app.autify.com/projects/AAA/test_plans/BBB'
          build-path: android-release.apk

  test-run-ios:
    jobs:
      - build-ios
      - autify-mobile/test-run:
          requires:
            - build-ios
          autify-test-url: 'https://mobile-app.autify.com/projects/AAA/test_plans/BBB'
          build-path: hello-world.app
```

もしテストが完了するか、タイムアウトするまで待つ場合:

```yaml
    jobs:
      - autify-mobile/test-run:
          ...
          wait: true
          timeout: 300
```

**警告: この設定はテスト完了を待っている間もCircleCI build の時間を消費します。タイムアウトを延長するときは注意してください。**

新しいビルドファイルをアップロードするだけ (`workspace-id` は上でメモしたURL の`/projects/` のすぐ後ろのid):

```yaml
    # Android
    jobs:
      - build-android
      - autify-mobile/build-upload:
          requires:
            - build-android
          build-path: android-release.apk
          workspace-id: AAA
          
    ## iOS
    jobs:
      - build-ios
      - autify-mobile/build-upload:
          requires:
            - build-ios
          build-path: hello-world.app
         workspace-id: AAA
```

## まとめ

[Autify のCircleCI Orb](https://circleci.com/developer/orbs/orb/autify/autify-mobile) を使うことで、ビルド後にテストプランの実行を自動化できるので、無駄な時間を使うことなくリグレッションをすぐに検知して適切な行動を取ることができるようになります。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://help.autify.com/nocode-mobile/using-autify-nocode-mobile/integrations/circleci-integration.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
