@@ -10,28 +10,26 @@ jobs:
1010 steps :
1111 - name : checkout
1212 uses : actions/checkout@v3
13+
1314 - name : setup go
1415 uses : actions/setup-go@v3
1516 with :
1617 go-version-file : go.mod
1718
18- - name : Set action image version to dev
19+ - name : set action image version to dev
1920 run : |
2021 yq e -i '.runs.image = "docker://ghcr.io/vladopajic/go-test-coverage:dev"' action.yml
2122 image=$(yq '.runs.image' action.yml)
2223 echo "Image: $image"
2324
24- - name : Setup buildx
25- uses : docker/setup-buildx-action@v2
26-
27- - name : Login to GitHub container registry
25+ - name : login to GitHub container registry
2826 uses : docker/login-action@v2
2927 with :
3028 registry : ghcr.io
3129 username : ${{ github.repository_owner }}
3230 password : ${{ secrets.GITHUB_TOKEN }}
3331
34- - name : Build and push
32+ - name : build and push
3533 uses : docker/build-push-action@v4
3634 with :
3735 push : true
@@ -43,37 +41,55 @@ jobs:
4341 - name : generate test coverage
4442 run : go test ./... -coverprofile=./cover.out -covermode=atomic
4543
46- - name : Test total coverage 0% (config)
44+ # # Test 1
45+
46+ - name : " test: total coverage 0% (config)"
4747 uses : ./
48+ id : test-1
4849 with :
4950 config : ./.github/workflows/testdata/zero.yml
51+
52+ - name : " check: test output values"
53+ if : ${{ steps.test-1.outputs.total-coverage == '' || steps.test-1.outputs.badge-text == '' || steps.test-1.outputs.badge-color == '' }}
54+ shell : bash
55+ run : echo "Previous step should have output values" && exit 1
56+
57+ # # Test 2
5058
51- - name : Test total coverage 100% (config)
59+ - name : " test: total coverage 100% (config)"
5260 uses : ./
53- id : should-fail-1
61+ id : test-2
5462 continue-on-error : true
5563 with :
5664 config : ./.github/workflows/testdata/total100.yml
5765
58- - name : Check previous step failed
59- if : steps.should-fail-1 .outcome != 'failure'
66+ - name : " check: test should have failed"
67+ if : steps.test-2 .outcome != 'failure'
6068 shell : bash
61- run : |
62- echo "Previous step should have failed"
63- exit 1
69+ run : echo "Previous step should have failed" && exit 1
70+
71+ - name : " check: test output values"
72+ if : ${{ steps.test-2.outputs.total-coverage == '' || steps.test-2.outputs.badge-text == '' || steps.test-2.outputs.badge-color == '' }}
73+ shell : bash
74+ run : echo "Previous step should have output values" && exit 1
6475
65- - name : Test total coverage 0% (inputs)
76+ # # Test 3
77+
78+ - name : " test: total coverage 0% (inputs)"
6679 uses : ./
80+ id : test-3
6781 with :
6882 profile : cover.out
6983 local-prefix : " github.com/vladopajic/go-test-coverage"
7084 threshold-file : 0
7185 threshold-package : 0
7286 threshold-total : 0
7387
74- - name : Test total coverage 100% (inputs)
88+ # # Test 4
89+
90+ - name : " test: total coverage 100% (inputs)"
7591 uses : ./
76- id : should-fail-2
92+ id : test-4
7793 continue-on-error : true
7894 with :
7995 profile : cover.out
8298 threshold-package : 0
8399 threshold-total : 100
84100
85- - name : Check previous step failed
86- if : steps.should-fail-2 .outcome != 'failure'
101+ - name : " check: test should have failed"
102+ if : steps.test-4 .outcome != 'failure'
87103 shell : bash
88- run : |
89- echo "Previous step should have failed"
90- exit 1
104+ run : echo "Previous step should have failed" && exit 1
0 commit comments