Skip to content
This repository was archived by the owner on Feb 12, 2022. It is now read-only.

Commit 810d225

Browse files
committed
Add CW reporting for GH Actions
Signed-off-by: Devin Bonnie <[email protected]>
1 parent 43a41ff commit 810d225

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed

.github/workflows/build_and_test.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,27 @@ jobs:
4646
with:
4747
name: colcon-logs-${{ matrix.ubuntu_distro }}-ros-${{ matrix.ros_distro }}
4848
path: ros_ws/log
49+
log_workflow_status_to_cloudwatch:
50+
runs-on: ubuntu-latest
51+
container:
52+
image: ubuntu:bionic
53+
needs:
54+
- build_and_test_master
55+
# Don't skip if prior steps failed, but don't run on a fork because it won't have access to AWS secrets
56+
if: ${{ always() && ! github.event.repository.fork && ! github.event.pull_request.head.repo.fork }}
57+
steps:
58+
- name: Configure AWS Credentials
59+
uses: aws-actions/configure-aws-credentials@v1
60+
with:
61+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
62+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
63+
aws-region: ${{ secrets.AWS_REGION }}
64+
- uses: ros-tooling/[email protected]
65+
with:
66+
# Checks if any of the jobs have failed.
67+
#
68+
# needs.*.result is returns the list of all success statuses as an
69+
# array, i.e. ['success', 'failure, 'success']
70+
# join() converts the array to a string 'successfailuresuccess'
71+
# contains() checks whether the string contains failure
72+
metric-value: ${{ ! contains(join(needs.*.result, ''), 'failure') && ! contains(join(needs.*.result, ''), 'cancelled') }}

.github/workflows/build_and_test_release_latest.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,33 @@ jobs:
4343
with:
4444
name: colcon-logs-${{ matrix.ubuntu_distro }}-ros-${{ matrix.ros_distro }}
4545
path: ros_ws/log
46+
log_workflow_status_to_cloudwatch:
47+
runs-on: ubuntu-latest
48+
container:
49+
image: ubuntu:bionic
50+
needs:
51+
- build_and_test_release_latest
52+
# Don't skip if prior steps failed, but don't run on a fork because it won't have access to AWS secrets
53+
if: ${{ always() && ! github.event.repository.fork && ! github.event.pull_request.head.repo.fork }}
54+
steps:
55+
- name: Configure AWS Credentials
56+
uses: aws-actions/configure-aws-credentials@v1
57+
with:
58+
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
59+
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
60+
aws-region: ${{ secrets.AWS_REGION }}
61+
- uses: ros-tooling/[email protected]
62+
with:
63+
metric-dimensions: >-
64+
[
65+
{ "Name": "github.event_name", "Value": "${{ github.event_name }}" },
66+
{ "Name": "github.ref", "Value": "release-latest" },
67+
{ "Name": "github.repository", "Value": "${{ github.repository }}" }
68+
]
69+
# Checks if any of the jobs have failed.
70+
#
71+
# needs.*.result is returns the list of all success statuses as an
72+
# array, i.e. ['success', 'failure, 'success']
73+
# join() converts the array to a string 'successfailuresuccess'
74+
# contains() checks whether the string contains failure
75+
metric-value: ${{ ! contains(join(needs.*.result, ''), 'failure') && ! contains(join(needs.*.result, ''), 'cancelled') }}

0 commit comments

Comments
 (0)