Crystalパイプラインの例

Updated 2 years ago by Admin

このガイドでは、Crystalプロジェクトの継続的インテグレーションパイプラインの構成について説明します。Droneを初めて使用する場合は、最初にチュートリアルとビルド構成ガイドをお読みください。


ビルドとテスト

以下の例は、shards installおよびcrystal specコマンドを実行するパイプラインです。これらのコマンドは、実行時にDockerHubからダウンロードされたcrystal Dockerコンテナ内で実行されます。

kind: pipeline
name: default

steps:
- name: test
image: crystallang/crystal
commands:
- shards install
- crystal spec

パイプラインでは、任意のDockerレジストリから任意のDockerイメージを使用できることに注意してください。公式のcrystal画像を使用することも、自分で持参することもできます。


複数のバージョンをテストする

Droneのマルチパイプライン機能を使用して、Crystalの複数のバージョンに対して同時にテストできます。これは、他の継続的インテグレーションシステムに見られるマトリックス機能と同等です。

---
kind: pipeline
name: nightly

steps:
- name: test
image: crystallang/crystal:nightly
pull: always
commands:
- shards install
- crystal spec

---
kind: pipeline
name: latest

steps:
- name: test
image: crystallang/crystal:latest
commands:
- shards install
- crystal spec

...

この構文が冗長すぎる場合は、jsonnetを使用することをお勧めします。 jsonnetに慣れていない場合は、ガイドをお読みください。

local Pipeline(name, image) = {
kind: "pipeline",
name: name,
steps: [
{
name: "test",
image: image,
commands: [
"shards install",
"crystal spec"
]
}
]
};

[
Pipeline("nightly", "crystal:nightly"),
Pipeline("latest", "crystal:latest"),
]


How did we do?