unify flags, codecov revamp a bit (#2773)

Signed-off-by: David Fridrich <fridrich.david19@gmail.com>
This commit is contained in:
David Fridrich 2025-05-12 15:25:44 +02:00 committed by GitHub
parent ff63772166
commit 55df89a874
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 11 additions and 73 deletions

View File

@ -16,9 +16,12 @@ comment:
behavior: default
ignore:
- "testdata"
- "**/zz_*generated*.go"
- "**/zz*_generated.go"
- "templates"
- "hack"
- "test"
- "generate"
- "docs"
- "plugin"
- "schema"
- "third_party"

View File

@ -41,7 +41,7 @@ jobs:
- uses: codecov/codecov-action@v5
with:
files: ./coverage.txt
flags: unit-tests-${{ matrix.os }}
flags: unit-tests
fail_ci_if_error: true
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}
@ -130,7 +130,7 @@ jobs:
- uses: codecov/codecov-action@v5
with:
files: ./coverage.txt
flags: e2e-test
flags: e2e-tests
fail_ci_if_error: true
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}
@ -182,7 +182,7 @@ jobs:
- uses: codecov/codecov-action@v5
with:
files: ./coverage.txt
flags: e2e-test-oncluster
flags: e2e-tests
fail_ci_if_error: true
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}

View File

@ -64,7 +64,3 @@ jobs:
echo "::group::cluster containers logs"
stern '.*' --all-namespaces --no-follow
echo "::endgroup::"
- uses: codecov/codecov-action@v5
with:
files: ./coverage.txt
flags: e2e-test-oncluster-runtime

View File

@ -54,4 +54,4 @@ jobs:
- uses: codecov/codecov-action@v5
with:
files: ./coverage.txt
flags: e2e-test-oncluster
flags: e2e-tests

View File

@ -76,7 +76,3 @@ jobs:
fi
done
echo "------------------ finished! attempt $attempt ------------------"
- uses: codecov/codecov-action@v5
with:
files: ./coverage.txt
flags: e2e-test-runtime-${{ matrix.runtime }}

View File

@ -44,4 +44,4 @@ jobs:
- uses: codecov/codecov-action@v5
with:
files: ./coverage.txt
flags: e2e-test
flags: e2e-tests

View File

@ -44,24 +44,7 @@ jobs:
- name: Template Unit Tests
if: matrix.os != 'ubuntu-latest'
run: make test-templates
- name: "Archive code coverage results"
uses: actions/upload-artifact@v4
with:
name: coverage-${{ matrix.os }}
path: ./coverage.txt
retention-days: 1
upload-coverage:
needs: [test]
name: "Upload coverage"
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v4
- name: Download Coverage
run: |
gh run download -R ${{ github.repository }} ${{ github.run_id }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: codecov/codecov-action@v5
with:
files: ./coverage-ubuntu-latest/coverage.txt,./coverage-windows-latest/coverage.txt,./coverage-macos-latest/coverage.txt
files: ./coverage.txt
flags: unit-tests

View File

@ -1,40 +0,0 @@
package docker
import (
"reflect"
"testing"
"github.com/docker/docker/client"
)
// We were not able to make codecov ignore zz_close_guarding_client_generated.go
// This is a workaround.
func TestAppeaseCoverageGods(t *testing.T) {
impl := &closeGuardingClient{}
var cli client.CommonAPIClient = impl
val := reflect.ValueOf(cli)
closeMeth := val.MethodByName("Close")
runAllMethods := func() {
for methIdx := 0; methIdx < val.NumMethod(); methIdx++ {
func() {
defer func() {
// catch the nil dereference since pimpl == nil
_ = recover()
}()
meth := val.Method(methIdx)
if meth == closeMeth {
// we don't want to test the Close() method
return
}
args := make([]reflect.Value, meth.Type().NumIn())
for argIdx := 0; argIdx < len(args); argIdx++ {
args[argIdx] = reflect.New(meth.Type().In(argIdx)).Elem()
}
meth.Call(args)
}()
}
}
runAllMethods()
impl.closed = true
runAllMethods()
}