4040 - run : gzip envtest.coverage
4141 - uses : actions/upload-artifact@v3
4242 with :
43- name : " kubernetes-api=${{ matrix.kubernetes }}"
43+ name : " ~coverage~ kubernetes-api=${{ matrix.kubernetes }}"
4444 path : envtest.coverage.gz
4545 retention-days : 1
4646
7474 - run : gzip envtest-existing.coverage
7575 - uses : actions/upload-artifact@v3
7676 with :
77- name : " kubernetes-k3d=${{ matrix.kubernetes }}"
77+ name : " ~coverage~ kubernetes-k3d=${{ matrix.kubernetes }}"
7878 path : envtest-existing.coverage.gz
7979 retention-days : 1
8080
@@ -102,9 +102,11 @@ jobs:
102102 registry.developers.crunchydata.com/crunchydata/crunchy-postgres-gis:ubi8-14.4-3.1-0
103103
104104 - run : go mod download
105- - name : Build PGO
105+ - name : Build coverage executable
106106 run : |
107- make build-postgres-operator PGO_VERSION=${{ github.sha }}
107+ make build-postgres-operator \
108+ GO_BUILD='go test -c --tags main_with_coverage --trimpath --coverpkg ./internal/...' \
109+ PGO_VERSION='${{ github.sha }}-coverage'
108110
109111 # Start a Docker container with the working directory mounted.
110112 - name : Start PGO
@@ -122,7 +124,7 @@ jobs:
122124 --env 'RELATED_IMAGE_POSTGRES_14=registry.developers.crunchydata.com/crunchydata/crunchy-postgres:ubi8-14.4-0' \
123125 --env 'RELATED_IMAGE_POSTGRES_14_GIS_3.1=registry.developers.crunchydata.com/crunchydata/crunchy-postgres-gis:ubi8-14.4-3.1-0' \
124126 --name 'postgres-operator' ubuntu \
125- postgres-operator
127+ postgres-operator --test.coverprofile 'kuttl.coverage'
126128
127129 - run : make tools/kuttl
128130 - run : make generate-kuttl
@@ -138,12 +140,24 @@ jobs:
138140 env:
139141 KUTTL_TEST: hack/tools/kuttl test --test cluster-start --timeout=180 --parallel=1
140142
143+ - name : Stop PGO
144+ run : docker stop 'postgres-operator' || true
145+
146+ # Upload coverage to GitHub
147+ - run : gzip kuttl.coverage
148+ - uses : actions/upload-artifact@v3
149+ with :
150+ name : " ~coverage~kuttl-k3d=${{ matrix.kubernetes }}"
151+ path : kuttl.coverage.gz
152+ retention-days : 1
153+
141154 coverage-report :
142155 if : ${{ success() || contains(needs.*.result, 'success') }}
143156 runs-on : ubuntu-latest
144157 needs :
145158 - kubernetes-api
146159 - kubernetes-k3d
160+ - kuttl-k3d
147161 steps :
148162 - uses : actions/checkout@v3
149163 - uses : actions/setup-go@v3
@@ -174,6 +188,6 @@ jobs:
174188 - run : gzip total-coverage.html
175189 - uses : actions/upload-artifact@v3
176190 with :
177- name : coverage-report
191+ name : coverage-report=html
178192 path : total-coverage.html.gz
179193 retention-days : 15
0 commit comments