Skip to content

Commit

Permalink
[#293] Generate test coverage results and include in release archive.
Browse files Browse the repository at this point in the history
---------

Signed-off-by: Ivan Marinov <[email protected]>
  • Loading branch information
IvanBoychevMarinov authored Nov 27, 2023
1 parent 4a18f1a commit fb9bcb0
Show file tree
Hide file tree
Showing 2 changed files with 197 additions and 2 deletions.
60 changes: 58 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,68 @@ jobs:
uses: actions/setup-go@v2
with:
go-version: 1.21.0
- name: Generate suite-connector Coverage
working-directory: ${{ env.BUILD_TMP }}/suite-connector
run: |
docker system prune -f
docker-compose -f ./docker/docker-compose-tests.yml up --build --no-color tests
go tool cover -func=coverage.out -o coverage.txt
go tool cover -html=coverage.out -o coverage.html
docker-compose -f ./docker/docker-compose-tests.yml down
- name: Generate container-management Coverage
working-directory: ${{ env.BUILD_TMP }}/container-management
run: |
go test ./... -v -coverprofile coverage.out
go tool cover -func=coverage.out -o coverage.txt
go tool cover -html=coverage.out -o coverage.html
- name: Generate file-upload Coverage
working-directory: ${{ env.BUILD_TMP }}/file-upload
run: |
go test ./... -v -coverprofile coverage.out -tags=unit
go tool cover -func=coverage.out -o coverage.txt
go tool cover -html=coverage.out -o coverage.html
- name: Generate software-update Coverage
working-directory: ${{ env.BUILD_TMP }}/software-update
run: |
go test ./... -v -coverprofile coverage.out -tags=unit
go tool cover -func=coverage.out -o coverage.txt
go tool cover -html=coverage.out -o coverage.html
- name: Generate local-digital-twins Coverage
working-directory: ${{ env.BUILD_TMP }}/local-digital-twins
run: |
go test ./... -v -coverprofile coverage.out -tags=unit
go tool cover -func=coverage.out -o coverage.txt
go tool cover -html=coverage.out -o coverage.html
- name: Generate suite-bootstrapping Coverage
working-directory: ${{ env.BUILD_TMP }}/suite-bootstrapping
run: |
go test ./... -v -coverprofile coverage.out -tags=unit
go tool cover -func=coverage.out -o coverage.txt
go tool cover -html=coverage.out -o coverage.html
- name: Generate file-backup Coverage
run: |
go test ./... -v -coverprofile coverage.out -tags=unit
go tool cover -func=coverage.out -o coverage.txt
go tool cover -html=coverage.out -o coverage.html
working-directory: ${{ env.BUILD_TMP }}/file-backup
- name: Generate system-metrics Coverage
working-directory: ${{ env.BUILD_TMP }}/system-metrics
run: |
go test ./... -v -coverprofile coverage.out -tags=unit
go tool cover -func=coverage.out -o coverage.txt
go tool cover -html=coverage.out -o coverage.html
- name: Generate update-manager Coverage
working-directory: ${{ env.BUILD_TMP }}/update-manager
run: |
go test -v -race ./... -coverprofile coverage.out -covermode atomic
go tool cover -func=coverage.out -o coverage.txt
go tool cover -html=coverage.out -o coverage.html
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
distribution: goreleaser
version: ~> 1.5
args: release --rm-dist
version: ~>1.22
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# GOPATH is no longer exported by the actions/setup-go@v2
Expand Down
139 changes: 139 additions & 0 deletions .goreleaser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,145 @@ archives:
strip_parent: true
info:
mode: 0644
- id: code-coverage
name_template: '{{ .ProjectName }}_{{ .Version }}_code_coverage'
meta: true
files:
- src: ./build-tmp/software-update/coverage.html
dst: software-update
strip_parent: true
info:
mode: 0644
- src: ./build-tmp/software-update/coverage.txt
dst: software-update
strip_parent: true
info:
mode: 0644
- src: ./build-tmp/software-update/coverage.out
dst: software-update
strip_parent: true
info:
mode: 0644
- src: ./build-tmp/suite-connector/coverage.html
dst: suite-connector
strip_parent: true
info:
mode: 0644
- src: ./build-tmp/suite-connector/coverage.txt
dst: suite-connector
strip_parent: true
info:
mode: 0644
- src: ./build-tmp/suite-connector/coverage.out
dst: suite-connector
strip_parent: true
info:
mode: 0644
- src: ./build-tmp/container-management/coverage.html
dst: container-management
strip_parent: true
info:
mode: 0644
- src: ./build-tmp/container-management/coverage.txt
dst: container-management
strip_parent: true
info:
mode: 0644
- src: ./build-tmp/container-management/coverage.out
dst: container-management
strip_parent: true
info:
mode: 0644
- src: ./build-tmp/file-upload/coverage.html
dst: file-upload
strip_parent: true
info:
mode: 0644
- src: ./build-tmp/file-upload/coverage.txt
dst: file-upload
strip_parent: true
info:
mode: 0644
- src: ./build-tmp/file-upload/coverage.out
dst: file-upload
strip_parent: true
info:
mode: 0644
- src: ./build-tmp/local-digital-twins/coverage.html
dst: local-digital-twins
strip_parent: true
info:
mode: 0644
- src: ./build-tmp/local-digital-twins/coverage.txt
dst: local-digital-twins
strip_parent: true
info:
mode: 0644
- src: ./build-tmp/local-digital-twins/coverage.out
dst: local-digital-twins
strip_parent: true
info:
mode: 0644
- src: ./build-tmp/suite-bootstrapping/coverage.html
dst: suite-bootstrapping
strip_parent: true
info:
mode: 0644
- src: ./build-tmp/suite-bootstrapping/coverage.txt
dst: suite-bootstrapping
strip_parent: true
info:
mode: 0644
- src: ./build-tmp/suite-bootstrapping/coverage.out
dst: suite-bootstrapping
strip_parent: true
info:
mode: 0644
- src: ./build-tmp/file-backup/coverage.html
dst: file-backup
strip_parent: true
info:
mode: 0644
- src: ./build-tmp/file-backup/coverage.txt
dst: file-backup
strip_parent: true
info:
mode: 0644
- src: ./build-tmp/file-backup/coverage.out
dst: file-backup
strip_parent: true
info:
mode: 0644
- src: ./build-tmp/system-metrics/coverage.html
dst: system-metrics
strip_parent: true
info:
mode: 0644
- src: ./build-tmp/system-metrics/coverage.txt
dst: system-metrics
strip_parent: true
info:
mode: 0644
- src: ./build-tmp/system-metrics/coverage.out
dst: system-metrics
strip_parent: true
info:
mode: 0644
- src: ./build-tmp/update-manager/coverage.html
dst: update-manager
strip_parent: true
info:
mode: 0644
- src: ./build-tmp/update-manager/coverage.txt
dst: update-manager
strip_parent: true
info:
mode: 0644
- src: ./build-tmp/update-manager/coverage.out
dst: update-manager
strip_parent: true
info:
mode: 0644
nfpms:
- builds:
- build-suite-connector-pkg
Expand Down

0 comments on commit fb9bcb0

Please sign in to comment.