Skip to content

Commit a1b8eda

Browse files
committed
test failure mode when kat isn't installed
1 parent 15c8189 commit a1b8eda

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

.github/actions/emit-metrics/action.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: Emit Metrics
2-
description: Emit metrics from another workflow/action using the kat tool
2+
description: Emit metrics using the kat tool
33
inputs:
44
namespace:
55
description: The CloudWatch namespace in which to emit metrics
@@ -40,6 +40,9 @@ inputs:
4040
runs:
4141
using: composite
4242
steps:
43+
- name: Verify kat exists
44+
shell: bash
45+
run: which kat || ( echo Cannot find kat installation. Did you forget to run setup-kat first? && exit 1 )
4346
- name: Emit Metrics
4447
shell: bash
4548
run: |

.github/workflows/test-emit-metrics.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,28 @@ jobs:
3232
metrics: |
3333
BuildTime:4.532:Seconds
3434
BuildSucceeded:1:Count
35+
36+
fail-when-kat-unavailable:
37+
runs-on: ubuntu-latest
38+
steps:
39+
- name: Checkout sources
40+
uses: actions/checkout@v4
41+
- name: Fail to emit some test metrics
42+
uses: ./.github/actions/emit-metrics
43+
continue-on-error: true
44+
with:
45+
namespace: Test Namespace (ignore me)
46+
dimensions: |
47+
Artifact=foo-artifact
48+
Platform=Kotlin/JVM
49+
Variant=External
50+
metrics: |
51+
BuildTime:4.532:Seconds
52+
BuildSucceeded:1:Count
53+
- name: Handle expected failure
54+
if: ${{ failure() }}
55+
shell: bash
56+
run: |
57+
echo Saw expected failure from attempting to emit metrics when kat isn't installed.
58+
echo All good now!
59+
exit 0

0 commit comments

Comments
 (0)