mirror of
https://github.com/docker/compose.git
synced 2025-07-14 09:14:26 +02:00
Merge pull request #507 from docker/chore-import-restrictions
Add tool to check inter-dependencies between packages
This commit is contained in:
commit
464316d4fc
5
.github/workflows/ci.yml
vendored
5
.github/workflows/ci.yml
vendored
@ -21,6 +21,9 @@ jobs:
|
|||||||
- name: Validate go-mod is up-to-date and license headers
|
- name: Validate go-mod is up-to-date and license headers
|
||||||
run: make validate
|
run: make validate
|
||||||
|
|
||||||
|
- name: Validate imports
|
||||||
|
run: make import-restrictions
|
||||||
|
|
||||||
- name: Run golangci-lint
|
- name: Run golangci-lint
|
||||||
run: |
|
run: |
|
||||||
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b . v1.30.0
|
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b . v1.30.0
|
||||||
@ -57,4 +60,4 @@ jobs:
|
|||||||
run: make -f builder.Makefile cli
|
run: make -f builder.Makefile cli
|
||||||
|
|
||||||
- name: E2E Test
|
- name: E2E Test
|
||||||
run: make e2e-local
|
run: make e2e-local
|
||||||
|
@ -21,6 +21,7 @@ FROM --platform=${BUILDPLATFORM} golang:${GO_VERSION} AS base
|
|||||||
WORKDIR /api
|
WORKDIR /api
|
||||||
ENV GO111MODULE=on
|
ENV GO111MODULE=on
|
||||||
RUN apk add --no-cache \
|
RUN apk add --no-cache \
|
||||||
|
git \
|
||||||
docker \
|
docker \
|
||||||
make \
|
make \
|
||||||
protoc \
|
protoc \
|
||||||
@ -45,6 +46,13 @@ RUN --mount=target=. \
|
|||||||
GIT_TAG=${GIT_TAG} \
|
GIT_TAG=${GIT_TAG} \
|
||||||
make -f builder.Makefile lint
|
make -f builder.Makefile lint
|
||||||
|
|
||||||
|
FROM base AS import-restrictions-base
|
||||||
|
RUN go get github.com/docker/import-restrictions
|
||||||
|
|
||||||
|
FROM import-restrictions-base AS import-restrictions
|
||||||
|
RUN --mount=target=. \
|
||||||
|
make -f builder.Makefile import-restrictions
|
||||||
|
|
||||||
FROM base AS make-cli
|
FROM base AS make-cli
|
||||||
ENV CGO_ENABLED=0
|
ENV CGO_ENABLED=0
|
||||||
ARG TARGETOS
|
ARG TARGETOS
|
||||||
|
4
Makefile
4
Makefile
@ -72,6 +72,10 @@ lint: ## run linter(s)
|
|||||||
--build-arg GIT_TAG=$(GIT_TAG) \
|
--build-arg GIT_TAG=$(GIT_TAG) \
|
||||||
--target lint
|
--target lint
|
||||||
|
|
||||||
|
import-restrictions: ## run import-restrictions script
|
||||||
|
@docker build . \
|
||||||
|
--target import-restrictions
|
||||||
|
|
||||||
serve: cli ## start server
|
serve: cli ## start server
|
||||||
@./bin/docker serve --address unix:///tmp/backend.sock
|
@./bin/docker serve --address unix:///tmp/backend.sock
|
||||||
|
|
||||||
|
@ -56,6 +56,9 @@ test:
|
|||||||
lint:
|
lint:
|
||||||
golangci-lint run --timeout 10m0s ./...
|
golangci-lint run --timeout 10m0s ./...
|
||||||
|
|
||||||
|
import-restrictions:
|
||||||
|
import-restrictions --configuration import-restrictions.yaml
|
||||||
|
|
||||||
check-license-headers:
|
check-license-headers:
|
||||||
./scripts/validate/fileheader
|
./scripts/validate/fileheader
|
||||||
|
|
||||||
|
33
import-restrictions.yaml
Normal file
33
import-restrictions.yaml
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
# Backends shouldn't depend on other backends or the cli
|
||||||
|
- path: ./aci
|
||||||
|
forbiddenImports:
|
||||||
|
- github.com/docker/api/cli
|
||||||
|
- github.com/docker/api/ecs
|
||||||
|
- github.com/docker/api/example
|
||||||
|
- github.com/docker/api/local
|
||||||
|
- github.com/docker/api/metrics
|
||||||
|
- github.com/docker/api/server
|
||||||
|
- path: ./ecs
|
||||||
|
forbiddenImports:
|
||||||
|
- github.com/docker/api/aci
|
||||||
|
- github.com/docker/api/cli
|
||||||
|
- github.com/docker/api/example
|
||||||
|
- github.com/docker/api/local
|
||||||
|
- github.com/docker/api/metrics
|
||||||
|
- github.com/docker/api/server
|
||||||
|
- path: ./example
|
||||||
|
forbiddenImports:
|
||||||
|
- github.com/docker/api/aci
|
||||||
|
- github.com/docker/api/cli
|
||||||
|
- github.com/docker/api/ecs
|
||||||
|
- github.com/docker/api/local
|
||||||
|
- github.com/docker/api/metrics
|
||||||
|
- github.com/docker/api/server
|
||||||
|
- path: ./local
|
||||||
|
forbiddenImports:
|
||||||
|
- github.com/docker/api/aci
|
||||||
|
- github.com/docker/api/cli
|
||||||
|
- github.com/docker/api/ecs
|
||||||
|
- github.com/docker/api/example
|
||||||
|
- github.com/docker/api/metrics
|
||||||
|
- github.com/docker/api/server
|
Loading…
x
Reference in New Issue
Block a user