ci: add check for duplicate target paths / aliases

Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com>
This commit is contained in:
David Karlsson 2024-08-12 17:48:39 +02:00
parent 886a27ae8d
commit 83adeefaec
3 changed files with 19 additions and 1 deletions

View File

@ -57,6 +57,7 @@ jobs:
- unused-media
- test-go-redirects
- dockerfile-lint
- path-warnings
steps:
-
name: Checkout

View File

@ -109,6 +109,18 @@ set -ex
./scripts/test_unused_media.sh
EOT
# path-warnings checks for duplicate target paths
FROM build-base AS path-warnings
RUN hugo --printPathWarnings > /path-warnings.txt
RUN <<EOT
DUPLICATE_TARGETS=$(grep "Duplicate target paths" /path-warnings.txt)
if [ ! -z "$DUPLICATE_TARGETS" ]; then
echo "$DUPLICATE_TARGETS"
echo "You probably have a duplicate alias defined. Please check your aliases."
exit 1
fi
EOT
# pagefind installs the Pagefind runtime
FROM base AS pagefind
ARG PAGEFIND_VERSION=1.1.0

View File

@ -32,7 +32,7 @@ target "release" {
}
group "validate" {
targets = ["lint", "test", "unused-media", "test-go-redirects", "dockerfile-lint"]
targets = ["lint", "test", "unused-media", "test-go-redirects", "dockerfile-lint", "path-warnings"]
}
target "test" {
@ -63,6 +63,11 @@ target "dockerfile-lint" {
call = "check"
}
target "path-warnings" {
target = "path-warnings"
output = ["type=cacheonly"]
}
#
# releaser targets are defined in _releaser/Dockerfile
# and are used for AWS S3 deployment