Merge pull request #21439 from dvdksn/test-refactor
chore: refactor / fix tests
|
@ -37,3 +37,4 @@
|
||||||
|
|
||||||
/content/manuals/accounts/ @sarahsanders-docker
|
/content/manuals/accounts/ @sarahsanders-docker
|
||||||
|
|
||||||
|
/hack @dvdksn
|
||||||
|
|
|
@ -2,7 +2,7 @@ area/release:
|
||||||
- changed-files:
|
- changed-files:
|
||||||
- any-glob-to-any-file:
|
- any-glob-to-any-file:
|
||||||
- .github/**
|
- .github/**
|
||||||
- _releaser/**
|
- hack/releaser/**
|
||||||
- netlify.toml
|
- netlify.toml
|
||||||
|
|
||||||
area/config:
|
area/config:
|
||||||
|
@ -14,6 +14,7 @@ area/config:
|
||||||
- docker-bake.hcl
|
- docker-bake.hcl
|
||||||
- hugo.yaml
|
- hugo.yaml
|
||||||
- pagefind.yml
|
- pagefind.yml
|
||||||
|
- hack/vendor
|
||||||
|
|
||||||
area/contrib:
|
area/contrib:
|
||||||
- changed-files:
|
- changed-files:
|
||||||
|
@ -28,7 +29,7 @@ area/tests:
|
||||||
- .markdownlint.json
|
- .markdownlint.json
|
||||||
- .vale.ini
|
- .vale.ini
|
||||||
- _vale/**
|
- _vale/**
|
||||||
- scripts/test_*
|
- hack/test/*
|
||||||
|
|
||||||
area/build:
|
area/build:
|
||||||
- changed-files:
|
- changed-files:
|
||||||
|
@ -183,3 +184,4 @@ dependencies:
|
||||||
- go.sum
|
- go.sum
|
||||||
- package*.json
|
- package*.json
|
||||||
- _vendor/**
|
- _vendor/**
|
||||||
|
- hack/vendor
|
||||||
|
|
|
@ -110,10 +110,7 @@ RUN htmltest
|
||||||
FROM alpine:${ALPINE_VERSION} AS unused-media
|
FROM alpine:${ALPINE_VERSION} AS unused-media
|
||||||
RUN apk add --no-cache fd ripgrep
|
RUN apk add --no-cache fd ripgrep
|
||||||
WORKDIR /test
|
WORKDIR /test
|
||||||
RUN --mount=type=bind,target=. <<"EOT"
|
RUN --mount=type=bind,target=. ./hack/test/unused_media
|
||||||
set -ex
|
|
||||||
./scripts/test_unused_media.sh
|
|
||||||
EOT
|
|
||||||
|
|
||||||
# path-warnings checks for duplicate target paths
|
# path-warnings checks for duplicate target paths
|
||||||
FROM build-base AS path-warnings
|
FROM build-base AS path-warnings
|
||||||
|
@ -145,7 +142,7 @@ RUN apk add yq
|
||||||
COPY --from=build /project/public ./public
|
COPY --from=build /project/public ./public
|
||||||
RUN --mount=type=bind,target=. <<"EOT"
|
RUN --mount=type=bind,target=. <<"EOT"
|
||||||
set -ex
|
set -ex
|
||||||
./scripts/test_go_redirects.sh
|
./hack/test/go_redirects
|
||||||
EOT
|
EOT
|
||||||
|
|
||||||
# release is an empty scratch image with only compiled assets
|
# release is an empty scratch image with only compiled assets
|
||||||
|
|
2
Makefile
|
@ -1,3 +1,3 @@
|
||||||
.PHONY: vendor
|
.PHONY: vendor
|
||||||
vendor: ## vendor hugo modules
|
vendor: ## vendor hugo modules
|
||||||
./scripts/vendor.sh
|
./hack/vendor
|
||||||
|
|
Before Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 46 KiB |
Before Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 4.5 KiB |
Before Width: | Height: | Size: 5.5 KiB |
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 3.2 KiB |
Before Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 8.5 KiB |
Before Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 63 KiB |
Before Width: | Height: | Size: 41 KiB |
Before Width: | Height: | Size: 89 KiB |
Before Width: | Height: | Size: 42 KiB |
|
@ -73,12 +73,12 @@ target "path-warnings" {
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
# releaser targets are defined in _releaser/Dockerfile
|
# releaser targets are defined in hack/releaser/Dockerfile
|
||||||
# and are used for AWS S3 deployment
|
# and are used for AWS S3 deployment
|
||||||
#
|
#
|
||||||
|
|
||||||
target "releaser-build" {
|
target "releaser-build" {
|
||||||
context = "_releaser"
|
context = "hack/releaser"
|
||||||
target = "releaser"
|
target = "releaser"
|
||||||
output = ["type=cacheonly"]
|
output = ["type=cacheonly"]
|
||||||
provenance = false
|
provenance = false
|
||||||
|
@ -119,7 +119,7 @@ target "_common-aws" {
|
||||||
|
|
||||||
target "aws-s3-update-config" {
|
target "aws-s3-update-config" {
|
||||||
inherits = ["_common-aws"]
|
inherits = ["_common-aws"]
|
||||||
context = "_releaser"
|
context = "hack/releaser"
|
||||||
target = "aws-s3-update-config"
|
target = "aws-s3-update-config"
|
||||||
no-cache-filter = ["aws-update-config"]
|
no-cache-filter = ["aws-update-config"]
|
||||||
output = ["type=cacheonly"]
|
output = ["type=cacheonly"]
|
||||||
|
@ -127,7 +127,7 @@ target "aws-s3-update-config" {
|
||||||
|
|
||||||
target "aws-lambda-invoke" {
|
target "aws-lambda-invoke" {
|
||||||
inherits = ["_common-aws"]
|
inherits = ["_common-aws"]
|
||||||
context = "_releaser"
|
context = "hack/releaser"
|
||||||
target = "aws-lambda-invoke"
|
target = "aws-lambda-invoke"
|
||||||
no-cache-filter = ["aws-lambda-invoke"]
|
no-cache-filter = ["aws-lambda-invoke"]
|
||||||
output = ["type=cacheonly"]
|
output = ["type=cacheonly"]
|
||||||
|
@ -135,7 +135,7 @@ target "aws-lambda-invoke" {
|
||||||
|
|
||||||
target "aws-cloudfront-update" {
|
target "aws-cloudfront-update" {
|
||||||
inherits = ["_common-aws"]
|
inherits = ["_common-aws"]
|
||||||
context = "_releaser"
|
context = "hack/releaser"
|
||||||
target = "aws-cloudfront-update"
|
target = "aws-cloudfront-update"
|
||||||
contexts = {
|
contexts = {
|
||||||
sitedir = DOCS_SITE_DIR
|
sitedir = DOCS_SITE_DIR
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
module github.com/docker/docs/_releaser
|
module github.com/docker/docs/hack/releaser
|
||||||
|
|
||||||
go 1.22
|
go 1.22
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
echo "checking for unused media files..."
|
||||||
|
FORMATS="svg png webp mp4 jpg jpeg"
|
||||||
|
DIRECTORIES="content static"
|
||||||
|
|
||||||
|
FORMAT_FLAGS=""
|
||||||
|
for format in $FORMATS; do
|
||||||
|
FORMAT_FLAGS="$FORMAT_FLAGS -e $format"
|
||||||
|
done
|
||||||
|
|
||||||
|
echo "Searching for media with formats: $FORMATS"
|
||||||
|
echo "Searching in directories: $DIRECTORIES"
|
||||||
|
|
||||||
|
MEDIA=$(fd . $FORMAT_FLAGS $DIRECTORIES)
|
||||||
|
|
||||||
|
UNUSED_COUNT=0
|
||||||
|
|
||||||
|
for file in $MEDIA; do
|
||||||
|
rg -q "$(basename $file)" .
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "$file"
|
||||||
|
UNUSED_COUNT=$((UNUSED_COUNT + 1))
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ $UNUSED_COUNT -eq 0 ]; then
|
||||||
|
echo "No unused media files."
|
||||||
|
exit 0
|
||||||
|
else
|
||||||
|
echo "$UNUSED_COUNT unused media files found. Please remove them."
|
||||||
|
exit 1
|
||||||
|
fi
|
|
@ -1,23 +0,0 @@
|
||||||
#!/usr/bin/env sh
|
|
||||||
|
|
||||||
# Find all media files {svg,png,webp,mp4,jpg,jpeg} in {content,static}
|
|
||||||
MEDIA=$(fd . -e "svg" -e "png" -e "webp" -e "mp4" -e "jpg" -e "jpeg" ./content ./static)
|
|
||||||
TEMPFILE=$(mktemp)
|
|
||||||
|
|
||||||
for file in $MEDIA; do
|
|
||||||
rg -q "$(basename $file)"
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "$file" >> "$TEMPFILE"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
UNUSED_FILES=$(< $TEMPFILE)
|
|
||||||
rm $TEMPFILE
|
|
||||||
|
|
||||||
if [ -z "$UNUSED_FILES" ]; then
|
|
||||||
exit 0
|
|
||||||
else
|
|
||||||
echo "$(echo "$UNUSED_FILES" | wc -l) unused media files. Please remove them."
|
|
||||||
printf "%s\n" ${UNUSED_FILES[@]}
|
|
||||||
exit 1
|
|
||||||
fi
|
|
|
@ -1,14 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
||||||
<svg width="24px" height="24px" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
|
|
||||||
<!-- Generator: Sketch 42 (36781) - http://www.bohemiancoding.com/sketch -->
|
|
||||||
<title>Round Check</title>
|
|
||||||
<desc>Created with Sketch.</desc>
|
|
||||||
<defs></defs>
|
|
||||||
<g id="System" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd">
|
|
||||||
<g id="Round-Check">
|
|
||||||
<polygon id="Icon-Bounds" points="0 0 24 0 24 24 0 24"></polygon>
|
|
||||||
<circle id="Oval" fill="#00CBCA" cx="12" cy="12" r="11"></circle>
|
|
||||||
<polygon id="Combined-Shape" fill="#FBFBFC" points="7.04599508 11 5 13.1940611 10.1213203 17.9711941 18.9711941 9.12132034 16.8498737 7 10.0492724 13.8006014"></polygon>
|
|
||||||
</g>
|
|
||||||
</g>
|
|
||||||
</svg>
|
|
Before Width: | Height: | Size: 846 B |