Skip to content

Commit

Permalink
Collect code coverage on all unit test runs
Browse files Browse the repository at this point in the history
  • Loading branch information
thschmitt committed Dec 24, 2024
1 parent 1315e06 commit f95c4ff
Showing 1 changed file with 18 additions and 24 deletions.
42 changes: 18 additions & 24 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,11 @@ jobs:
path: build/packages/
if-no-files-found: error

test_linux:
runs-on: ubuntu-latest
test:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -52,29 +55,17 @@ jobs:
go-version: ${{ env.GO_VERSION }}
cache: true
- name: Test
run: go test -coverprofile="coverage.out" -coverpkg "$(go list github.com/UiPath/uipathcli/... | grep -v 'test' | tr '\n' ',')" ./...
run: go test -coverprofile="coverage.out" -coverpkg "github.com/UiPath/uipathcli,github.com/UiPath/uipathcli/auth,github.com/UiPath/uipathcli/cache,github.com/UiPath/uipathcli/commandline,github.com/UiPath/uipathcli/config,github.com/UiPath/uipathcli/executor,github.com/UiPath/uipathcli/log,github.com/UiPath/uipathcli/output,github.com/UiPath/uipathcli/parser,github.com/UiPath/uipathcli/plugin,github.com/UiPath/uipathcli/plugin/digitizer,github.com/UiPath/uipathcli/plugin/orchestrator,github.com/UiPath/uipathcli/utils" ./...
- name: Coverage
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
go install github.com/mattn/goveralls@latest
goveralls -coverprofile="coverage.out" -service="github"
goveralls -coverprofile="coverage.out" -service="github" -parallel -flagname="uipathcli-${{ matrix.os }}"
test_windows:
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
cache: true
- name: Test
run: go test ./...

test_macos:
runs-on: macos-latest
tests_completed:
needs: test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -83,11 +74,14 @@ jobs:
with:
go-version: ${{ env.GO_VERSION }}
cache: true
- name: Test
run: go test ./...
- name: Complete Coverage
env:
COVERALLS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
go run github.com/mattn/goveralls -parallel-finish
publish_pages:
needs: [build, test_linux, test_windows, test_macos]
needs: [build, tests_completed]
permissions:
pages: write
id-token: write
Expand Down Expand Up @@ -115,7 +109,7 @@ jobs:
uses: actions/deploy-pages@v4

release:
needs: [build, test_linux, test_windows, test_macos]
needs: [build, tests_completed]
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
env:
Expand Down

0 comments on commit f95c4ff

Please sign in to comment.