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