@@ -33,7 +33,6 @@ name: ci-build
3333env :
3434 REGISTRY : ghcr.io
3535 DOTNET_VERSION : 10.0.x
36- COVERAGE_MIN_PERCENT : ' 85'
3736
3837jobs :
3938
4342
4443 steps :
4544 - name : Checkout
46- uses : actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
45+ uses : actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
4746
48- - uses : actions/setup-dotnet@26b0ec14cb23fa6904739307f278c14f94c95bf1 # v5.4 .0
47+ - uses : actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0 .0
4948 with :
5049 dotnet-version : ' ${{ env.DOTNET_VERSION }}'
5150
5554 dotnet test -c Release --solution OpenShockBackend.slnx \
5655 --results-directory "artifacts/test-results" \
5756 -- \
58- --coverage \
59- --coverage-output coverage.cobertura.xml \
60- --coverage-output-format cobertura \
6157 --report-trx \
6258 --report-trx-filename test-results.trx
6359
@@ -69,111 +65,6 @@ jobs:
6965 path : artifacts/test-results
7066 if-no-files-found : warn
7167
72- coverage :
73- name : Coverage
74- runs-on : ubuntu-latest
75- needs : [tests]
76- outputs :
77- linecoverage : ${{ steps.enforce.outputs.linecoverage }}
78-
79- steps :
80- - name : Checkout
81- uses : actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
82-
83- - uses : actions/setup-dotnet@26b0ec14cb23fa6904739307f278c14f94c95bf1 # v5.4.0
84- with :
85- dotnet-version : ' ${{ env.DOTNET_VERSION }}'
86-
87- - name : Download test artifacts
88- uses : actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
89- with :
90- name : test-results
91- path : artifacts/test-results
92-
93- - name : Install ReportGenerator
94- run : dotnet tool install --tool-path ./.tools dotnet-reportgenerator-globaltool
95-
96- - name : Generate merged coverage report
97- run : |
98- set -euo pipefail
99- reports="$(find artifacts/test-results -name coverage.cobertura.xml -print | paste -sd ';' -)"
100- if [ -z "$reports" ]; then
101- echo "No coverage reports found" >&2
102- exit 1
103- fi
104-
105- ./.tools/reportgenerator \
106- "-reports:${reports}" \
107- "-targetdir:artifacts/coverage" \
108- "-reporttypes:Html;MarkdownSummaryGithub;JsonSummary;Badges"
109-
110- - name : Add coverage summary
111- run : cat artifacts/coverage/SummaryGithub.md >> "$GITHUB_STEP_SUMMARY"
112-
113- - name : Enforce minimum coverage
114- id : enforce
115- env :
116- COVERAGE_MIN_PERCENT : ${{ env.COVERAGE_MIN_PERCENT }}
117- run : |
118- python - <<'PY'
119- import json
120- import os
121-
122- threshold = float(os.environ["COVERAGE_MIN_PERCENT"])
123- with open("artifacts/coverage/Summary.json", "r", encoding="utf-8") as handle:
124- summary = json.load(handle)["summary"]
125-
126- line_coverage = float(summary["linecoverage"])
127- print(f"Line coverage: {line_coverage:.1f}%")
128-
129- with open(os.environ["GITHUB_OUTPUT"], "a", encoding="utf-8") as output:
130- output.write(f"linecoverage={line_coverage:.1f}\n")
131-
132- if line_coverage < threshold:
133- raise SystemExit(
134- f"Coverage threshold not met: {line_coverage:.1f}% < {threshold:.1f}%"
135- )
136- PY
137-
138- - name : Upload merged coverage report
139- uses : actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
140- with :
141- name : coverage-report
142- path : artifacts/coverage
143- if-no-files-found : error
144-
145- publish-coverage :
146- name : Publish coverage
147- runs-on : ubuntu-latest
148- needs : coverage
149- if : ${{ github.ref_type == 'branch' && github.event_name != 'pull_request' && github.ref_name == 'master' }}
150- permissions :
151- contents : read
152- pages : write
153- id-token : write
154- environment :
155- name : github-pages
156- url : ${{ steps.deployment.outputs.page_url }}
157-
158- steps :
159- - name : Configure Pages
160- uses : actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d # v6.0.0
161-
162- - name : Download merged coverage report
163- uses : actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
164- with :
165- name : coverage-report
166- path : _site/coverage
167-
168- - name : Upload Pages artifact
169- uses : actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
170- with :
171- path : _site
172-
173- - name : Deploy Pages site
174- id : deployment
175- uses : actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0
176-
17768 build :
17869 name : Build (${{ matrix.image }})
17970 runs-on : ubuntu-latest
@@ -190,13 +81,13 @@ jobs:
19081
19182 steps :
19283 - name : Checkout
193- uses : actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
84+ uses : actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
19485
19586 - name : Set up Docker Buildx
196- uses : docker/setup-buildx-action@d7f5e7f509e45cec5c76c4d5afdd7de93d0b3df5 # v4.1 .0
87+ uses : docker/setup-buildx-action@bb05f3f5519dd87d3ba754cc423b652a5edd6d2c # v4.2 .0
19788
19889 - name : Log in to Container Registry
199- uses : docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2 .0
90+ uses : docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6 .0
20091 with :
20192 registry : ${{ env.REGISTRY }}
20293 username : ${{ github.actor }}
@@ -213,7 +104,7 @@ jobs:
213104
214105 promote-image :
215106 name : Promote Image (${{ matrix.image }})
216- needs : [build, coverage ]
107+ needs : [build]
217108 runs-on : ubuntu-latest
218109 if : ${{ inputs.push || (github.ref_protected && github.event_name != 'pull_request') }}
219110 strategy :
@@ -226,10 +117,10 @@ jobs:
226117
227118 steps :
228119 - name : Checkout
229- uses : actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
120+ uses : actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
230121
231122 - name : Log in to Container Registry
232- uses : docker/login-action@650006c6eb7dba73a995cc03b0b2d7f5ca915bee # v4.2 .0
123+ uses : docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6 .0
233124 with :
234125 registry : ${{ env.REGISTRY }}
235126 username : ${{ github.actor }}
@@ -249,15 +140,13 @@ jobs:
249140 environment : production
250141 steps :
251142 - name : Send repository dispatch
252- uses : peter-evans/ repository-dispatch@28959ce8df70de7be546dd1250a005dd32156697 # v4.0 .1
143+ uses : OpenShock/actions/ repository-dispatch@21ca2d511bca92cf24fb502fa302f82700822584 # v1.1 .1
253144 with :
254- token : ${{ secrets.GITOPS_PAT }}
255- repository : openshock/kubernetes-cluster-gitops
145+ repo : openshock/kubernetes-cluster-gitops
256146 event-type : update-backend-prod
257147 client-payload : |
258- {
259- "tag": "${{ inputs.tag-prefix || 'rn' }}-${{ github.run_number }}-a${{ github.run_attempt }}"
260- }
148+ {"tag": "${{ inputs.tag-prefix || 'rn' }}-${{ github.run_number }}-a${{ github.run_attempt }}"}
149+ token : ${{ secrets.GITOPS_PAT }}
261150
262151 deploy-staging :
263152 runs-on : ubuntu-latest
@@ -267,15 +156,13 @@ jobs:
267156
268157 steps :
269158 - name : Send repository dispatch
270- uses : peter-evans/ repository-dispatch@28959ce8df70de7be546dd1250a005dd32156697 # v4.0 .1
159+ uses : OpenShock/actions/ repository-dispatch@21ca2d511bca92cf24fb502fa302f82700822584 # v1.1 .1
271160 with :
272- token : ${{ secrets.GITOPS_PAT }}
273- repository : openshock/kubernetes-cluster-gitops
161+ repo : openshock/kubernetes-cluster-gitops
274162 event-type : update-backend-staging
275163 client-payload : |
276- {
277- "tag": "${{ inputs.tag-prefix || 'rn' }}-${{ github.run_number }}-a${{ github.run_attempt }}"
278- }
164+ {"tag": "${{ inputs.tag-prefix || 'rn' }}-${{ github.run_number }}-a${{ github.run_attempt }}"}
165+ token : ${{ secrets.GITOPS_PAT }}
279166
280167 deploy-dev :
281168 runs-on : ubuntu-latest
@@ -284,7 +171,7 @@ jobs:
284171 environment : development
285172
286173 steps :
287- - uses : actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
174+ - uses : actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
288175 with :
289176 sparse-checkout : |
290177 .github
0 commit comments