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

예제 Dart 파이프라인

원문 보기 위키 갱신

예제 Dart 파이프라인 (Kubernetes) (Example Dart Pipeline)

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

출처: Drone CI Docs

본문

빌드와 테스트 (Build and Test)

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

kind: pipeline
type: kubernetes
name: default

steps:
- name: test
  image: google/dart
  commands:
  - pub get
  - pub run test

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

여러 버전에서 테스트하기 (Test Multiple Versions)

Drone의 멀티 파이프라인 기능을 사용하면 여러 버전의 Dart에 대해 동시에 테스트할 수 있습니다. 이는 다른 지속적 통합 시스템의 매트릭스(matrix) 기능과 동일합니다.

---
kind: pipeline
type: kubernetes
name: dart2

steps:
- name: test
  image: google/dart:2
  commands:
  - pub get
  - pub run test

---
kind: pipeline
type: kubernetes
name: dart1

steps:
- name: test
  image: google/dart:1
  commands:
  - pub get
  - pub run test

...

이 문법이 너무 장황하다고 느껴진다면 jsonnet 사용을 권장합니다. jsonnet이 낯설다면 관련 가이드를 읽어 보세요.

local Pipeline(name, image) = {
  kind: "pipeline",
  type: "kubernetes",
  name: name,
  steps: [
    {
      name: "test",
      image: image,
      commands: [
        "pub get",
        "pub run test"
      ]
    }
  ]
};

[
  Pipeline("dart1", "dart:2"),
  Pipeline("dart2", "dart:1"),
]

더 알아보기 (Learn more)