-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from jdbaldry/release
feat: Add CI
- Loading branch information
Showing
32 changed files
with
804 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
package drone | ||
|
||
let pipeline = { | ||
kind: "pipeline" | ||
platform: {os: "linux", arch: "amd64"} | ||
} | ||
|
||
let build_image = "jdbgrafana/haproxy-mixin-build-image:0.0.2" | ||
|
||
let step = { | ||
check_artifacts: { | ||
name: "check artifacts" | ||
image: build_image | ||
commands: [ | ||
"make build", | ||
"git diff --exit-code", | ||
] | ||
} | ||
} | ||
|
||
pipelines: [ | ||
pipeline & { | ||
name: "pr" | ||
steps: [ | ||
{ | ||
name: "check .drone/drone.yml" | ||
image: build_image | ||
commands: [ | ||
"make .drone/drone.yml", | ||
"git diff --exit-code -- .drone/drone.yml", | ||
] | ||
}, | ||
{ | ||
name: "check formatting" | ||
image: build_image | ||
commands: [ | ||
"make fmt", | ||
"git diff --exit-code", | ||
] | ||
}, | ||
step.check_artifacts, | ||
{ | ||
name: "lint mixin" | ||
image: build_image | ||
commands: [ | ||
"make lint", | ||
] | ||
}, | ||
] | ||
trigger: event: include: ["pull_request"] | ||
}, | ||
pipeline & { | ||
name: "default" | ||
steps: [ | ||
{ | ||
name: "fmt" | ||
image: build_image | ||
commands: [ | ||
"make fmt", | ||
] | ||
}, | ||
{ | ||
name: ".drone/drone.yml" | ||
image: build_image | ||
commands: [ | ||
"make .drone/drone.yml", | ||
] | ||
}, | ||
{ | ||
name: "build" | ||
image: build_image | ||
commands: [ | ||
"make build", | ||
] | ||
}, | ||
{ | ||
name: "lint" | ||
image: build_image | ||
commands: [ | ||
"make lint", | ||
] | ||
}, | ||
] | ||
trigger: event: include: ["custom"] | ||
}, | ||
pipeline & { | ||
name: "release" | ||
steps: [ | ||
step.check_artifacts, | ||
{ | ||
name: "make dist/haproxy-mixin.tar.gz" | ||
image: build_image | ||
commands: [ | ||
"make dist/haproxy-mixin.tar.gz", | ||
] | ||
}, | ||
{ | ||
name: "publish" | ||
image: "plugins/github-release" | ||
settings: { | ||
api_key: from_secret: "github_token" | ||
files: "dist/*" | ||
} | ||
}, | ||
] | ||
trigger: event: include: ["tag"] | ||
}, | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
name: pr | ||
kind: pipeline | ||
platform: | ||
os: linux | ||
arch: amd64 | ||
steps: | ||
- name: check .drone/drone.yml | ||
image: jdbgrafana/haproxy-mixin-build-image:0.0.2 | ||
commands: | ||
- make .drone/drone.yml | ||
- git diff --exit-code -- .drone/drone.yml | ||
- name: check formatting | ||
image: jdbgrafana/haproxy-mixin-build-image:0.0.2 | ||
commands: | ||
- make fmt | ||
- git diff --exit-code | ||
- name: check artifacts | ||
image: jdbgrafana/haproxy-mixin-build-image:0.0.2 | ||
commands: | ||
- make build | ||
- git diff --exit-code | ||
- name: lint mixin | ||
image: jdbgrafana/haproxy-mixin-build-image:0.0.2 | ||
commands: | ||
- make lint | ||
trigger: | ||
event: | ||
include: | ||
- pull_request | ||
--- | ||
name: default | ||
kind: pipeline | ||
platform: | ||
os: linux | ||
arch: amd64 | ||
steps: | ||
- name: fmt | ||
image: jdbgrafana/haproxy-mixin-build-image:0.0.2 | ||
commands: | ||
- make fmt | ||
- name: .drone/drone.yml | ||
image: jdbgrafana/haproxy-mixin-build-image:0.0.2 | ||
commands: | ||
- make .drone/drone.yml | ||
- name: build | ||
image: jdbgrafana/haproxy-mixin-build-image:0.0.2 | ||
commands: | ||
- make build | ||
- name: lint | ||
image: jdbgrafana/haproxy-mixin-build-image:0.0.2 | ||
commands: | ||
- make lint | ||
trigger: | ||
event: | ||
include: | ||
- custom | ||
--- | ||
name: release | ||
kind: pipeline | ||
platform: | ||
os: linux | ||
arch: amd64 | ||
steps: | ||
- name: check artifacts | ||
image: jdbgrafana/haproxy-mixin-build-image:0.0.2 | ||
commands: | ||
- make build | ||
- git diff --exit-code | ||
- name: make dist/haproxy-mixin.tar.gz | ||
image: jdbgrafana/haproxy-mixin-build-image:0.0.2 | ||
commands: | ||
- make dist/haproxy-mixin.tar.gz | ||
- name: publish | ||
image: plugins/github-release | ||
settings: | ||
files: dist/* | ||
api_key: | ||
from_secret: github_token | ||
trigger: | ||
event: | ||
include: | ||
- tag | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package drone | ||
|
||
import ( | ||
"encoding/yaml" | ||
"tool/cli" | ||
) | ||
|
||
command: dump: { | ||
task: print: cli.Print & { | ||
text: yaml.MarshalStream(pipelines) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
if command -v lorri >/dev/null; then | ||
eval "$(lorri direnv)" | ||
fi | ||
|
||
export PROMETHEUS_PORT=9091 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/result | ||
/dist/haproxy-mixin.tar.gz |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
let | ||
common = import ./common.nix; | ||
sources = import ./nix/sources.nix; | ||
pkgs = import sources.nixpkgs { }; | ||
in pkgs.dockerTools.buildImage { | ||
name = "jdbgrafana/haproxy-mixin-build-image"; | ||
created = "now"; | ||
tag = "0.0.1"; | ||
contents = common.buildTools; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
let | ||
sources = import ./nix/sources.nix; | ||
pkgs = import sources.nixpkgs { | ||
overlays = [ | ||
(self: super: | ||
let inherit (super) callPackage; | ||
in { | ||
jsonnet-bundler = callPackage ./nix/jsonnet-bundler.nix { }; | ||
mixtool = callPackage ./nix/mixtool.nix { }; | ||
}) | ||
]; | ||
}; | ||
in { | ||
# devTools are packages specifically for development environments. | ||
devTools = [ pkgs.docker pkgs.docker-compose ]; | ||
# buildTools are packages needed for dev and CI builds. | ||
buildTools = [ | ||
pkgs.bash | ||
pkgs.coreutils | ||
pkgs.cue | ||
pkgs.drone-cli | ||
pkgs.git | ||
pkgs.gnumake | ||
pkgs.gnutar | ||
pkgs.jsonnet | ||
pkgs.jsonnet-bundler | ||
pkgs.mixtool | ||
]; | ||
} |
14 changes: 14 additions & 0 deletions
14
cue.mod/gen/github.com/drone/drone-yaml/yaml/build_go_gen.cue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Code generated by cue get go. DO NOT EDIT. | ||
|
||
//cue:generate cue get go github.com/drone/drone-yaml/yaml | ||
|
||
package yaml | ||
|
||
#Build: { | ||
args?: {[string]: string} @go(Args,map[string]string) | ||
cache_from?: [...string] @go(CacheFrom,[]string) | ||
context?: string @go(Context) | ||
dockerfile?: string @go(Dockerfile) | ||
image?: string @go(Image) | ||
labels?: {[string]: string} @go(Labels,map[string]string) | ||
} |
26 changes: 26 additions & 0 deletions
26
cue.mod/gen/github.com/drone/drone-yaml/yaml/cond_go_gen.cue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Code generated by cue get go. DO NOT EDIT. | ||
|
||
//cue:generate cue get go github.com/drone/drone-yaml/yaml | ||
|
||
package yaml | ||
|
||
// Conditions defines a group of conditions. | ||
#Conditions: { | ||
action?: #Condition @go(Action) | ||
cron?: #Condition @go(Cron) | ||
ref?: #Condition @go(Ref) | ||
repo?: #Condition @go(Repo) | ||
instance?: #Condition @go(Instance) | ||
target?: #Condition @go(Target) | ||
event?: #Condition @go(Event) | ||
branch?: #Condition @go(Branch) | ||
status?: #Condition @go(Status) | ||
paths?: #Condition @go(Paths) | ||
matrix?: {[string]: string} @go(Matrix,map[string]string) | ||
} | ||
|
||
// Condition defines a runtime condition. | ||
#Condition: { | ||
include?: [...string] @go(Include,[]string) | ||
exclude?: [...string] @go(Exclude,[]string) | ||
} |
23 changes: 23 additions & 0 deletions
23
cue.mod/gen/github.com/drone/drone-yaml/yaml/cron_go_gen.cue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Code generated by cue get go. DO NOT EDIT. | ||
|
||
//cue:generate cue get go github.com/drone/drone-yaml/yaml | ||
|
||
package yaml | ||
|
||
#Cron: { | ||
version?: string @go(Version) | ||
kind?: string @go(Kind) | ||
type?: string @go(Type) | ||
name?: string @go(Name) | ||
spec?: #CronSpec @go(Spec) | ||
} | ||
|
||
#CronSpec: { | ||
schedule?: string @go(Schedule) | ||
branch?: string @go(Branch) | ||
deployment?: #CronDeployment @go(Deploy) | ||
} | ||
|
||
#CronDeployment: { | ||
target?: string @go(Target) | ||
} |
10 changes: 10 additions & 0 deletions
10
cue.mod/gen/github.com/drone/drone-yaml/yaml/env_go_gen.cue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// Code generated by cue get go. DO NOT EDIT. | ||
|
||
//cue:generate cue get go github.com/drone/drone-yaml/yaml | ||
|
||
package yaml | ||
|
||
#Variable: { | ||
value?: string @go(Value) | ||
from_secret?: string @go(Secret) | ||
} |
23 changes: 23 additions & 0 deletions
23
cue.mod/gen/github.com/drone/drone-yaml/yaml/manifest_go_gen.cue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// Code generated by cue get go. DO NOT EDIT. | ||
|
||
//cue:generate cue get go github.com/drone/drone-yaml/yaml | ||
|
||
package yaml | ||
|
||
#KindCron: "cron" | ||
#KindPipeline: "pipeline" | ||
#KindRegistry: "registry" | ||
#KindSecret: "secret" | ||
#KindSignature: "signature" | ||
|
||
#Manifest: { | ||
Resources: [...#Resource] @go(,[]Resource) | ||
} | ||
|
||
#Resource: _ | ||
|
||
#RawResource: { | ||
Version: string | ||
Kind: string | ||
Type: string | ||
} |
10 changes: 10 additions & 0 deletions
10
cue.mod/gen/github.com/drone/drone-yaml/yaml/param_go_gen.cue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// Code generated by cue get go. DO NOT EDIT. | ||
|
||
//cue:generate cue get go github.com/drone/drone-yaml/yaml | ||
|
||
package yaml | ||
|
||
#Parameter: { | ||
value?: _ @go(Value,interface{}) | ||
from_secret?: string @go(Secret) | ||
} |
Oops, something went wrong.