arkisto/.drone.yml
Glenn Y. Rolland 758a535320
Some checks reported errors
continuous-integration/drone/push Build was killed
ci: Speed up build with cache
2022-08-19 11:36:24 +02:00

90 lines
1.7 KiB
YAML

---
kind: pipeline
type: docker
name: "stage:build"
services:
- name: docker
image: docker:dind
privileged: true
volumes:
- name: dockersock
path: /var/run
steps:
- name: "build:prepare"
image: busybox
commands:
# Debug
- pwd
- mkdir -p _artifacts _cache
- name: "build:executable"
image: crystallang/crystal:1.5.0
volumes:
- name: crystal_cache
path: /drone/src/_cache
commands:
# Debug
- pwd
- crystal version
- shards version
# Build
- make build
- name: "build:docker-image"
image: docker:20.10.16-dind
volumes:
- name: dockersock
path: /var/run
- name: docker_cache
path: /drone/src/_cache
commands:
# Prepare
- apk add make
- test -f _cache/docker-image.tar && docker load < _cache/docker-image.tar
# Build
- make docker-build
- make docker-save > _artifacts/docker-image.tar
- make docker-save > _cache/docker-image.tar
volumes:
- name: crystal_cache
temp: {}
- name: docker_cache
temp: {}
- name: dockersock
temp: {}
#
---
kind: pipeline
type: docker
name: "stage:publish"
depends_on:
- "stage:build"
services:
- name: docker
image: docker:dind
privileged: true
volumes:
- name: dockersock
path: /var/run
steps:
- name: "publish:docker-image"
image: docker:20.10.16-dind
volumes:
- name: dockersock
path: /var/run
commands:
- test -f _artifacts/docker-image.tar
- apk install make
- make docker-load < _artifacts/docker-image.tar
- make docker-push
volumes:
- name: dockersock
temp: {}