From 0f84eb4cd70dca62734150703f6f6656971fb129 Mon Sep 17 00:00:00 2001 From: Tanner Jones Date: Mon, 30 Oct 2023 14:47:38 -0800 Subject: [PATCH 1/8] Updated test-unit.yml to comment a coverage report Signed-off-by: Tanner Jones --- .github/workflows/test-unit.yml | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/.github/workflows/test-unit.yml b/.github/workflows/test-unit.yml index d09f8f376..d37e39024 100644 --- a/.github/workflows/test-unit.yml +++ b/.github/workflows/test-unit.yml @@ -18,14 +18,19 @@ jobs: - uses: actions/checkout@v3 with: { fetch-depth: 1 } - uses: actions/setup-go@v3 - with: { go-version: "${{ matrix.go }}" } + with: + go-version: "${{ matrix.go }}" - run: go version - - run: make test-unit race=true - - uses: codecov/codecov-action@v1 + - run: make test-unit-with-coverage race=true + - name: Upload coverage report + uses: codecov/codecov-action@v1 with: - file: tmp/unit.cov - flags: unit - if: matrix.os == 'ubuntu-latest' + file: coverage.out + - name: Comment coverage report + run: | + if [ "${{ matrix.os }}" == "ubuntu-latest" ]; then # will only run on ubuntu + curl -sSfL https://codecov.io/bash | bash -s -- -Z -K -f coverage.out || echo "Codecov upload failed" + fi bench: name: Benchmarks @@ -34,6 +39,7 @@ jobs: - uses: actions/checkout@v3 with: { fetch-depth: 1 } - uses: actions/setup-go@v3 - with: { go-version: '1.x' } + with: + go-version: '1.x' - run: go version - - run: make test-bench + - run: make test-bench \ No newline at end of file From bdffefb24386d8f7842af03cb7f404ee7400cb5e Mon Sep 17 00:00:00 2001 From: Tanner Jones Date: Mon, 30 Oct 2023 14:50:20 -0800 Subject: [PATCH 2/8] Updated CHANGELOG.md for comment test coverage report Signed-off-by: Tanner Jones --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 431e4b761..868157761 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -47,6 +47,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) - Updated Developer guide to include docker build instructions ([#385](https://github.com/opensearch-project/opensearch-go/pull/385) - Test against version 2.9.0,2.10.0, run tests in all branches, change intergration tests to wait for OpenSearch to start ([#392](https://github.com/opensearch-project/opensearch-go/pull/392)) - Makefile: use docker golangci-lint, run integration test on `.` folder, change coverage generation ([#392](https://github.com/opensearch-project/opensearch-go/pull/392)) +- test-unit.yml: added PR comment for unit test coverage report ([#407](https://github.com/opensearch-project/opensearch-go/pull/407)) ### Deprecated From a8d2541ddda3430fa9209faa06f98f7f273ab075 Mon Sep 17 00:00:00 2001 From: Tanner Jones Date: Mon, 30 Oct 2023 14:54:13 -0800 Subject: [PATCH 3/8] Updated test-unit make command Signed-off-by: Tanner Jones --- .github/workflows/test-unit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-unit.yml b/.github/workflows/test-unit.yml index d37e39024..9d35de257 100644 --- a/.github/workflows/test-unit.yml +++ b/.github/workflows/test-unit.yml @@ -21,7 +21,7 @@ jobs: with: go-version: "${{ matrix.go }}" - run: go version - - run: make test-unit-with-coverage race=true + - run: make test-unit race=true - name: Upload coverage report uses: codecov/codecov-action@v1 with: From a06cc0921c65b1411294028935785ab1ef279d8d Mon Sep 17 00:00:00 2001 From: Tanner Jones Date: Mon, 30 Oct 2023 15:05:16 -0800 Subject: [PATCH 4/8] Updated test-unit make command to include all OSs Signed-off-by: Tanner Jones --- .github/workflows/test-unit.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test-unit.yml b/.github/workflows/test-unit.yml index 9d35de257..658de6ab5 100644 --- a/.github/workflows/test-unit.yml +++ b/.github/workflows/test-unit.yml @@ -28,10 +28,11 @@ jobs: file: coverage.out - name: Comment coverage report run: | - if [ "${{ matrix.os }}" == "ubuntu-latest" ]; then # will only run on ubuntu - curl -sSfL https://codecov.io/bash | bash -s -- -Z -K -f coverage.out || echo "Codecov upload failed" - fi - + case ${{ matrix.os }} in + ubuntu-latest|windows-latest|macOS-latest) + curl -sSfL https://codecov.io/bash | bash -s -- -Z -K -f coverage.out || echo "Codecov upload failed" + ;; + esac bench: name: Benchmarks runs-on: ubuntu-latest From 9e62467512500ce8f846dd9805bb3aeaf820ca06 Mon Sep 17 00:00:00 2001 From: Tanner Jones Date: Mon, 30 Oct 2023 15:18:05 -0800 Subject: [PATCH 5/8] Updated test-unit make command fix Signed-off-by: Tanner Jones --- .github/workflows/test-unit.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-unit.yml b/.github/workflows/test-unit.yml index 658de6ab5..b4fa240e0 100644 --- a/.github/workflows/test-unit.yml +++ b/.github/workflows/test-unit.yml @@ -29,7 +29,7 @@ jobs: - name: Comment coverage report run: | case ${{ matrix.os }} in - ubuntu-latest|windows-latest|macOS-latest) + ubuntu-latest|windows-latest|macOS-latest curl -sSfL https://codecov.io/bash | bash -s -- -Z -K -f coverage.out || echo "Codecov upload failed" ;; esac From 06dd63f97eb21b54957416193f01e4b7cfb305e8 Mon Sep 17 00:00:00 2001 From: Tanner Jones Date: Mon, 30 Oct 2023 15:23:13 -0800 Subject: [PATCH 6/8] Updated test-unit make command fix Signed-off-by: Tanner Jones --- .github/workflows/test-unit.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/test-unit.yml b/.github/workflows/test-unit.yml index b4fa240e0..a9403f9bc 100644 --- a/.github/workflows/test-unit.yml +++ b/.github/workflows/test-unit.yml @@ -28,11 +28,9 @@ jobs: file: coverage.out - name: Comment coverage report run: | - case ${{ matrix.os }} in - ubuntu-latest|windows-latest|macOS-latest - curl -sSfL https://codecov.io/bash | bash -s -- -Z -K -f coverage.out || echo "Codecov upload failed" - ;; - esac + if [ "${{ matrix.os }}" == "ubuntu-latest" ] || [ "${{ matrix.os }}" == "windows-latest" ] || [ "${{ matrix.os }}" == "macOS-latest" ]; then + curl -sSfL https://codecov.io/bash | bash -s -- -Z -K -f coverage.out || echo "Codecov upload failed" + fi bench: name: Benchmarks runs-on: ubuntu-latest From 36c15a510c1e9a5647ae7a67748dd81b4e2bfc23 Mon Sep 17 00:00:00 2001 From: Tanner Jones Date: Mon, 30 Oct 2023 15:40:43 -0800 Subject: [PATCH 7/8] Updated test-unit make command fix for windows Signed-off-by: Tanner Jones --- .github/workflows/test-unit.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-unit.yml b/.github/workflows/test-unit.yml index a9403f9bc..bd9d7d8d5 100644 --- a/.github/workflows/test-unit.yml +++ b/.github/workflows/test-unit.yml @@ -28,8 +28,8 @@ jobs: file: coverage.out - name: Comment coverage report run: | - if [ "${{ matrix.os }}" == "ubuntu-latest" ] || [ "${{ matrix.os }}" == "windows-latest" ] || [ "${{ matrix.os }}" == "macOS-latest" ]; then - curl -sSfL https://codecov.io/bash | bash -s -- -Z -K -f coverage.out || echo "Codecov upload failed" + if [[ "windows-latest" == "ubuntu-latest" || "windows-latest" == "windows-latest" || "windows-latest" == "macOS-latest" ]]; then + ... fi bench: name: Benchmarks From 4ee874024550aca4989dca4ece01004d3f71a71a Mon Sep 17 00:00:00 2001 From: Tanner Jones Date: Mon, 30 Oct 2023 15:48:43 -0800 Subject: [PATCH 8/8] Updated test-unit make command fix Signed-off-by: Tanner Jones --- .github/workflows/test-unit.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-unit.yml b/.github/workflows/test-unit.yml index bd9d7d8d5..dd0c572d6 100644 --- a/.github/workflows/test-unit.yml +++ b/.github/workflows/test-unit.yml @@ -28,8 +28,8 @@ jobs: file: coverage.out - name: Comment coverage report run: | - if [[ "windows-latest" == "ubuntu-latest" || "windows-latest" == "windows-latest" || "windows-latest" == "macOS-latest" ]]; then - ... + if [ "${{ matrix.os }}" == "ubuntu-latest" ] || [ "${{ matrix.os }}" == "windows-latest" ] || [ "${{ matrix.os }}" == "macOS-latest" ]; then + curl -sSfL https://codecov.io/bash | bash -s -- -Z -K -f coverage.out || echo "Codecov upload failed" fi bench: name: Benchmarks