65 lines
1.5 KiB
YAML
65 lines
1.5 KiB
YAML
|
---
|
||
|
# ------------------------------------------------------------------------
|
||
|
# -- Unit tests should run on each commit
|
||
|
# ------------------------------------------------------------------------
|
||
|
kind: pipeline
|
||
|
type: docker
|
||
|
name: Run unit tests
|
||
|
|
||
|
trigger:
|
||
|
event:
|
||
|
- push
|
||
|
|
||
|
steps:
|
||
|
- name: Check formatting
|
||
|
image: registry.hub.docker.com/golangci/golangci-lint
|
||
|
commands:
|
||
|
- make lint
|
||
|
|
||
|
- name: Run unit tests
|
||
|
image: registry.hub.docker.com/library/golang
|
||
|
commands:
|
||
|
- make test
|
||
|
|
||
|
---
|
||
|
# ------------------------------------------------------------------------
|
||
|
# -- Build a container
|
||
|
# ------------------------------------------------------------------------
|
||
|
kind: pipeline
|
||
|
type: docker
|
||
|
name: Build a container
|
||
|
|
||
|
trigger:
|
||
|
event:
|
||
|
- push
|
||
|
|
||
|
steps:
|
||
|
- name: Build the builder image
|
||
|
image: alpine
|
||
|
privileged: true
|
||
|
environment:
|
||
|
GITEA_TOKEN:
|
||
|
from_secret: GITEA_TOKEN
|
||
|
BUILDAH_REG: git.badhouseplants.net/allanger/giops-builder
|
||
|
commands:
|
||
|
- ./build/build
|
||
|
|
||
|
- name: Cleanup the registry
|
||
|
image: git.badhouseplants.net/allanger/giops-builder:${DRONE_COMMIT_SHA}
|
||
|
privileged: true
|
||
|
environment:
|
||
|
GITEA_TOKEN:
|
||
|
from_secret: GITEA_TOKEN
|
||
|
GITEA_PACKAGE: giops-builder
|
||
|
commands:
|
||
|
- cleanup
|
||
|
|
||
|
- name: Build giops container and cleanuo the registry
|
||
|
image: git.badhouseplants.net/allanger/giops-builder:${DRONE_COMMIT_SHA}
|
||
|
privileged: true
|
||
|
environment:
|
||
|
GITEA_TOKEN:
|
||
|
from_secret: GITEA_TOKEN
|
||
|
commands:
|
||
|
- build-container
|
||
|
- cleanup
|