본문으로 바로가기 본문 바로가기
WIKI 기술 지식 베이스

예제 C++ 파이프라인

원문 보기 위키 갱신

예제 C++ 파이프라인 (Docker) (Example C++ Pipeline)

C++ 프로젝트를 위한 지속적 통합(CI) 파이프라인 구성 방법을 안내합니다. Drone이 처음이라면 먼저 튜토리얼과 빌드 구성 가이드를 읽어 보세요.

출처: Drone CI Docs

본문

빌드와 테스트 (Build and Test)

아래 예제는 make와 make test 명령어를 실행하는 파이프라인을 보여줍니다. 이 명령어들은 실행 시점에 DockerHub에서 내려받은 gcc Docker 컨테이너 안에서 실행됩니다.

kind: pipeline
name: default

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

파이프라인에서는 어떤 Docker 레지스트리의 어떤 Docker 이미지든 사용할 수 있습니다. 공식 gcc 이미지를 사용해도 되고, 직접 만든 이미지를 가져와도 됩니다.

여러 아키텍처에서 테스트하기 (Test Multiple Architectures)

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"),
]

더 알아보기 (Learn more)