Cパイプラインの例

Updated 2 years ago by Admin

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


ビルドとテスト

以下の例では、 makeおよびmake testコマンドを実行するパイプラインを示しています。これらのコマンドは、実行時にDockerHubからダウンロードされたgcc Dockerコンテナ内で実行されます。

kind: pipeline
name: default

steps:
- name: test
image: gcc
commands:
- ./configure
- make
- make test

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


複数のアーキテクチャをテストする

Droneのマルチパイプライン機能を使用して、複数のアーキテクチャとオペレーティングシステムでコードを同時にテストできます。

---
kind: pipeline
name: test-on-amd64

platform:
arch: amd64

steps:
- name: test
image: gcc
commands:
- ./configure
- make
- make test

---
kind: pipeline
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",
name: "test-on-"+arch,
platform: {
arch: arch,
}
steps: [
{
name: "test",
image: "gcc",
commands: [
"./configure",
"make",
"make test"
]
}
]
};

[
Pipeline("arm"),
Pipeline("arm64"),
Pipeline("amd64"),
]


How did we do?