|
27 | 27 | run: make build
|
28 | 28 | - name: Run Go tests
|
29 | 29 | run: make test
|
30 |
| - - name: Code Coverage Report |
31 |
| - |
32 |
| - with: |
33 |
| - filename: coverage.xml |
34 |
| - badge: true |
35 |
| - fail_below_min: false |
36 |
| - format: markdown |
37 |
| - hide_branch_rate: false |
38 |
| - hide_complexity: true |
39 |
| - indicators: true |
40 |
| - output: both |
41 |
| - thresholds: '60 80' |
42 |
| - - uses: jwalton/gh-find-current-pr@v1 |
43 |
| - id: finder |
44 |
| - - name: Add Coverage PR Comment |
45 |
| - uses: marocchino/sticky-pull-request-comment@v2 |
46 |
| - with: |
47 |
| - number: ${{ steps.finder.outputs.pr }} |
48 |
| - path: code-coverage-results.md |
49 |
| - recreate: true |
| 30 | + |
50 | 31 | - name: Upload artifact
|
51 | 32 | uses: actions/upload-artifact@v4
|
52 | 33 | with:
|
@@ -156,6 +137,75 @@ jobs:
|
156 | 137 | - name: Run Debian package tests
|
157 | 138 | run: make debian-test-ci
|
158 | 139 |
|
| 140 | + coverage: |
| 141 | + name: Test Coverage |
| 142 | + needs: go |
| 143 | + runs-on: ubuntu-latest |
| 144 | + permissions: |
| 145 | + contents: read |
| 146 | + pull-requests: write |
| 147 | + env: |
| 148 | + BATS_LIB_PATH: "${{ github.workspace }}/test/bats/lib/" |
| 149 | + PGHOST: localhost |
| 150 | + PGUSER: postgres |
| 151 | + PGPASSWORD: hackme |
| 152 | + PGDATABASE: unittest |
| 153 | + services: |
| 154 | + postgres: |
| 155 | + image: postgres:14 |
| 156 | + options: >- |
| 157 | + --health-cmd pg_isready |
| 158 | + --health-interval 10s |
| 159 | + --health-timeout 5s |
| 160 | + --health-retries 5 |
| 161 | + --hostname postgres |
| 162 | + env: |
| 163 | + POSTGRES_PASSWORD: hackme |
| 164 | + ports: |
| 165 | + - 5432:5432 |
| 166 | + steps: |
| 167 | + - uses: actions/checkout@v4 |
| 168 | + - uses: actions/setup-go@v5 |
| 169 | + with: |
| 170 | + go-version: '1.21' |
| 171 | + - name: Install dependencies |
| 172 | + run: | |
| 173 | + go get . |
| 174 | + - name: Build |
| 175 | + run: make build |
| 176 | + |
| 177 | + - name: Setup Bats and bats libs |
| 178 | + |
| 179 | + with: |
| 180 | + support-path: ${{ github.workspace }}/test/bats/lib/bats-support |
| 181 | + assert-path: ${{ github.workspace }}/test/bats/lib/bats-assert |
| 182 | + file-install: false # Unused |
| 183 | + detik-install: false # Unused |
| 184 | + |
| 185 | + - name: Run Go and e2e tests |
| 186 | + run: make coverage |
| 187 | + |
| 188 | + - name: Code Coverage Report |
| 189 | + |
| 190 | + with: |
| 191 | + filename: coverage.xml |
| 192 | + badge: true |
| 193 | + fail_below_min: false |
| 194 | + format: markdown |
| 195 | + hide_branch_rate: false |
| 196 | + hide_complexity: true |
| 197 | + indicators: true |
| 198 | + output: both |
| 199 | + thresholds: '60 80' |
| 200 | + - uses: jwalton/gh-find-current-pr@v1 |
| 201 | + id: finder |
| 202 | + - name: Add Coverage PR Comment |
| 203 | + uses: marocchino/sticky-pull-request-comment@v2 |
| 204 | + with: |
| 205 | + number: ${{ steps.finder.outputs.pr }} |
| 206 | + path: code-coverage-results.md |
| 207 | + recreate: true |
| 208 | + |
159 | 209 | # checkcov:
|
160 | 210 | # permissions:
|
161 | 211 | # security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
|
|
0 commit comments