Skip to content

Commit

Permalink
Merge pull request #238 from video-dev/post-migration
Browse files Browse the repository at this point in the history
 Post-migration updates & Drone migration
  • Loading branch information
fsouza committed Jul 26, 2019
2 parents 2976483 + 1e7b3ca commit c65a71d
Show file tree
Hide file tree
Showing 13 changed files with 425 additions and 261 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.git
44 changes: 0 additions & 44 deletions .travis.yml

This file was deleted.

13 changes: 13 additions & 0 deletions Dockerfile
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"]
21 changes: 12 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
.PHONY: all testdeps lint test gotest build run
.PHONY: all testdeps lint runlint test gotest coverage gocoverage build run

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

all: test

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

lint: testdeps
lint: testdeps runlint

runlint:
golangci-lint run \
--enable-all \
-D errcheck \
Expand All @@ -24,16 +25,18 @@ lint: testdeps
-D unparam \
--deadline 5m ./...

gotest: testdeps
go test ./...
gotest:
go test -vet=all -mod=readonly $(GO_TEST_EXTRA_FLAGS) ./...

test: lint testdeps gotest

test: lint gotest
coverage: lint gocoverage

coverage: lint
go test -coverprofile=coverage.txt -covermode=atomic ./...
gocoverage:
make gotest GO_TEST_EXTRA_FLAGS="-coverprofile=coverage.txt -covermode=atomic"

build:
go build
go build -mod=readonly

run: build
HTTP_PORT=$(HTTP_PORT) APP_LOG_LEVEL=$(LOG_LEVEL) ./video-transcoding-api
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

# Video Transcoding API

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

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

```
$ git clone https://github.com/NYTimes/video-transcoding-api.git
$ git clone https://github.com/video-dev/video-transcoding-api.git
$ make run
```

Expand All @@ -139,7 +139,7 @@ $ make test
## Using the API

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

## Contributing
Expand All @@ -153,7 +153,7 @@ use this API.
## License

- This code is under [Apache 2.0
license](https://github.com/NYTimes/video-transcoding-api/blob/master/LICENSE).
license](https://github.com/video-dev/video-transcoding-api/blob/master/LICENSE).
- The video-transcoding-api logo is a variation on the Go gopher that was
designed by Renee French and copyrighted under the [Creative Commons
Attribution 3.0 license](https://creativecommons.org/licenses/by/3.0/).
25 changes: 0 additions & 25 deletions bin/build

This file was deleted.

70 changes: 0 additions & 70 deletions bump.sh

This file was deleted.

138 changes: 138 additions & 0 deletions drone/.drone.jsonnet
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)
Loading

0 comments on commit c65a71d

Please sign in to comment.