1717 - name : generate test coverage
1818 run : go test ./... -coverprofile=./cover.out -covermode=atomic
1919
20- - name : run action test suite
21- uses : ./.github/workflows/action-test-suite.yml
20+ # # Test 1
2221
22+ - name : " test: total coverage 0% (config)"
23+ uses : ./action/.
24+ id : test-1
25+ with :
26+ config : ./.github/workflows/testdata/zero.yml
27+
28+ - name : " check: test output values"
29+ if : ${{ steps.test-1.outputs.total-coverage == '' || steps.test-1.outputs.badge-text == '' || steps.test-1.outputs.badge-color == '' || steps.test-1.outputs.report == '' }}
30+ run : echo "Previous step should have output values" && exit 1
31+
32+ # # Test 2
33+
34+ - name : " test: total coverage 100% (config)"
35+ uses : ./action/.
36+ id : test-2
37+ continue-on-error : true
38+ with :
39+ config : ./.github/workflows/testdata/total100.yml
40+
41+ - name : " check: test should have failed"
42+ if : steps.test-2.outcome != 'failure'
43+ run : echo "Previous step should have failed" && exit 1
44+
45+ - name : " check: test output values"
46+ if : ${{ steps.test-2.outputs.total-coverage == '' || steps.test-2.outputs.badge-text == '' || steps.test-2.outputs.badge-color == '' }}
47+ run : echo "Previous step should have output values" && exit 1
48+
49+ # # Test 3
50+
51+ - name : " test: total coverage 0% (inputs)"
52+ uses : ./action/.
53+ id : test-3
54+ with :
55+ profile : cover.out
56+ threshold-file : 0
57+ threshold-package : 0
58+ threshold-total : 0
59+
60+ # # Test 4
61+
62+ - name : " test: total coverage 100% (inputs)"
63+ uses : ./action/.
64+ id : test-4
65+ continue-on-error : true
66+ with :
67+ profile : cover.out
68+ threshold-file : 0
69+ threshold-package : 0
70+ threshold-total : 100
71+
72+ - name : " check: test should have failed"
73+ if : steps.test-4.outcome != 'failure'
74+ run : echo "Previous step should have failed" && exit 1
75+
76+ # # Test 5
77+
78+ - name : " test: override config"
79+ uses : ./action/.
80+ id : test-5
81+ with :
82+ config : ./.github/workflows/testdata/total100.yml
83+ threshold-file : 0
84+ threshold-package : 0
85+ threshold-total : 0
86+
87+ # # Test 6
88+
89+ - name : " test: debug output"
90+ uses : ./action/.
91+ id : test-6
92+ continue-on-error : true
93+ with :
94+ profile : unexistant-profile.out
95+ debug : true
96+ threshold-file : 0
97+ threshold-package : 0
98+ threshold-total : 100
99+
100+ - name : " check: test should have failed"
101+ if : steps.test-6.outcome != 'failure'
102+ run : echo "Previous step should have failed" && exit 1
0 commit comments