|
| 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 | + auto_tag_suffix: amd64 |
| 89 | + dockerfile: Dockerfile |
| 90 | + when: |
| 91 | + event: [ push, tag ] |
| 92 | + |
| 93 | + publish_linux_i386: |
| 94 | + image: plugins/docker:17.05 |
| 95 | + pull: true |
| 96 | + secrets: [ docker_username, docker_password ] |
| 97 | + group: docker |
| 98 | + repo: plugins/matrix |
| 99 | + auto_tag: true |
| 100 | + auto_tag_suffix: i386 |
| 101 | + dockerfile: Dockerfile.i386 |
| 102 | + when: |
| 103 | + event: [ push, tag ] |
| 104 | + |
| 105 | + publish_linux_arm64: |
| 106 | + image: plugins/docker:17.05 |
| 107 | + pull: true |
| 108 | + secrets: [ docker_username, docker_password ] |
| 109 | + group: docker |
| 110 | + repo: plugins/matrix |
| 111 | + auto_tag: true |
| 112 | + auto_tag_suffix: arm64 |
| 113 | + dockerfile: Dockerfile.arm64 |
| 114 | + when: |
| 115 | + event: [ push, tag ] |
| 116 | + |
| 117 | + publish_linux_arm: |
| 118 | + image: plugins/docker:17.05 |
| 119 | + pull: true |
| 120 | + secrets: [ docker_username, docker_password ] |
| 121 | + group: docker |
| 122 | + repo: plugins/matrix |
| 123 | + auto_tag: true |
| 124 | + auto_tag_suffix: arm |
| 125 | + dockerfile: Dockerfile.arm |
| 126 | + when: |
| 127 | + event: [ push, tag ] |
| 128 | + |
| 129 | + manifests: |
| 130 | + image: plugins/manifest:1 |
| 131 | + pull: true |
| 132 | + secrets: [ docker_username, docker_password ] |
| 133 | + spec: manifest.tmpl |
| 134 | + auto_tag: true |
| 135 | + ignore_missing: true |
| 136 | + when: |
| 137 | + event: [ push, tag ] |
| 138 | + |
| 139 | + microbadger: |
| 140 | + image: plugins/webhook:1 |
| 141 | + pull: true |
| 142 | + secrets: [ webhook_url ] |
| 143 | + when: |
| 144 | + status: [ success ] |
0 commit comments