iwilldie/.drone.yml

98 lines
1.6 KiB
YAML
Raw Normal View History

2023-03-10 22:24:23 +01:00
kind: pipeline
type: docker
2023-03-10 22:24:23 +01:00
name: default
trigger:
branch:
2023-03-10 22:33:17 +01:00
- main
2023-03-10 22:24:23 +01:00
2023-03-10 23:37:17 +01:00
platform:
os: linux
arch: amd64
2023-03-10 22:24:23 +01:00
steps:
2023-03-10 23:37:17 +01:00
# Run go tests
- name: go-test
2023-03-10 22:24:23 +01:00
image: golang
volumes:
- name: deps
path: /go
commands:
- cd src
- go test
2023-03-10 23:37:17 +01:00
# Build go binaries
- name: go-build-bin-amd64
2023-03-10 22:24:23 +01:00
image: golang
volumes:
- name: deps
path: /go
- name: bin
path: /binaries
commands:
- cd src
- go build -o /binaries/app
2023-03-10 23:37:17 +01:00
depends_on:
- go-test
# Build Containers for each architecture
- name: docker-build-image-amd64
2023-03-10 23:53:49 +01:00
image: plugins/docker # Check Entrypoint
volumes:
2023-03-10 23:37:17 +01:00
- name: docker_socket
path: /var/run/docker.sock
2023-03-10 23:59:46 +01:00
- name: bin
path: /binaries
2023-03-10 23:37:17 +01:00
privileged: true
2023-03-11 00:10:54 +01:00
commands:
- pwd
- ls
- echo "ls .."
- ls ..
- echo "ls /binaries/"
- ls /binaries/
- echo "ls /"
- ls /
2023-03-10 23:37:17 +01:00
settings:
username:
from_secret: gitea_username
password:
from_secret: gitea_password
repo: gitea.voser.cloud/container/iwilldie
registry: https://gitea.voser.cloud
tags:
- ${DRONE_COMMIT_BRANCH}
- latest
platforms: linux/amd64
2023-03-11 00:07:44 +01:00
context: ./Docker
dockerfile: ./Dockerfile
2023-03-10 23:37:17 +01:00
depends_on:
- "go-build-bin-amd64"
2023-03-10 23:53:02 +01:00
# Run go tests
- name: binary-cleanup
image: alpine:latest
volumes:
- name: bin
path: /binaries
commands:
- rm -rf /binaries/*
when:
status:
- failure
- success
2023-03-10 23:56:17 +01:00
depends_on:
- "go-build-bin-amd64"
- docker-build-image-amd64
2023-03-10 23:53:02 +01:00
2023-03-10 23:37:17 +01:00
# Volumes to mount between steps
2023-03-10 22:24:23 +01:00
volumes:
- name: deps
temp: {}
- name: bin
2023-03-10 23:58:23 +01:00
temp: {}
2023-03-10 23:40:10 +01:00
- name: docker_socket
host:
path: /var/run/docker.sock