pcmt/.drone.yml

263 lines
5.4 KiB
YAML
Raw Permalink Normal View History

2023-04-12 22:49:10 +02:00
---
2023-05-20 20:15:57 +02:00
# Copyright 2023 wanderer <a_mirre at utb dot cz>
# SPDX-License-Identifier: AGPL-3.0-only
2023-04-12 22:49:10 +02:00
kind: pipeline
type: docker
name: test archlinux
platform:
os: linux
arch: amd64
2023-04-17 21:57:22 +02:00
node:
r: as
2023-04-12 22:49:10 +02:00
trigger:
branch: [development, "feature-**"]
event: push
environment:
CGO_ENABLED: 0
GOPATH: /go
2023-04-12 22:49:10 +02:00
steps:
- name: pull
image: docker.io/immawanderer/archlinux-go:linux-amd64
pull: always
depends_on: [clone]
commands:
- go version
- name: go mod tidy
image: docker.io/immawanderer/archlinux-go:linux-amd64
depends_on: [pull]
volumes:
- name: gopath
path: /go
commands:
- go mod tidy
- git diff-index HEAD :^package-lock.json
2023-04-12 22:49:10 +02:00
# run Go mod tidy prior to committing
- test -z "$(git diff-index HEAD :^package-lock.json)"
2023-04-12 22:49:10 +02:00
- name: go build
image: docker.io/immawanderer/archlinux-go:linux-amd64
depends_on: [go mod tidy]
2023-04-12 22:49:10 +02:00
volumes:
- name: gopath
path: /go
commands:
- pacman -Sy && pacman -S --noconfirm --needed npm icu
# generate frontend assets
- go generate -v .
2023-04-12 22:49:10 +02:00
- go build -v .
- name: go test
image: docker.io/immawanderer/archlinux-go:linux-amd64
2023-05-04 15:00:42 +02:00
depends_on: [pull]
2023-04-12 22:49:10 +02:00
volumes:
- name: gopath
path: /go
environment:
PCMT_HIBP_API_KEY:
from_secret: hibp_api_key
2023-04-12 22:49:10 +02:00
commands:
- go test -cover ./...
volumes:
- name: gopath
temp: {}
---
kind: pipeline
type: docker
name: test alpine
platform:
os: linux
arch: amd64
2023-04-17 21:57:22 +02:00
node:
r: as
2023-04-12 22:49:10 +02:00
trigger:
branch: [development, "feature-**"]
event: push
environment:
CGO_ENABLED: 0
steps:
- name: pull
image: docker.io/library/golang:1.20.6-alpine3.18
2023-04-12 22:49:10 +02:00
depends_on: [clone]
commands:
- go version
- name: go mod tidy
image: docker.io/library/golang:1.20.6-alpine3.18
2023-04-12 22:49:10 +02:00
depends_on: [pull]
volumes:
- name: gopath
path: /go
commands:
- go mod tidy
- apk update -q && apk add -q --no-cache git
- git diff-index HEAD :^package-lock.json
2023-04-12 22:49:10 +02:00
# run Go mod tidy prior to committing
- test -z "$(git diff-index HEAD :^package-lock.json)"
2023-04-12 22:49:10 +02:00
- name: go build
image: docker.io/library/golang:1.20.6-alpine3.18
depends_on: [go mod tidy]
2023-04-12 22:49:10 +02:00
volumes:
- name: gopath
path: /go
commands:
- apk update -q && apk add -q --no-cache npm
# generate frontend assets
- go generate -v .
2023-04-12 22:49:10 +02:00
- go build -v .
- name: go test
image: docker.io/library/golang:1.20.6-alpine3.18
2023-05-04 15:00:42 +02:00
depends_on: [pull]
2023-04-12 22:49:10 +02:00
volumes:
- name: gopath
path: /go
environment:
PCMT_HIBP_API_KEY:
from_secret: hibp_api_key
2023-04-12 22:49:10 +02:00
commands:
- go test -cover ./...
volumes:
- name: gopath
temp: {}
2023-04-19 23:05:30 +02:00
---
kind: pipeline
type: docker
name: golangci-lint|godocs
platform:
os: linux
arch: amd64
node:
r: as
steps:
- name: golangci-lint
image: docker.io/library/golang:1.20.6-alpine3.18
2023-04-19 23:05:30 +02:00
pull: always
environment:
CGO_ENABLED: 0
commands:
2023-07-19 21:33:49 +02:00
- go install -v github.com/golangci/golangci-lint/cmd/golangci-lint@v1.53.3
2023-04-19 23:05:30 +02:00
- golangci-lint version
- golangci-lint run -v --timeout 5m
- name: goreportcard refresh
2023-07-19 19:27:19 +02:00
image: docker.io/curlimages/curl:8.2.0
2023-04-19 23:05:30 +02:00
depends_on: [golangci-lint]
pull: if-not-exists
trigger:
ref:
include:
- "refs/tags/**"
- refs/heads/development
exclude:
- "refs/pull/**"
commands:
2023-08-08 15:33:12 +02:00
- curl --version && curl -sS -X POST -F \"repo=git.dotya.ml/${DRONE_REPO}\" https://goreportcard.com/checks -o /dev/null
2023-04-19 23:05:30 +02:00
- name: godocs refresh
2023-07-19 19:27:19 +02:00
image: docker.io/curlimages/curl:8.2.0
2023-04-19 23:05:30 +02:00
pull: if-not-exists
depends_on: [golangci-lint]
trigger:
ref:
include:
- "refs/tags/**"
- refs/heads/development
exclude: ["refs/pull/**"]
commands:
2023-08-08 15:33:12 +02:00
- curl --version && curl -sS -X POST https://godocs.io/git.dotya.ml/${DRONE_REPO}/refresh -o /dev/null
---
kind: pipeline
type: docker
name: container
platform:
os: linux
arch: amd64
node:
r: as
trigger:
event: [push, pull_request, cron, tag]
steps:
- name: hadolint
pull: always
image: ghcr.io/hadolint/hadolint:v2.12.0-alpine
commands:
- hadolint --version
- hadolint Containerfile
when:
ref:
- refs/heads/development
- "refs/heads/feature-**"
- "refs/pull/**"
- "refs/tags/**"
event:
exclude: [cron]
- name: kaniko-build
pull: always
image: docker.io/immawanderer/drone-kaniko:linux-amd64
settings:
dockerfile: Containerfile
context: .
args:
- BUILD_DATE="$(date -u +"%Y-%m-%dT%H:%M:%SZ")"
- VCS_REF=${DRONE_COMMIT_SHA:0:8}
when:
ref:
- "refs/heads/feature-**"
- "refs/pull/**"
event:
exclude: [cron]
- name: kaniko publish
pull: always
image: docker.io/plugins/kaniko:1.7.5-kaniko1.9.1
settings:
dockerfile: Containerfile
context: .
args:
- BUILD_DATE="$(date -u +"%Y-%m-%dT%H:%M:%SZ")"
- VCS_REF=${DRONE_COMMIT_SHA:0:8}
tags:
- latest
- linux-amd64
- ${DRONE_COMMIT_SHA:0:8}
- ${DRONE_TAG}
- ${DRONE_TAG}-linux-amd64
- ${DRONE_TAG}-g${DRONE_COMMIT_SHA:0:8}
repo: immawanderer/mt-${DRONE_REPO_NAME}
username: immawanderer
password:
from_secret: dh_token
when:
ref:
include:
- "refs/tags/**"
...