mirror of
https://github.com/flavioribeiro/donut.git
synced 2026-04-23 00:27:03 +08:00
add test and linter
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
FROM golang:1.19
|
||||
|
||||
ENV WD=/usr/src/app
|
||||
ENV SRT_VERSION="v1.5.3"
|
||||
ENV SRT_FOLDER="/opt/srt_lib"
|
||||
WORKDIR ${WD}
|
||||
|
||||
RUN apt-get clean && apt-get update && \
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install -y \
|
||||
tclsh pkg-config cmake libssl-dev build-essential git \
|
||||
&& apt-get clean
|
||||
|
||||
RUN \
|
||||
mkdir -p "${SRT_FOLDER}" && \
|
||||
git clone --depth 1 --branch "${SRT_VERSION}" https://github.com/Haivision/srt && \
|
||||
cd srt && \
|
||||
./configure --prefix=${SRT_FOLDER} $(configure) && \
|
||||
make && \
|
||||
make install
|
||||
|
||||
# To find where the srt.h and libsrt.so were you can
|
||||
# find / -name srt.h
|
||||
# find / -name libsrt.so
|
||||
# inside the container docker run -it --rm -t <TAG_YOU_BUILT> bash
|
||||
ENV GOPROXY=direct
|
||||
ENV LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${SRT_FOLDER}/lib/"
|
||||
ENV CGO_CFLAGS="-I${SRT_FOLDER}/include/"
|
||||
ENV CGO_LDFLAGS="-L${SRT_FOLDER}/lib/"
|
||||
|
||||
RUN curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.55.2
|
||||
@@ -1,4 +1,10 @@
|
||||
run:
|
||||
docker-compose stop && docker-compose down && docker-compose build && docker-compose up
|
||||
|
||||
test:
|
||||
docker compose stop test && docker compose down test && docker compose run --rm test
|
||||
|
||||
lint:
|
||||
docker compose stop lint && docker compose down lint && docker compose run --rm lint
|
||||
|
||||
.PHONY: run
|
||||
|
||||
@@ -13,6 +13,24 @@ services:
|
||||
- "8081:8081/udp"
|
||||
- "6060:6060"
|
||||
|
||||
test:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile-dev
|
||||
working_dir: "/app"
|
||||
volumes:
|
||||
- "./:/app/"
|
||||
command: "go test ./..."
|
||||
|
||||
lint:
|
||||
build:
|
||||
context: .
|
||||
dockerfile: Dockerfile-dev
|
||||
working_dir: "/app"
|
||||
volumes:
|
||||
- "./:/app/"
|
||||
command: "golangci-lint run -v"
|
||||
|
||||
srt:
|
||||
build:
|
||||
context: .
|
||||
|
||||
Reference in New Issue
Block a user