add test and linter

This commit is contained in:
Leandro Moreira
2024-02-04 16:46:57 -03:00
parent eee7af6cfd
commit 8a3b6ed1e9
3 changed files with 54 additions and 0 deletions
+30
View File
@@ -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
+6
View File
@@ -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
+18
View File
@@ -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: .