Skip to content

Commit 5147ae4

Browse files
committed
Run tests on drone.io
added dockerfile use custom image install task inside container install bzip2 install unzip install test tools restore coverage collection add codecov to the image coverage only on master
1 parent 69d86a4 commit 5147ae4

File tree

2 files changed

+63
-0
lines changed

2 files changed

+63
-0
lines changed

Diff for: .drone.yml

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
kind: pipeline
2+
name: default
3+
4+
steps:
5+
- name: lint
6+
image: arduino/arduino-cli:drone-0.2.0
7+
commands:
8+
# Check if the Go code is properly formatted and run the linter
9+
- task check
10+
# Ensure protobufs compile
11+
- task protoc
12+
13+
- name: build
14+
image: arduino/arduino-cli:drone-0.2.0
15+
commands:
16+
- task build
17+
18+
- name: test
19+
image: arduino/arduino-cli:drone-0.2.0
20+
commands:
21+
- task test
22+
- task test-legacy
23+
24+
# Contrary to other CI platforms, uploading reports to Codecov requires Drone to provide a token.
25+
# To avoid exposing the Codecov token to external PRs, we only upload coverage when we merge on
26+
# `master`.
27+
- name: coverage
28+
image: arduino/arduino-cli:drone-0.2.0
29+
environment:
30+
CODECOV_TOKEN:
31+
from_secret: codecov_token
32+
commands:
33+
- codecov -cF unit -f coverage_unit.txt -t $CODECOV_TOKEN
34+
- codecov -cF integ -f coverage_integ.txt -t $CODECOV_TOKEN
35+
when:
36+
branch:
37+
- master
38+
event:
39+
- push

Diff for: Dockerfiles/CI/Dockerfile

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
FROM golang:1.12
2+
3+
RUN apt-get update && apt-get install -y --no-install-recommends \
4+
bzip2 \
5+
unzip \
6+
&& rm -rf /var/lib/apt/lists/*
7+
8+
ENV PROTOBUF_VER 3.8.0
9+
10+
# NOTE: most of the following assume WORDKIR is '/'
11+
RUN set -ex \
12+
# Task executor, will be installed in /bin
13+
&& curl -sL https://taskfile.dev/install.sh | sh \
14+
# Codecov uploader
15+
&& curl -o /bin/codecov -LO https://codecov.io/bash && chmod +x /bin/codecov \
16+
# Go runtime dependencies
17+
&& go get github.com/golangci/govet \
18+
&& go get golang.org/x/lint/golint \
19+
# Protobuf tooling
20+
&& go get github.com/golang/protobuf/protoc-gen-go \
21+
&& mkdir protobuf && cd protobuf \
22+
&& curl -LO https://github.com/google/protobuf/releases/download/v$PROTOBUF_VER/protoc-$PROTOBUF_VER-linux-x86_64.zip \
23+
&& unzip protoc-$PROTOBUF_VER-linux-x86_64.zip && cp ./bin/* /bin/ \
24+
&& cd .. && rm -rf protobuf

0 commit comments

Comments
 (0)