59 lines
1.1 KiB
YAML
59 lines
1.1 KiB
YAML
|
pipeline:
|
||
|
backend-lint:
|
||
|
image: golang:1.21
|
||
|
group: lint
|
||
|
commands:
|
||
|
- go vet ./...
|
||
|
- go fmt ./...
|
||
|
|
||
|
frontend-lint:
|
||
|
image: node:20
|
||
|
group: lint
|
||
|
commands:
|
||
|
- cd web
|
||
|
- npm ci
|
||
|
- npm run lint
|
||
|
|
||
|
frontend-build:
|
||
|
image: node:20
|
||
|
commands:
|
||
|
- cd web
|
||
|
- npm ci
|
||
|
- npm run build
|
||
|
when:
|
||
|
status: [success]
|
||
|
|
||
|
backend-build:
|
||
|
image: golang:1.21
|
||
|
commands:
|
||
|
- go mod download
|
||
|
- go generate ./...
|
||
|
# Build with embedded frontend
|
||
|
- go build -o inventory -ldflags="-s -w" .
|
||
|
when:
|
||
|
status: [success]
|
||
|
|
||
|
# Create artifacts
|
||
|
artifacts:
|
||
|
image: alpine:latest
|
||
|
commands:
|
||
|
- mkdir -p artifacts
|
||
|
- cp inventory artifacts/
|
||
|
- tar -czvf artifacts/inventory.tar.gz inventory
|
||
|
when:
|
||
|
status: [success]
|
||
|
|
||
|
# Optional step for creating a Docker image
|
||
|
docker-build:
|
||
|
image: plugins/docker
|
||
|
settings:
|
||
|
repo: ${DRONE_REPO_OWNER}/inventory
|
||
|
tags:
|
||
|
- latest
|
||
|
- ${DRONE_TAG##v}
|
||
|
dockerfile: Dockerfile
|
||
|
when:
|
||
|
branch: main
|
||
|
event: [push, tag]
|
||
|
status: [success]
|