mirror of
https://github.com/docker/buildx.git
synced 2024-11-22 15:37:16 +08:00
b61b29f603
Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
36 lines
1.5 KiB
Bash
Executable File
36 lines
1.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -eu -o pipefail
|
|
|
|
: "${BUILDX_CMD=docker buildx}"
|
|
|
|
: "${TEST_IMAGE_BUILD=1}"
|
|
: "${TEST_IMAGE_ID=buildx-tests}"
|
|
|
|
: "${TEST_REPORT_SUFFIX=}"
|
|
: "${TEST_KEEP_CACHE=}"
|
|
: "${TEST_DOCKERD=}"
|
|
: "${TEST_BUILDKIT_IMAGE=}"
|
|
: "${TEST_BUILDX_EXPERIMENTAL=}"
|
|
|
|
if [ "$TEST_IMAGE_BUILD" = "1" ]; then
|
|
${BUILDX_CMD} bake integration-test --set "*.output=type=docker,name=$TEST_IMAGE_ID"
|
|
fi
|
|
|
|
testReportsDir="$(pwd)/bin/testreports"
|
|
mkdir -p "$testReportsDir"
|
|
testReportsVol="-v $testReportsDir:/testreports"
|
|
gotestsumArgs="--format=standard-verbose --jsonfile=/testreports/go-test-report$TEST_REPORT_SUFFIX.json --junitfile=/testreports/junit-report$TEST_REPORT_SUFFIX.xml"
|
|
gotestArgs="-mod=vendor -coverprofile=/testreports/coverage-report$TEST_REPORT_SUFFIX.txt -covermode=atomic"
|
|
|
|
cacheVolume="buildx-test-cache"
|
|
if ! docker container inspect "$cacheVolume" >/dev/null 2>/dev/null; then
|
|
docker create -v /root/.cache -v /root/.cache/registry -v /go/pkg/mod --name "$cacheVolume" alpine
|
|
fi
|
|
if [ "$TEST_KEEP_CACHE" != "1" ]; then
|
|
trap 'docker rm -v $cacheVolume' EXIT
|
|
fi
|
|
|
|
cid=$(docker create --rm -v /tmp $testReportsVol --volumes-from=$cacheVolume -e GITHUB_REF -e TEST_DOCKERD -e TEST_BUILDKIT_IMAGE -e TEST_BUILDX_EXPERIMENTAL -e SKIP_INTEGRATION_TESTS -e GOTESTSUM_FORMAT ${BUILDKIT_INTEGRATION_SNAPSHOTTER:+"-eBUILDKIT_INTEGRATION_SNAPSHOTTER"} -e BUILDKIT_REGISTRY_MIRROR_DIR=/root/.cache/registry --privileged $TEST_IMAGE_ID gotestsum $gotestsumArgs --packages="${TESTPKGS:-./...}" -- $gotestArgs ${TESTFLAGS:--v})
|
|
docker start -a -i $cid
|