예제 Crystal 파이프라인
예제 Crystal 파이프라인 (Docker) (Example Crystal Pipeline)
Crystal 프로젝트를 위한 지속적 통합(CI) 파이프라인 구성 방법을 안내합니다. Drone이 처음이라면 먼저 튜토리얼과 빌드 구성 가이드를 읽어 보세요.
출처: Drone CI Docs
본문
빌드와 테스트 (Build and Test)
아래 예제는 shards install과 crystal spec 명령어를 실행하는 파이프라인을 보여줍니다. 이 명령어들은 실행 시점에 DockerHub에서 내려받은 crystal Docker 컨테이너 안에서 실행됩니다.
kind: pipeline
name: default
steps:
- name: test
image: crystallang/crystal
commands:
- shards install
- crystal spec
파이프라인에서는 어떤 Docker 레지스트리의 어떤 Docker 이미지든 사용할 수 있습니다. 공식 crystal 이미지를 사용해도 되고, 직접 만든 이미지를 가져와도 됩니다.
여러 버전에서 테스트하기 (Test Multiple Versions)
Drone의 멀티 파이프라인 기능을 사용하면 여러 버전의 Crystal에 대해 동시에 테스트할 수 있습니다. 이는 다른 지속적 통합 시스템의 매트릭스(matrix) 기능과 동일합니다.
---
kind: pipeline
name: nightly
steps:
- name: test
image: crystallang/crystal:nightly
pull: always
commands:
- shards install
- crystal spec
---
kind: pipeline
name: latest
steps:
- name: test
image: crystallang/crystal:latest
commands:
- shards install
- crystal spec
...
이 문법이 너무 장황하다고 느껴진다면 jsonnet 사용을 권장합니다. jsonnet이 낯설다면 관련 가이드를 읽어 보세요.
local Pipeline(name, image) = {
kind: "pipeline",
name: name,
steps: [
{
name: "test",
image: image,
commands: [
"shards install",
"crystal spec"
]
}
]
};
[
Pipeline("nightly", "crystal:nightly"),
Pipeline("latest", "crystal:latest"),
]
더 알아보기 (Learn more)
- Example Crystal Pipeline — Docker 러너용 Crystal 파이프라인 예제
- Multi-Pipeline — 여러 파이프라인을 동시에 실행하기
- Jsonnet — jsonnet으로 파이프라인 구성하기