Crystal 파이프라인 예제
Crystal 파이프라인 예제 (Kubernetes)
이 가이드는 Crystal 프로젝트를 위한 지속적 통합(CI) 파이프라인 설정 방법을 다룹니다. Drone이 처음이라면 먼저 튜토리얼과 빌드 설정 가이드를 읽어 보세요.
출처: Drone CI Docs
본문
빌드와 테스트
아래 예제는 shards install과 crystal spec 명령을 실행하는 파이프라인을 보여줘요. 이 명령들은 crystal Docker 컨테이너 안에서 실행되며, 컨테이너는 실행 시점에 DockerHub에서 내려받습니다.
kind: pipeline
type: kubernetes
name: default
steps:
- name: test
image: crystallang/crystal
commands:
- shards install
- crystal spec
파이프라인에서는 어떤 Docker 레지스트리의 어떤 Docker 이미지든 사용할 수 있다는 점에 유의하세요. 공식 crystal 이미지를 쓸 수도 있고, 직접 만든 이미지를 가져올 수도 있습니다.
여러 버전 테스트
Drone의 멀티 파이프라인 기능을 사용하면 여러 Crystal 버전에 대해 동시에 테스트할 수 있어요. 다른 지속적 통합 시스템의 매트릭스(matrix) 기능과 동일한 역할을 합니다.
---
kind: pipeline
type: kubernetes
name: nightly
steps:
- name: test
image: crystallang/crystal:nightly
pull: always
commands:
- shards install
- crystal spec
---
kind: pipeline
type: kubernetes
name: latest
steps:
- name: test
image: crystallang/crystal:latest
commands:
- shards install
- crystal spec
...
이 문법이 너무 장황하다고 느껴진다면 jsonnet 사용을 추천합니다. jsonnet이 익숙하지 않다면 가이드를 읽어 보세요.
local Pipeline(name, image) = {
kind: "pipeline",
type: "kubernetes",
name: name,
steps: [
{
name: "test",
image: image,
commands: [
"shards install",
"crystal spec"
]
}
]
};
[
Pipeline("nightly", "crystal:nightly"),
Pipeline("latest", "crystal:latest"),
]