mirror of
https://github.com/moby/moby.git
synced 2026-01-11 18:51:37 +00:00
ci(test): send coverage to codecov
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
23
.github/workflows/test.yml
vendored
23
.github/workflows/test.yml
vendored
@@ -89,6 +89,13 @@ jobs:
|
|||||||
tar -xzf /tmp/reports.tar.gz -C /tmp/reports
|
tar -xzf /tmp/reports.tar.gz -C /tmp/reports
|
||||||
sudo chown -R $(id -u):$(id -g) /tmp/reports
|
sudo chown -R $(id -u):$(id -g) /tmp/reports
|
||||||
tree -nh /tmp/reports
|
tree -nh /tmp/reports
|
||||||
|
-
|
||||||
|
name: Send to Codecov
|
||||||
|
uses: codecov/codecov-action@v3
|
||||||
|
with:
|
||||||
|
directory: ./bundles
|
||||||
|
env_vars: RUNNER_OS
|
||||||
|
flags: unit
|
||||||
-
|
-
|
||||||
name: Upload reports
|
name: Upload reports
|
||||||
if: always()
|
if: always()
|
||||||
@@ -222,6 +229,7 @@ jobs:
|
|||||||
make -o build test-integration
|
make -o build test-integration
|
||||||
env:
|
env:
|
||||||
TEST_SKIP_INTEGRATION_CLI: 1
|
TEST_SKIP_INTEGRATION_CLI: 1
|
||||||
|
TESTCOVERAGE: 1
|
||||||
-
|
-
|
||||||
name: Prepare reports
|
name: Prepare reports
|
||||||
if: always()
|
if: always()
|
||||||
@@ -235,6 +243,13 @@ jobs:
|
|||||||
tar -xzf /tmp/reports.tar.gz -C $reportsPath
|
tar -xzf /tmp/reports.tar.gz -C $reportsPath
|
||||||
sudo chown -R $(id -u):$(id -g) $reportsPath
|
sudo chown -R $(id -u):$(id -g) $reportsPath
|
||||||
tree -nh $reportsPath
|
tree -nh $reportsPath
|
||||||
|
-
|
||||||
|
name: Send to Codecov
|
||||||
|
uses: codecov/codecov-action@v3
|
||||||
|
with:
|
||||||
|
directory: ./bundles/test-integration
|
||||||
|
env_vars: RUNNER_OS
|
||||||
|
flags: integration,${{ matrix.mode }}
|
||||||
-
|
-
|
||||||
name: Test daemon logs
|
name: Test daemon logs
|
||||||
if: always()
|
if: always()
|
||||||
@@ -312,6 +327,7 @@ jobs:
|
|||||||
make -o build test-integration
|
make -o build test-integration
|
||||||
env:
|
env:
|
||||||
TEST_SKIP_INTEGRATION: 1
|
TEST_SKIP_INTEGRATION: 1
|
||||||
|
TESTCOVERAGE: 1
|
||||||
TESTFLAGS: "-test.run (${{ matrix.test }})/"
|
TESTFLAGS: "-test.run (${{ matrix.test }})/"
|
||||||
-
|
-
|
||||||
name: Prepare reports
|
name: Prepare reports
|
||||||
@@ -324,6 +340,13 @@ jobs:
|
|||||||
tar -xzf /tmp/reports.tar.gz -C $reportsPath
|
tar -xzf /tmp/reports.tar.gz -C $reportsPath
|
||||||
sudo chown -R $(id -u):$(id -g) $reportsPath
|
sudo chown -R $(id -u):$(id -g) $reportsPath
|
||||||
tree -nh $reportsPath
|
tree -nh $reportsPath
|
||||||
|
-
|
||||||
|
name: Send to Codecov
|
||||||
|
uses: codecov/codecov-action@v3
|
||||||
|
with:
|
||||||
|
directory: ./bundles/test-integration
|
||||||
|
env_vars: RUNNER_OS
|
||||||
|
flags: integration-cli
|
||||||
-
|
-
|
||||||
name: Test daemon logs
|
name: Test daemon logs
|
||||||
if: always()
|
if: always()
|
||||||
|
|||||||
2
Jenkinsfile
vendored
2
Jenkinsfile
vendored
@@ -234,7 +234,7 @@ pipeline {
|
|||||||
sh '''
|
sh '''
|
||||||
bundleName=unit
|
bundleName=unit
|
||||||
echo "Creating ${bundleName}-bundles.tar.gz"
|
echo "Creating ${bundleName}-bundles.tar.gz"
|
||||||
tar -czvf ${bundleName}-bundles.tar.gz bundles/junit-report*.xml bundles/go-test-report*.json bundles/profile*.out
|
tar -czvf ${bundleName}-bundles.tar.gz bundles/junit-report*.xml bundles/go-test-report*.json bundles/coverage*.out
|
||||||
'''
|
'''
|
||||||
|
|
||||||
archiveArtifacts artifacts: '*-bundles.tar.gz', allowEmptyArchive: true
|
archiveArtifacts artifacts: '*-bundles.tar.gz', allowEmptyArchive: true
|
||||||
|
|||||||
1
Makefile
1
Makefile
@@ -74,6 +74,7 @@ DOCKER_ENVS := \
|
|||||||
-e TEST_INTEGRATION_DIR \
|
-e TEST_INTEGRATION_DIR \
|
||||||
-e TEST_SKIP_INTEGRATION \
|
-e TEST_SKIP_INTEGRATION \
|
||||||
-e TEST_SKIP_INTEGRATION_CLI \
|
-e TEST_SKIP_INTEGRATION_CLI \
|
||||||
|
-e TESTCOVERAGE \
|
||||||
-e TESTDEBUG \
|
-e TESTDEBUG \
|
||||||
-e TESTDIRS \
|
-e TESTDIRS \
|
||||||
-e TESTFLAGS \
|
-e TESTFLAGS \
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ source "${MAKEDIR}/.go-autogen"
|
|||||||
: "${TEST_REPEAT:=1}"
|
: "${TEST_REPEAT:=1}"
|
||||||
: "${TESTFLAGS:=}"
|
: "${TESTFLAGS:=}"
|
||||||
: "${TESTDEBUG:=}"
|
: "${TESTDEBUG:=}"
|
||||||
|
: "${TESTCOVERAGE:=}"
|
||||||
: "${GOCACHE:=$(go env GOCACHE)}"
|
: "${GOCACHE:=$(go env GOCACHE)}"
|
||||||
|
|
||||||
setup_integration_test_filter() {
|
setup_integration_test_filter() {
|
||||||
@@ -80,7 +81,13 @@ run_test_integration_suites() {
|
|||||||
# Finally, we use periods as separator (instead of slashes) to be more
|
# Finally, we use periods as separator (instead of slashes) to be more
|
||||||
# in line with Java package names (which is what junit.xml was designed for)
|
# in line with Java package names (which is what junit.xml was designed for)
|
||||||
pkgname="$(go env GOARCH).${pkgname//\//.}"
|
pkgname="$(go env GOARCH).${pkgname//\//.}"
|
||||||
echo "Running $PWD (${pkgname}) flags=${flags}"
|
|
||||||
|
pkgtestflags=$flags
|
||||||
|
if [ -n "${TESTCOVERAGE}" ]; then
|
||||||
|
pkgtestflags="$pkgtestflags -test.coverprofile=${ABS_DEST}/${pkgname//./-}-coverage.out"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Running $PWD (${pkgname}) flags=${pkgtestflags}"
|
||||||
[ -n "$TESTDEBUG" ] && set -x
|
[ -n "$TESTDEBUG" ] && set -x
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2086
|
||||||
test_env gotestsum \
|
test_env gotestsum \
|
||||||
@@ -88,7 +95,7 @@ run_test_integration_suites() {
|
|||||||
--jsonfile="${ABS_DEST}/${pkgname//./-}-go-test-report.json" \
|
--jsonfile="${ABS_DEST}/${pkgname//./-}-go-test-report.json" \
|
||||||
--junitfile="${ABS_DEST}/${pkgname//./-}-junit-report.xml" \
|
--junitfile="${ABS_DEST}/${pkgname//./-}-junit-report.xml" \
|
||||||
--raw-command \
|
--raw-command \
|
||||||
-- go tool test2json -p "${pkgname}" -t ./test.main ${flags}
|
-- go tool test2json -p "${pkgname}" -t ./test.main ${pkgtestflags}
|
||||||
); then exit 1; fi
|
); then exit 1; fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
@@ -112,8 +119,12 @@ build_test_suite_binaries() {
|
|||||||
build_test_suite_binary() {
|
build_test_suite_binary() {
|
||||||
local dir="$1"
|
local dir="$1"
|
||||||
local out="$2"
|
local out="$2"
|
||||||
|
local testflags
|
||||||
echo Building test suite binary "$dir/$out"
|
echo Building test suite binary "$dir/$out"
|
||||||
go test -c -o "$dir/$out" -ldflags "$LDFLAGS" "${BUILDFLAGS[@]}" "$dir"
|
if [ -n "${TESTCOVERAGE}" ]; then
|
||||||
|
testflags="-cover -covermode=atomic"
|
||||||
|
fi
|
||||||
|
go test ${testflags} -c -o "$dir/$out" -ldflags "$LDFLAGS" "${BUILDFLAGS[@]}" "$dir"
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanup_test_suite_binaries() {
|
cleanup_test_suite_binaries() {
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ if [ -n "${base_pkg_list}" ]; then
|
|||||||
gotestsum --format=standard-quiet --jsonfile=bundles/go-test-report.json --junitfile=bundles/junit-report.xml -- \
|
gotestsum --format=standard-quiet --jsonfile=bundles/go-test-report.json --junitfile=bundles/junit-report.xml -- \
|
||||||
"${BUILDFLAGS[@]}" \
|
"${BUILDFLAGS[@]}" \
|
||||||
-cover \
|
-cover \
|
||||||
-coverprofile=bundles/profile.out \
|
-coverprofile=bundles/coverage.out \
|
||||||
-covermode=atomic \
|
-covermode=atomic \
|
||||||
${TESTFLAGS} \
|
${TESTFLAGS} \
|
||||||
${base_pkg_list}
|
${base_pkg_list}
|
||||||
@@ -44,7 +44,7 @@ if [ -n "${libnetwork_pkg_list}" ]; then
|
|||||||
gotestsum --format=standard-quiet --jsonfile=bundles/go-test-report-libnetwork.json --junitfile=bundles/junit-report-libnetwork.xml -- \
|
gotestsum --format=standard-quiet --jsonfile=bundles/go-test-report-libnetwork.json --junitfile=bundles/junit-report-libnetwork.xml -- \
|
||||||
"${BUILDFLAGS[@]}" \
|
"${BUILDFLAGS[@]}" \
|
||||||
-cover \
|
-cover \
|
||||||
-coverprofile=bundles/profile-libnetwork.out \
|
-coverprofile=bundles/coverage-libnetwork.out \
|
||||||
-covermode=atomic \
|
-covermode=atomic \
|
||||||
-p=1 \
|
-p=1 \
|
||||||
${TESTFLAGS} \
|
${TESTFLAGS} \
|
||||||
|
|||||||
Reference in New Issue
Block a user