From ee156d26fc5f147baadf2edc14dfb838ea08404a Mon Sep 17 00:00:00 2001 From: moonD4rk Date: Fri, 12 Jan 2024 22:00:24 +0800 Subject: [PATCH] ci: Improve GitHub actions across platforms - Improve Windows compatibility in build workflow - Optimize unit testing for pull requests - Upgrade Coveralls GitHub action to v2 for improved coverage tracking --- .github/workflows/build.yml | 17 +++++++++++++++-- .github/workflows/unittest.yml | 4 ++-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fb05ea94..ba8dd860 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,8 +25,21 @@ jobs: - name: Check out code into the Go module directory uses: actions/checkout@v2 - - name: Format - run: diff -u <(echo -n) <(gofmt -d .) + - name: Format Check + if: matrix.os == 'windows-latest' + run: | + $files = gofmt -l . + if ($files) { + Write-Output "Unformatted files:" + Write-Output $files + exit 1 + } + shell: pwsh + + - name: Format Check + if: matrix.os != 'windows-latest' + run: | + diff -u <(echo -n) <(gofmt -d .) - name: Get dependencies run: | diff --git a/.github/workflows/unittest.yml b/.github/workflows/unittest.yml index 1875eb48..54112698 100644 --- a/.github/workflows/unittest.yml +++ b/.github/workflows/unittest.yml @@ -1,5 +1,5 @@ on: - [push, pull_request] + [pull_request] name: run tests jobs: @@ -37,7 +37,7 @@ jobs: - name: Convert coverage.out to coverage.lcov uses: jandelgado/gcov2lcov-action@v1 - name: Coveralls - uses: coverallsapp/github-action@v1.1.2 + uses: coverallsapp/github-action@v2 with: github-token: ${{ secrets.github_token }} path-to-lcov: coverage.lcov \ No newline at end of file