-
Notifications
You must be signed in to change notification settings - Fork 71
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 #238 from video-dev/post-migration
Post-migration updates & Drone migration
- Loading branch information
Showing
13 changed files
with
425 additions
and
261 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 @@ | ||
.git |
This file was deleted.
Oops, something went wrong.
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,13 @@ | ||
FROM golang:1.12.7-alpine AS build | ||
|
||
ARG GOPROXY=https://proxy.golang.org | ||
|
||
ENV CGO_ENABLED 0 | ||
WORKDIR /code | ||
ADD . ./ | ||
RUN go install | ||
|
||
FROM alpine:3.10.1 | ||
RUN apk add --no-cache ca-certificates | ||
COPY --from=build /go/bin/video-transcoding-api /usr/bin/video-transcoding-api | ||
ENTRYPOINT ["/usr/bin/video-transcoding-api"] |
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
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,138 @@ | ||
// the first version is used to build the binary that gets shipped to Docker Hub. | ||
local go_versions = ['1.12.7', '1.11.12', '1.13beta1']; | ||
|
||
local test_dockerfile = { | ||
name: 'test-dockerfile', | ||
image: 'plugins/docker', | ||
settings: { | ||
repo: 'videodev/video-transcoding-api', | ||
dry_run: true, | ||
}, | ||
when: { | ||
event: ['push', 'pull_request'], | ||
}, | ||
depends_on: ['clone'], | ||
}; | ||
|
||
local push_to_dockerhub = { | ||
name: 'build-and-push-to-dockerhub', | ||
image: 'plugins/docker', | ||
settings: { | ||
repo: 'videodev/video-transcoding-api', | ||
auto_tag: true, | ||
dockerfile: 'drone/Dockerfile', | ||
username: { from_secret: 'docker_username' }, | ||
password: { from_secret: 'docker_password' }, | ||
}, | ||
when: { | ||
ref: [ | ||
'refs/tags/*', | ||
'refs/heads/master', | ||
], | ||
}, | ||
depends_on: ['coverage', 'lint', 'build'], | ||
}; | ||
|
||
local goreleaser = { | ||
name: 'goreleaser', | ||
image: 'goreleaser/goreleaser', | ||
commands: [ | ||
'git fetch --tags', | ||
'goreleaser release', | ||
], | ||
environment: { | ||
GITHUB_TOKEN: { | ||
from_secret: 'github_token', | ||
}, | ||
}, | ||
depends_on: ['coverage', 'lint'], | ||
when: { | ||
event: ['tag'], | ||
}, | ||
}; | ||
|
||
local release_steps = [ | ||
test_dockerfile, | ||
push_to_dockerhub, | ||
goreleaser, | ||
]; | ||
|
||
local mod_download(go_version) = { | ||
name: 'mod-download', | ||
image: 'golang:%(go_version)s' % { go_version: go_version }, | ||
commands: ['go mod download'], | ||
environment: { GOPROXY: 'https://proxy.golang.org' }, | ||
depends_on: ['clone'], | ||
}; | ||
|
||
// TODO(fsouza): run redis as a service in Drone. This actually requires a | ||
// change to our test suite, because it requires Redis to be running on | ||
// localhost and that's not how Drone works. | ||
local coverage(go_version) = { | ||
name: 'coverage', | ||
image: 'golang:%(go_version)s' % { go_version: go_version }, | ||
commands: [ | ||
'apt update', | ||
'apt install -y redis-server', | ||
'redis-server &>/dev/null &', | ||
'timeout 10 sh -c "while ! redis-cli ping; do echo waiting for redis-server to start; sleep 1; done"', | ||
'make gocoverage', | ||
], | ||
depends_on: ['mod-download'], | ||
}; | ||
|
||
local lint = { | ||
name: 'lint', | ||
image: 'golangci/golangci-lint', | ||
pull: 'always', | ||
commands: ['make runlint'], | ||
depends_on: ['mod-download'], | ||
}; | ||
|
||
local build(go_version) = { | ||
name: 'build', | ||
image: 'golang:%(go_version)s' % { go_version: go_version }, | ||
commands: ['make build'], | ||
environment: { CGO_ENABLED: '0' }, | ||
depends_on: ['mod-download'], | ||
}; | ||
|
||
local coverage_report = { | ||
name: 'codecov-report', | ||
image: 'golang', | ||
commands: ['curl -s https://codecov.io/bash | bash'], | ||
depends_on: ['coverage'], | ||
}; | ||
|
||
local test_ci_dockerfile = { | ||
name: 'test-ci-dockerfile', | ||
image: 'plugins/docker', | ||
settings: { | ||
repo: 'videodev/video-transcoding-api', | ||
dockerfile: 'drone/Dockerfile', | ||
dry_run: true, | ||
}, | ||
when: { | ||
event: ['pull_request'], | ||
}, | ||
depends_on: ['build'], | ||
}; | ||
|
||
local pipeline(go_version) = { | ||
kind: 'pipeline', | ||
name: 'go-%(go_version)s' % { go_version: go_version }, | ||
workspace: { | ||
base: '/go', | ||
path: 'video-transcoding-api', | ||
}, | ||
steps: [ | ||
mod_download(go_version), | ||
coverage(go_version), | ||
coverage_report, | ||
lint, | ||
build(go_version), | ||
test_ci_dockerfile, | ||
] + if go_version == go_versions[0] then release_steps else [], | ||
}; | ||
|
||
std.map(pipeline, go_versions) |
Oops, something went wrong.