forked from livepeer/go-livepeer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.yml
113 lines (93 loc) · 3.99 KB
/
config.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
version: 2
workflows:
version: 2
build_and_test:
jobs:
- build-builder
- build:
requires:
- build-builder
jobs:
build-builder:
docker:
- image: circleci/golang:1-stretch
working_directory: /go/src/github.com/livepeer/go-livepeer
environment:
PKG_CONFIG_PATH: /root/compiled/lib/pkgconfig
GOPATH: /go
DOCKER_CLI_EXPERIMENTAL: enabled
steps:
- checkout
- setup_remote_docker:
# This actually only exists for paid plans. But it's good luck!
docker_layer_caching: true
- run: docker login -u $DOCKER_USER -p $DOCKER_PASS
# First, build the Linux-specific builder container
- run: docker pull livepeerci/build-platform:latest || echo 'no pre-existing cache found'
- run: docker build -t livepeerci/build-platform:latest --cache-from=livepeerci/build-platform:latest -f docker/Dockerfile.build-linux .
- run: docker push livepeerci/build-platform:latest
# Then, build the actual app in a container shared between Linux and Windows
- run: docker pull livepeerci/build:latest || echo 'no pre-existing cache found'
- run: |-
source ./ci_env.sh
docker build --build-arg HIGHEST_CHAIN_TAG -t livepeerci/build:latest --cache-from=livepeerci/build:latest -f docker/Dockerfile.build .
- run: docker push livepeerci/build:latest
# Finally, build the minimal go-livepeer distributable. We publish two tags for each build:
# livepeer/go-livepeer:BRANCH_NAME and livepeer/go-livepeer:VERSION_STRING. Both are useful
# to pull from in different contexts.
- run: |-
# Our Docker tag name should be our branch name with just alphanums
BRANCH_TAG=$(echo $CIRCLE_BRANCH | sed 's/\//-/g' | tr -cd '[:alnum:]_-')
VERSION_TAG=$(./print_version.sh)
docker build -t current-build -f docker/Dockerfile.release-linux .
for TAG in $BRANCH_TAG $VERSION_TAG; do
docker tag current-build livepeer/go-livepeer:${TAG}-linux
docker push livepeer/go-livepeer:${TAG}-linux
# Manifest step is optional in case the Windows build hasn't finished yet
docker manifest create livepeer/go-livepeer:${TAG} livepeer/go-livepeer:${TAG}-linux livepeer/go-livepeer:${TAG}-windows || true
docker manifest push livepeer/go-livepeer:${TAG} || true
done
build:
docker:
# Note race condition - we might get the wrong builder if lots of builds are happening in
# parallel because this pulls it down from Docker Hub.
- image: livepeerci/build:latest
working_directory: /build
environment:
PKG_CONFIG_PATH: /root/compiled/lib/pkgconfig
TEST_RESULTS: /tmp/test-results
GOPATH: /go
steps:
- checkout
- setup_remote_docker:
# This actually only exists for paid plans. But it's good luck!
docker_layer_caching: true
- run: mkdir -p $TEST_RESULTS
- run:
name: Lint
command: |
golangci-lint --disable-all --enable=gofmt --enable=vet --enable=golint --deadline=4m run pm verification
- run:
name: Run unit tests
command: |
trap "go-junit-report <${TEST_RESULTS}/go-test.out > ${TEST_RESULTS}/go-test-report.xml" EXIT
/bin/bash test.sh 2>&1 | tee $TEST_RESULTS/go-test.out
- run:
name: Localdocker build check
command: make localdocker
- run:
name: Upload build
command: ./upload_build.sh
- run:
name: Notify that new build has been uploaded
command: curl -X POST https://holy-bread-207a.livepeer.workers.dev
- save_cache:
key: v3-pkg-cache
paths:
- "/go/pkg"
- "/home/circleci/compiled"
- "/home/circleci/nasm/nasm"
- "/home/circleci/x264/x264"
- "/home/circleci/ffmpeg/libavcodec/libavcodec.a"
- store_test_results:
path: /tmp/test-results