1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

ローカルでCircleCIを使う

Last updated at Posted at 2022-01-23

はじめに

この記事は、CircleCIをローカルで動かすために行なったことを記事にしています。間違っている箇所などがございましたら、指摘していただけると幸いです。

前提

  • Mac
  • Docker導入済み
  • GitHubのアカウント作成済み

homebrewでインストール

homebrewを使用している場合は、以下のコマンドを使用して CLI をインストールできる。

brew install circleci

CLI の構成

パーソナルAPIトークンタブにアクセスをして、「Create New Token」をクリックして、トークンを発行します。

スクリーンショット 2022-01-23 16.39.49.png

スクリーンショット 2022-01-23 16.41.15.png

自分の好きな名前で「Add API Token」をクリックします。

3yyjo9tnzs83vzku9w4j9ji5hltt.jpeg

トークンをコピーします。

トークンの設定

circleci setup

上記コマンドを実行したら、先ほど取得したトークンを入力します。
次にCircleCIを使用するホストを聞かれるので、そのままEnterでOKです。
ホストはデフォルトで設定されています。(https://circleci.com)

? CircleCI API Token ****************************************
API token has been set.
? CircleCI Host https://circleci.com
CircleCI host has been set.
Setup complete.
Your configuration has been saved to /Users/name/.circleci/cli.yml.

Trying an introspection query on API to verify your setup... Ok.
Trying to query our API for your profile name... Hello, name.

これで設定は完了しました。

実際にローカルで動かしてみる

設定ファイルのバリデーション

設定ファイルをバリデーションするには、.circleci/config.yml ファイルがあるディレクトリに移動し、以下を実行します。

circleci config validate

ジョブを実行する

※CircleCI の設定ファイルをバージョン 2.1 以上に設定している場合、ジョブを実行するには、設定ファイルを process.yml にエクスポートしてから、そのファイルを指定する必要があります。

circleci config process .circleci/config.yml > process.yml

エクスポートが完了したら、下記コマンドでジョブを実行します。

circleci local execute -c process.yml --job JOB_NAME

参考

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?