diff --git a/.github/workflows/Go.yml b/.github/workflows/Go.yml index 946ccfd..f5c3fc8 100644 --- a/.github/workflows/Go.yml +++ b/.github/workflows/Go.yml @@ -37,4 +37,22 @@ jobs: - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v4 with: - token: ${{secrets.CODECOV_TOKEN}} \ No newline at end of file + token: ${{secrets.CODECOV_TOKEN}} + + # 安装依赖项 + - name: Install dependencies + run: | + go install github.com/jstemmer/go-junit-report@latest + go install gotest.tools/gotestsum@latest + + # 运行测试并生成覆盖率报告 + - name: Run tests and generate coverage report + run: gotestsum --junitfile junit.xml + + # 上传测试结果到 Codecov + - name: Upload test results to Codecov + if: ${{ !cancelled() }} + uses: codecov/test-results-action@v1 + with: + token: ${{ secrets.CODECOV_TOKEN }} + diff --git a/.gitignore b/.gitignore index 9d8850c..5acaf2e 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ *.test coverage.out coverage.txt +junit.xml # Output of the go coverage tool, specifically when used with LiteIDE *.out