Skip to content

Commit 1bfd1ce

Browse files
committed
Applied default structure and added some sugar
1 parent 136aea7 commit 1bfd1ce

18 files changed

+755
-110
lines changed

.appveyor.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
version: '{build}'
2+
image: 'Visual Studio 2017'
3+
platform: x64
4+
5+
clone_folder: 'c:\go\src\github.com\drone-plugins\drone-matrix'
6+
max_jobs: 1
7+
8+
environment:
9+
DOCKER_USERNAME:
10+
secure: '4YzzahbEiMZQJpOCOd1LAw=='
11+
DOCKER_PASSWORD:
12+
secure: 'VqO/G3Zfslu6zSLdwHKO+Q=='
13+
14+
install:
15+
- ps: |
16+
docker version
17+
go version
18+
19+
build_script:
20+
- ps: |
21+
if ( $env:APPVEYOR_REPO_TAG -eq 'false' ) {
22+
go build -ldflags "-X main.build=$env:APPVEYOR_BUILD_VERSION" -a -o drone-matrix.exe
23+
} else {
24+
$version = $env:APPVEYOR_REPO_TAG_NAME.substring(1)
25+
go build -ldflags "-X main.version=$version -X main.build=$env:APPVEYOR_BUILD_VERSION" -a -o drone-matrix.exe
26+
}
27+
28+
docker pull microsoft/nanoserver:10.0.14393.1593
29+
docker build -f Dockerfile.windows -t plugins/matrix:windows .
30+
31+
test_script:
32+
- ps: |
33+
docker run --rm plugins/matrix:windows --version
34+
35+
deploy_script:
36+
- ps: |
37+
$ErrorActionPreference = 'Stop';
38+
39+
if ( $env:APPVEYOR_PULL_REQUEST_NUMBER ) {
40+
Write-Host Nothing to deploy.
41+
} else {
42+
docker login --username $env:DOCKER_USERNAME --password $env:DOCKER_PASSWORD
43+
44+
if ( $env:APPVEYOR_REPO_TAG -eq 'true' ) {
45+
$major,$minor,$patch = $env:APPVEYOR_REPO_TAG_NAME.substring(1).split('.')
46+
47+
docker push plugins/matrix:windows
48+
49+
docker tag plugins/matrix:windows plugins/matrix:$major.$minor.$patch-windows
50+
docker push plugins/matrix:$major.$minor.$patch-windows
51+
52+
docker tag plugins/matrix:windows plugins/matrix:$major.$minor-windows
53+
docker push plugins/matrix:$major.$minor-windows
54+
55+
docker tag plugins/matrix:windows plugins/matrix:$major-windows
56+
docker push plugins/matrix:$major-windows
57+
} else {
58+
if ( $env:APPVEYOR_REPO_BRANCH -eq 'master' ) {
59+
docker push plugins/matrix:windows
60+
}
61+
}
62+
}

.dockerignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*
2+
!release/

.drone.yml

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
workspace:
2+
base: /go
3+
path: src/github.com/drone-plugins/drone-matrix
4+
5+
pipeline:
6+
test:
7+
image: golang:1.9
8+
pull: true
9+
commands:
10+
- go vet
11+
- |
12+
for PKG in $(go list ./... | grep -v /vendor/); do
13+
go test -cover -coverprofile $PKG/coverage.out $PKG
14+
done
15+
16+
build_linux_amd64:
17+
image: golang:1.9
18+
pull: true
19+
group: build
20+
environment:
21+
- GOOS=linux
22+
- GOARCH=amd64
23+
- CGO_ENABLED=0
24+
commands:
25+
- |
26+
if test "${DRONE_TAG}" = ""; then
27+
go build -v -ldflags "-X main.build=${DRONE_BUILD_NUMBER}" -a -o release/linux/amd64/drone-matrix
28+
else
29+
go build -v -ldflags "-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}" -a -o release/linux/amd64/drone-matrix
30+
fi
31+
32+
build_linux_i386:
33+
image: golang:1.9
34+
pull: true
35+
group: build
36+
environment:
37+
- GOOS=linux
38+
- GOARCH=386
39+
- CGO_ENABLED=0
40+
commands:
41+
- |
42+
if test "${DRONE_TAG}" = ""; then
43+
go build -v -ldflags "-X main.build=${DRONE_BUILD_NUMBER}" -a -o release/linux/i386/drone-matrix
44+
else
45+
go build -v -ldflags "-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}" -a -o release/linux/i386/drone-matrix
46+
fi
47+
48+
build_linux_arm64:
49+
image: golang:1.9
50+
pull: true
51+
group: build
52+
environment:
53+
- GOOS=linux
54+
- GOARCH=arm64
55+
- CGO_ENABLED=0
56+
commands:
57+
- |
58+
if test "${DRONE_TAG}" = ""; then
59+
go build -v -ldflags "-X main.build=${DRONE_BUILD_NUMBER}" -a -o release/linux/arm64/drone-matrix
60+
else
61+
go build -v -ldflags "-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}" -a -o release/linux/arm64/drone-matrix
62+
fi
63+
64+
build_linux_arm:
65+
image: golang:1.9
66+
pull: true
67+
group: build
68+
environment:
69+
- GOOS=linux
70+
- GOARCH=arm
71+
- CGO_ENABLED=0
72+
- GOARM=7
73+
commands:
74+
- |
75+
if test "${DRONE_TAG}" = ""; then
76+
go build -v -ldflags "-X main.build=${DRONE_BUILD_NUMBER}" -a -o release/linux/arm/drone-matrix
77+
else
78+
go build -v -ldflags "-X main.version=${DRONE_TAG##v} -X main.build=${DRONE_BUILD_NUMBER}" -a -o release/linux/arm/drone-matrix
79+
fi
80+
81+
publish_linux_amd64:
82+
image: plugins/docker:17.05
83+
pull: true
84+
secrets: [ docker_username, docker_password ]
85+
group: docker
86+
repo: plugins/matrix
87+
auto_tag: true
88+
dockerfile: Dockerfile
89+
when:
90+
event: [ push, tag ]
91+
92+
publish_linux_i386:
93+
image: plugins/docker:17.05
94+
pull: true
95+
secrets: [ docker_username, docker_password ]
96+
group: docker
97+
repo: plugins/matrix
98+
auto_tag: true
99+
auto_tag_suffix: i386
100+
dockerfile: Dockerfile.i386
101+
when:
102+
event: [ push, tag ]
103+
104+
publish_linux_arm64:
105+
image: plugins/docker:17.05
106+
pull: true
107+
secrets: [ docker_username, docker_password ]
108+
group: docker
109+
repo: plugins/matrix
110+
auto_tag: true
111+
auto_tag_suffix: arm64
112+
dockerfile: Dockerfile.arm64
113+
when:
114+
event: [ push, tag ]
115+
116+
publish_linux_arm:
117+
image: plugins/docker:17.05
118+
pull: true
119+
secrets: [ docker_username, docker_password ]
120+
group: docker
121+
repo: plugins/matrix
122+
auto_tag: true
123+
auto_tag_suffix: arm
124+
dockerfile: Dockerfile.arm
125+
when:
126+
event: [ push, tag ]
127+
128+
microbadger:
129+
image: plugins/webhook:1
130+
pull: true
131+
secrets: [ webhook_url ]
132+
when:
133+
status: [ success ]

.github/issue_template.md

Whitespace-only changes.

.github/pull_request_template.md

Whitespace-only changes.

.gitignore

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,28 @@
1-
*.swp
2-
*~
3-
/drone-plugin-matrix
4-
/vendor
1+
# Compiled Object files, Static and Dynamic libs (Shared Objects)
2+
*.o
3+
*.a
4+
*.so
5+
6+
# Folders
7+
_obj
8+
_test
9+
10+
# Architecture specific extensions/prefixes
11+
*.[568vq]
12+
[568vq].out
13+
14+
*.cgo1.go
15+
*.cgo2.c
16+
_cgo_defun.c
17+
_cgo_gotypes.go
18+
_cgo_export.*
19+
20+
_testmain.go
21+
22+
*.exe
23+
*.test
24+
*.prof
25+
26+
release/
27+
coverage.out
28+
drone-matrix

Dockerfile

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
# vim: set ft=dockerfile:
2-
FROM alpine:3.6
3-
# Author with no obligation to maintain
4-
MAINTAINER Paul Tötterman <[email protected]>
1+
FROM plugins/base:multiarch
52

6-
RUN apk --no-cache add ca-certificates
7-
ADD drone-plugin-matrix /
8-
ENTRYPOINT /drone-plugin-matrix
3+
LABEL maintainer="Drone.IO Community <[email protected]>" \
4+
org.label-schema.name="Drone Matrix" \
5+
org.label-schema.vendor="Drone.IO Community" \
6+
org.label-schema.schema-version="1.0"
7+
8+
ADD release/linux/amd64/drone-matrix /bin/
9+
ENTRYPOINT ["/bin/drone-matrix"]

Dockerfile.arm

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM plugins/base:multiarch
2+
3+
LABEL maintainer="Drone.IO Community <[email protected]>" \
4+
org.label-schema.name="Drone Matrix" \
5+
org.label-schema.vendor="Drone.IO Community" \
6+
org.label-schema.schema-version="1.0"
7+
8+
ADD release/linux/arm/drone-matrix /bin/
9+
ENTRYPOINT ["/bin/drone-matrix"]

Dockerfile.arm64

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM plugins/base:multiarch
2+
3+
LABEL maintainer="Drone.IO Community <[email protected]>" \
4+
org.label-schema.name="Drone Matrix" \
5+
org.label-schema.vendor="Drone.IO Community" \
6+
org.label-schema.schema-version="1.0"
7+
8+
ADD release/linux/arm64/drone-matrix /bin/
9+
ENTRYPOINT ["/bin/drone-matrix"]

Dockerfile.i386

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM plugins/base:multiarch
2+
3+
LABEL maintainer="Drone.IO Community <[email protected]>" \
4+
org.label-schema.name="Drone Matrix" \
5+
org.label-schema.vendor="Drone.IO Community" \
6+
org.label-schema.schema-version="1.0"
7+
8+
ADD release/linux/i386/drone-matrix /bin/
9+
ENTRYPOINT ["/bin/drone-matrix"]

0 commit comments

Comments
 (0)