Skip to content

Commit 90b7fa4

Browse files
committed
Post-migration updates & Drone migration
Updates related to the migration: - remove NYT-specific stuff (travis-scripts, bin/build, bump.sh) - update links and badges in the README - two `Dockerfile`s: one for CI, one for local Also migrating to Drone as that give us faster build times and better integration with Docker Hub.
1 parent 2976483 commit 90b7fa4

File tree

13 files changed

+415
-261
lines changed

13 files changed

+415
-261
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.git

.travis.yml

Lines changed: 0 additions & 44 deletions
This file was deleted.

Dockerfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
FROM golang:1.12.7-alpine AS build
2+
3+
ARG GOPROXY=https://proxy.golang.org
4+
5+
ENV CGO_ENABLED 0
6+
WORKDIR /code
7+
ADD . ./
8+
RUN go test ./...
9+
RUN go install
10+
11+
FROM alpine:3.10.1
12+
RUN apk add --no-cache ca-certificates
13+
COPY --from=build /go/bin/video-transcoding-api /usr/bin/video-transcoding-api
14+
ENTRYPOINT ["/usr/bin/video-transcoding-api"]

Makefile

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
1-
.PHONY: all testdeps lint test gotest build run
1+
.PHONY: all testdeps lint runlint test gotest coverage gocoverage build run
22

33
HTTP_PORT ?= 8080
44
LOG_LEVEL ?= debug
5-
CI_TAG ?= $(shell git describe --tags $(shell git rev-list --tags --max-count=1))
65

76
all: test
87

98
testdeps:
109
GO111MODULE=off go get github.com/golangci/golangci-lint/cmd/golangci-lint
1110
go mod download
1211

13-
lint: testdeps
12+
lint: testdeps runlint
13+
14+
runlint:
1415
golangci-lint run \
1516
--enable-all \
1617
-D errcheck \
@@ -24,16 +25,18 @@ lint: testdeps
2425
-D unparam \
2526
--deadline 5m ./...
2627

27-
gotest: testdeps
28-
go test ./...
28+
gotest:
29+
go test -race -vet=all -mod=readonly $(GO_TEST_EXTRA_FLAGS) ./...
30+
31+
test: lint testdeps gotest
2932

30-
test: lint gotest
33+
coverage: lint gocoverage
3134

32-
coverage: lint
33-
go test -coverprofile=coverage.txt -covermode=atomic ./...
35+
gocoverage:
36+
make gotest GO_TEST_EXTRA_FLAGS="-coverprofile=coverage.txt -covermode=atomic"
3437

3538
build:
36-
go build
39+
go build -mod=readonly
3740

3841
run: build
3942
HTTP_PORT=$(HTTP_PORT) APP_LOG_LEVEL=$(LOG_LEVEL) ./video-transcoding-api

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
# Video Transcoding API
44

5-
[![Build Status](https://travis-ci.org/nytimes/video-transcoding-api.svg?branch=master)](https://travis-ci.org/nytimes/video-transcoding-api)
6-
[![codecov](https://codecov.io/gh/nytimes/video-transcoding-api/branch/master/graph/badge.svg)](https://codecov.io/gh/nytimes/video-transcoding-api)
7-
[![Go Report Card](https://goreportcard.com/badge/github.com/nytimes/video-transcoding-api)](https://goreportcard.com/report/github.com/nytimes/video-transcoding-api)
5+
[![Build Status](https://cloud.drone.io/api/badges/video-dev/video-transcoding-api/status.svg)](https://cloud.drone.io/video-dev/video-transcoding-api)
6+
[![codecov](https://codecov.io/gh/video-dev/video-transcoding-api/branch/master/graph/badge.svg)](https://codecov.io/gh/video-dev/video-transcoding-api)
7+
[![Go Report Card](https://goreportcard.com/badge/github.com/video-dev/video-transcoding-api)](https://goreportcard.com/report/github.com/video-dev/video-transcoding-api)
88

99
The Video Transcoding API provides an agnostic API to transcode media assets
1010
across different cloud services. Currently, it supports the following
@@ -126,7 +126,7 @@ With all environment variables set and redis up and running, clone this
126126
repository and run:
127127

128128
```
129-
$ git clone https://github.com/NYTimes/video-transcoding-api.git
129+
$ git clone https://github.com/video-dev/video-transcoding-api.git
130130
$ make run
131131
```
132132

@@ -139,7 +139,7 @@ $ make test
139139
## Using the API
140140

141141
Check out on our Wiki [how
142-
to](https://github.com/NYTimes/video-transcoding-api/wiki/Using-Video-Transcoding-API)
142+
to](https://github.com/video-dev/video-transcoding-api/wiki/Using-Video-Transcoding-API)
143143
use this API.
144144

145145
## Contributing
@@ -153,7 +153,7 @@ use this API.
153153
## License
154154

155155
- This code is under [Apache 2.0
156-
license](https://github.com/NYTimes/video-transcoding-api/blob/master/LICENSE).
156+
license](https://github.com/video-dev/video-transcoding-api/blob/master/LICENSE).
157157
- The video-transcoding-api logo is a variation on the Go gopher that was
158158
designed by Renee French and copyrighted under the [Creative Commons
159159
Attribution 3.0 license](https://creativecommons.org/licenses/by/3.0/).

bin/build

Lines changed: 0 additions & 25 deletions
This file was deleted.

bump.sh

Lines changed: 0 additions & 70 deletions
This file was deleted.

drone/.drone.jsonnet

Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
// the first version is used to build the binary that gets shipped to Docker Hub.
2+
local go_versions = ['1.12.7', '1.11.12', '1.13beta1'];
3+
4+
local test_dockerfile = {
5+
name: 'test-dockerfile',
6+
image: 'plugins/docker',
7+
settings: {
8+
repo: 'videodev/video-transcoding-api',
9+
dry_run: true,
10+
},
11+
when: {
12+
event: ['push', 'pull_request'],
13+
},
14+
depends_on: ['clone'],
15+
};
16+
17+
local push_to_dockerhub = {
18+
name: 'build-and-push-to-dockerhub',
19+
image: 'plugins/docker',
20+
settings: {
21+
repo: 'videodev/video-transcoding-api',
22+
auto_tag: true,
23+
dockerfile: 'drone/Dockerfile',
24+
username: { from_secret: 'docker_username' },
25+
password: { from_secret: 'docker_password' },
26+
},
27+
when: {
28+
ref: [
29+
'refs/tags/*',
30+
'refs/heads/master',
31+
],
32+
},
33+
depends_on: ['coverage', 'lint', 'build'],
34+
};
35+
36+
local goreleaser = {
37+
name: 'goreleaser',
38+
image: 'goreleaser/goreleaser',
39+
commands: [
40+
'git fetch --tags',
41+
'goreleaser release',
42+
],
43+
environment: {
44+
GITHUB_TOKEN: {
45+
from_secret: 'github_token',
46+
},
47+
},
48+
depends_on: ['coverage', 'lint'],
49+
when: {
50+
event: ['tag'],
51+
},
52+
};
53+
54+
local release_steps = [
55+
test_dockerfile,
56+
push_to_dockerhub,
57+
goreleaser,
58+
];
59+
60+
local mod_download(go_version) = {
61+
name: 'mod-download',
62+
image: 'golang:%(go_version)s' % { go_version: go_version },
63+
commands: ['go mod download'],
64+
environment: { GOPROXY: 'https://proxy.golang.org' },
65+
depends_on: ['clone'],
66+
};
67+
68+
local coverage(go_version) = {
69+
name: 'coverage',
70+
image: 'golang:%(go_version)s' % { go_version: go_version },
71+
commands: [
72+
'apt update',
73+
'apt install -y redis-server',
74+
'make gocoverage',
75+
],
76+
depends_on: ['mod-download'],
77+
};
78+
79+
local lint = {
80+
name: 'lint',
81+
image: 'golangci/golangci-lint',
82+
pull: 'always',
83+
commands: ['make runlint'],
84+
depends_on: ['mod-download'],
85+
};
86+
87+
local build(go_version) = {
88+
name: 'build',
89+
image: 'golang:%(go_version)s' % { go_version: go_version },
90+
commands: ['make build'],
91+
environment: { CGO_ENABLED: '0' },
92+
depends_on: ['mod-download'],
93+
};
94+
95+
local coverage_report = {
96+
name: 'codecov-report',
97+
image: 'golang',
98+
commands: ['bash <(curl -s https://codecov.io/bash)'],
99+
depends_on: ['coverage'],
100+
};
101+
102+
local test_ci_dockerfile = {
103+
name: 'test-ci-dockerfile',
104+
image: 'plugins/docker',
105+
settings: {
106+
repo: 'videodev/video-transcoding-api',
107+
dockerfile: 'drone/Dockerfile',
108+
dry_run: true,
109+
},
110+
when: {
111+
event: ['pull_request'],
112+
},
113+
depends_on: ['build'],
114+
};
115+
116+
local pipeline(go_version) = {
117+
kind: 'pipeline',
118+
name: 'go-%(go_version)s' % { go_version: go_version },
119+
workspace: {
120+
base: '/go',
121+
path: 'video-transcoding-api',
122+
},
123+
steps: [
124+
mod_download(go_version),
125+
coverage(go_version),
126+
coverage_report,
127+
lint,
128+
build(go_version),
129+
test_ci_dockerfile,
130+
] + if go_version == go_versions[0] then release_steps else [],
131+
};
132+
133+
std.map(pipeline, go_versions)

0 commit comments

Comments
 (0)