mirror of
https://github.com/aler9/rtsp-simple-server
synced 2026-04-22 23:17:11 +08:00
move go <-> api check in linters (#5425)
This commit is contained in:
@@ -37,6 +37,18 @@ jobs:
|
||||
|
||||
- run: make lint-go-mod
|
||||
|
||||
go2api:
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v6
|
||||
|
||||
- uses: actions/setup-go@v6
|
||||
with:
|
||||
go-version: "1.25"
|
||||
|
||||
- run: make lint-go2api
|
||||
|
||||
docs:
|
||||
runs-on: ubuntu-22.04
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//go:build enableUpgrade
|
||||
//go:build enable_upgrade
|
||||
|
||||
package core
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
//go:build !enableUpgrade
|
||||
//go:build !enable_upgrade
|
||||
|
||||
package core
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
//go:build enable_linters
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
@@ -126,8 +128,8 @@ func fillProperty(t *testing.T, rt reflect.Type, existing openAPIProperty) openA
|
||||
}
|
||||
}
|
||||
|
||||
func TestAPIDocs(t *testing.T) {
|
||||
byts, err := os.ReadFile("../../api/openapi.yaml")
|
||||
func TestGo2API(t *testing.T) {
|
||||
byts, err := os.ReadFile("../../../api/openapi.yaml")
|
||||
require.NoError(t, err)
|
||||
|
||||
var doc openAPI
|
||||
+7
-7
@@ -15,37 +15,37 @@ RUN go generate ./...
|
||||
|
||||
FROM build-base AS build-windows-amd64
|
||||
ENV GOOS=windows GOARCH=amd64
|
||||
RUN go build -tags enableUpgrade -o "tmp/$(BINARY_NAME).exe"
|
||||
RUN go build -tags enable_upgrade -o "tmp/$(BINARY_NAME).exe"
|
||||
RUN cd tmp && zip -q "../binaries/$(BINARY_NAME)_$$(cat ../internal/core/VERSION)_windows_amd64.zip" "$(BINARY_NAME).exe" mediamtx.yml LICENSE
|
||||
|
||||
FROM build-base AS build-linux-amd64
|
||||
ENV GOOS=linux GOARCH=amd64
|
||||
RUN go build -tags enableUpgrade -o "tmp/$(BINARY_NAME)"
|
||||
RUN go build -tags enable_upgrade -o "tmp/$(BINARY_NAME)"
|
||||
RUN tar -C tmp -czf "binaries/$(BINARY_NAME)_$$(cat internal/core/VERSION)_linux_amd64.tar.gz" --owner=0 --group=0 "$(BINARY_NAME)" mediamtx.yml LICENSE
|
||||
|
||||
FROM build-base AS build-darwin-amd64
|
||||
ENV GOOS=darwin GOARCH=amd64
|
||||
RUN go build -tags enableUpgrade -o "tmp/$(BINARY_NAME)"
|
||||
RUN go build -tags enable_upgrade -o "tmp/$(BINARY_NAME)"
|
||||
RUN tar -C tmp -czf "binaries/$(BINARY_NAME)_$$(cat internal/core/VERSION)_darwin_amd64.tar.gz" --owner=0 --group=0 "$(BINARY_NAME)" mediamtx.yml LICENSE
|
||||
|
||||
FROM build-base AS build-darwin-arm64
|
||||
ENV GOOS=darwin GOARCH=arm64
|
||||
RUN go build -tags enableUpgrade -o "tmp/$(BINARY_NAME)"
|
||||
RUN go build -tags enable_upgrade -o "tmp/$(BINARY_NAME)"
|
||||
RUN tar -C tmp -czf "binaries/$(BINARY_NAME)_$$(cat internal/core/VERSION)_darwin_arm64.tar.gz" --owner=0 --group=0 "$(BINARY_NAME)" mediamtx.yml LICENSE
|
||||
|
||||
FROM build-base AS build-linux-armv6
|
||||
ENV GOOS=linux GOARCH=arm GOARM=6
|
||||
RUN go build -tags enableUpgrade -o "tmp/$(BINARY_NAME)"
|
||||
RUN go build -tags enable_upgrade -o "tmp/$(BINARY_NAME)"
|
||||
RUN tar -C tmp -czf "binaries/$(BINARY_NAME)_$$(cat internal/core/VERSION)_linux_armv6.tar.gz" --owner=0 --group=0 "$(BINARY_NAME)" mediamtx.yml LICENSE
|
||||
|
||||
FROM build-base AS build-linux-armv7
|
||||
ENV GOOS=linux GOARCH=arm GOARM=7
|
||||
RUN go build -tags enableUpgrade -o "tmp/$(BINARY_NAME)"
|
||||
RUN go build -tags enable_upgrade -o "tmp/$(BINARY_NAME)"
|
||||
RUN tar -C tmp -czf "binaries/$(BINARY_NAME)_$$(cat internal/core/VERSION)_linux_armv7.tar.gz" --owner=0 --group=0 "$(BINARY_NAME)" mediamtx.yml LICENSE
|
||||
|
||||
FROM build-base AS build-linux-arm64
|
||||
ENV GOOS=linux GOARCH=arm64
|
||||
RUN go build -tags enableUpgrade -o "tmp/$(BINARY_NAME)"
|
||||
RUN go build -tags enable_upgrade -o "tmp/$(BINARY_NAME)"
|
||||
RUN tar -C tmp -czf "binaries/$(BINARY_NAME)_$$(cat internal/core/VERSION)_linux_arm64.tar.gz" --owner=0 --group=0 "$(BINARY_NAME)" mediamtx.yml LICENSE
|
||||
|
||||
FROM $(BASE_IMAGE)
|
||||
|
||||
+4
-1
@@ -19,6 +19,9 @@ lint-go-mod:
|
||||
go mod tidy
|
||||
git diff --exit-code
|
||||
|
||||
lint-go2api:
|
||||
go test -v -tags enable_linters ./internal/linters/go2api
|
||||
|
||||
lint-docs:
|
||||
echo "$$DOCKERFILE_DOCS_LINT" | docker build . -f - -t temp
|
||||
docker run --rm -v "$(shell pwd)/docs:/s" -w /s temp \
|
||||
@@ -30,4 +33,4 @@ lint-api-docs:
|
||||
docker run --rm -v "$(shell pwd)/api:/s" -w /s temp \
|
||||
sh -c "openapi lint openapi.yaml"
|
||||
|
||||
lint: lint-go lint-go-mod lint-docs lint-api-docs
|
||||
lint: lint-go lint-go-mod lint-go2api lint-docs lint-api-docs
|
||||
|
||||
Reference in New Issue
Block a user