forked from External/mediamtx
add 32-bit tests (#440)
This commit is contained in:
parent
ab508e01ec
commit
a6d04aa1e9
2 changed files with 35 additions and 21 deletions
18
.github/workflows/test.yml
vendored
18
.github/workflows/test.yml
vendored
|
|
@ -15,12 +15,16 @@ jobs:
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
- uses: actions/setup-go@v2
|
- run: make test
|
||||||
with:
|
|
||||||
go-version: "1.16"
|
|
||||||
|
|
||||||
- run: sudo apt update && sudo apt install -y --no-install-recommends ffmpeg
|
|
||||||
|
|
||||||
- run: make test-nodocker
|
|
||||||
|
|
||||||
- run: bash <(curl -s https://codecov.io/bash)
|
- run: bash <(curl -s https://codecov.io/bash)
|
||||||
|
|
||||||
|
test32:
|
||||||
|
name: test32
|
||||||
|
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- run: make test32
|
||||||
|
|
|
||||||
38
Makefile
38
Makefile
|
|
@ -12,6 +12,7 @@ help:
|
||||||
@echo " mod-tidy run go mod tidy"
|
@echo " mod-tidy run go mod tidy"
|
||||||
@echo " format format source files"
|
@echo " format format source files"
|
||||||
@echo " test run tests"
|
@echo " test run tests"
|
||||||
|
@echo " test32 run tests on a 32-bit system"
|
||||||
@echo " lint run linters"
|
@echo " lint run linters"
|
||||||
@echo " bench NAME=n run bench environment"
|
@echo " bench NAME=n run bench environment"
|
||||||
@echo " run run app"
|
@echo " run run app"
|
||||||
|
|
@ -42,8 +43,9 @@ format:
|
||||||
sh -c "find . -type f -name '*.go' | xargs gofumpt -l -w"
|
sh -c "find . -type f -name '*.go' | xargs gofumpt -l -w"
|
||||||
|
|
||||||
define DOCKERFILE_TEST
|
define DOCKERFILE_TEST
|
||||||
FROM amd64/$(BASE_IMAGE)
|
ARG ARCH
|
||||||
RUN apk add --no-cache make docker-cli git ffmpeg gcc musl-dev
|
FROM $$ARCH/$(BASE_IMAGE)
|
||||||
|
RUN apk add --no-cache make docker-cli ffmpeg gcc musl-dev
|
||||||
WORKDIR /s
|
WORKDIR /s
|
||||||
COPY go.mod go.sum ./
|
COPY go.mod go.sum ./
|
||||||
RUN go mod download
|
RUN go mod download
|
||||||
|
|
@ -51,24 +53,32 @@ COPY . ./
|
||||||
endef
|
endef
|
||||||
export DOCKERFILE_TEST
|
export DOCKERFILE_TEST
|
||||||
|
|
||||||
test-internal:
|
|
||||||
go test -v -race -coverprofile=coverage-internal.txt ./internal/...
|
|
||||||
|
|
||||||
test-root:
|
|
||||||
$(foreach IMG,$(shell echo testimages/*/ | xargs -n1 basename), \
|
|
||||||
docker build -q testimages/$(IMG) -t rtsp-simple-server-test-$(IMG)$(NL))
|
|
||||||
go test -v -race -coverprofile=coverage-root.txt .
|
|
||||||
|
|
||||||
test-nodocker: test-internal test-root
|
|
||||||
|
|
||||||
test:
|
test:
|
||||||
echo "$$DOCKERFILE_TEST" | docker build -q . -f - -t temp
|
echo "$$DOCKERFILE_TEST" | docker build -q . -f - -t temp --build-arg ARCH=amd64
|
||||||
|
docker run --rm \
|
||||||
|
--network=host \
|
||||||
|
-v /var/run/docker.sock:/var/run/docker.sock:ro \
|
||||||
|
temp \
|
||||||
|
make test-nodocker OPTS="-race -coverprofile=coverage-internal.txt"
|
||||||
|
|
||||||
|
test32:
|
||||||
|
echo "$$DOCKERFILE_TEST" | docker build -q . -f - -t temp --build-arg ARCH=i386
|
||||||
docker run --rm \
|
docker run --rm \
|
||||||
--network=host \
|
--network=host \
|
||||||
-v /var/run/docker.sock:/var/run/docker.sock:ro \
|
-v /var/run/docker.sock:/var/run/docker.sock:ro \
|
||||||
temp \
|
temp \
|
||||||
make test-nodocker
|
make test-nodocker
|
||||||
|
|
||||||
|
test-internal:
|
||||||
|
go test -v $(OPTS) ./internal/...
|
||||||
|
|
||||||
|
test-root:
|
||||||
|
$(foreach IMG,$(shell echo testimages/*/ | xargs -n1 basename), \
|
||||||
|
docker build -q testimages/$(IMG) -t rtsp-simple-server-test-$(IMG)$(NL))
|
||||||
|
go test -v $(OPTS) .
|
||||||
|
|
||||||
|
test-nodocker: test-internal test-root
|
||||||
|
|
||||||
lint:
|
lint:
|
||||||
docker run --rm -v $(PWD):/app -w /app \
|
docker run --rm -v $(PWD):/app -w /app \
|
||||||
$(LINT_IMAGE) \
|
$(LINT_IMAGE) \
|
||||||
|
|
@ -80,7 +90,7 @@ bench:
|
||||||
|
|
||||||
define DOCKERFILE_RUN
|
define DOCKERFILE_RUN
|
||||||
FROM amd64/$(BASE_IMAGE)
|
FROM amd64/$(BASE_IMAGE)
|
||||||
RUN apk add --no-cache git ffmpeg
|
RUN apk add --no-cache ffmpeg
|
||||||
WORKDIR /s
|
WORKDIR /s
|
||||||
COPY go.mod go.sum ./
|
COPY go.mod go.sum ./
|
||||||
RUN go mod download
|
RUN go mod download
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue