Skip to content

Commit

Permalink
Merge pull request #4 from sdboyer/droneci
Browse files Browse the repository at this point in the history
chore: setup ci
  • Loading branch information
sdboyer authored Mar 10, 2021
2 parents 3851b37 + 04d0495 commit f45c351
Show file tree
Hide file tree
Showing 4 changed files with 90 additions and 1 deletion.
25 changes: 25 additions & 0 deletions .drone/drone.cue
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
kind: "pipeline"
name: "default"

#Step: {
name: string,
commands: [string],
image: string | *"golang:1.16",
volumes: [{name: "gopath", path: "/go"}],
...
}

steps: [...#Step]
steps: [{
name: "download",
commands: ["go mod download"],
}, {
name: "lint",
commands: ["make lint"],
depends_on: ["download"],
}, {
name: "test",
commands: ["make test"],
depends_on: ["download"],
},
]
38 changes: 38 additions & 0 deletions .drone/drone.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
kind: pipeline
name: default

platform:
os: linux
arch: amd64

steps:
- name: download
image: golang:1.16
commands:
- go mod download
volumes:
- name: gopath
path: /go

- name: lint
image: golang:1.16
commands:
- make lint
volumes:
- name: gopath
path: /go
depends_on:
- download

- name: test
image: golang:1.16
commands:
- make test
volumes:
- name: gopath
path: /go
depends_on:
- download

...
26 changes: 26 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
.PHONY: lint test static install uninstall cross
VERSION := $(shell git describe --tags --dirty --always)
BIN_DIR := $(GOPATH)/bin

lint:
test -z $$(gofmt -s -l .)
go vet ./...

test:
go test ./...

# Compilation
LDFLAGS := '-s -w -extldflags "-static"'
static:
CGO_ENABLED=0 go build -ldflags=${LDFLAGS} ./cmd/cuetsy

install:
CGO_ENABLED=0 go install -ldflags=${LDFLAGS} ./cmd/cuetsy

uninstall:
go clean -i ./cmd/cuetsy

# CI
drone:
cue export ./.drone/drone.cue > .drone/drone.yml
drone fmt --save .drone/drone.yml
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/sdboyer/cuetsy

go 1.15
go 1.16

require (
cuelang.org/go v0.3.0-beta.3.0.20210129164451-9b7fc4b5acd1
Expand Down

0 comments on commit f45c351

Please sign in to comment.