Haxeパイプラインの例
このガイドでは、Haxeプロジェクトの継続的インテグレーションパイプラインの構成について説明します。Droneを初めて使用する場合は、最初にチュートリアルとビルド構成ガイドをお読みください。
ビルドとテスト
以下の例では、npm install
とnpm test
コマンドを実行するパイプラインを示しています。これらのコマンドは、実行時にDockerHubからダウンロードされたhaxe Dockerコンテナ内で実行されます。
kind: pipeline
name: default
steps:
- name: test
image: haxe
commands:
- haxelib install build.hxml
- haxe build.hxml
パイプラインでは、任意のDockerレジストリから任意のDockerイメージを使用できることに注意してください。公式のhaxe画像を使用することも、自分で持参することもできます。
複数のバージョンをテストする
Droneのマルチパイプライン機能を使用して、Haxeの複数のバージョンに対して同時にテストできます。これは、他の継続的インテグレーションシステムに見られるマトリックス機能と同等です。
---
kind: pipeline
name: haxe4
steps:
- name: test
image: haxe:4.0
commands:
- haxelib install build.hxml
- haxe build.hxml
---
kind: pipeline
name: haxe3
steps:
- name: test
image: haxe:4.0
commands:
- haxelib install build.hxml
- haxe build.hxml
...
この構文が冗長すぎる場合は、jsonnetを使用することをお勧めします。 jsonnetに慣れていない場合は、ガイドをお読みください。
local Pipeline(name, image) = {
kind: "pipeline",
name: name,
steps: [
{
name: "test",
image: image,
commands: [
"haxelib install build.hxml",
"haxe build.hxml"
]
}
]
};
[
Pipeline("haxe4", "haxe:4.0"),
Pipeline("haxe3", "haxe:3.0"),
]
複数のアーキテクチャをテストする
Droneのマルチパイプライン機能を使用して、複数のアーキテクチャとオペレーティングシステムでコードを同時にテストできます。
---
kind: pipeline
name: test-on-amd64
platform:
arch: amd64
steps:
- name: test
image: haxe
commands:
- haxelib install build.hxml
- haxe build.hxml
---
kind: pipeline
name: test-on-amd64
platform:
arch: amd64
steps:
- name: test
image: haxe
commands:
- haxelib install build.hxml
- haxe build.hxml
---
kind: pipeline
name: test-on-arm64
platform:
arch: arm64
steps:
- name: test
image: haxe
commands:
- haxelib install build.hxml
- haxe build.hxml
...
この構文が冗長すぎる場合は、jsonnetを使用することをお勧めします。 jsonnetに慣れていない場合は、ガイドをお読みください。