Skip to content

Commit edcdb15

Browse files
committed
add main build call and update metric
1 parent ed8294e commit edcdb15

File tree

2 files changed

+34
-7
lines changed

2 files changed

+34
-7
lines changed

.github/workflows/main-build.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
name: Java Agent Main Build
22
on:
3+
workflow_call:
4+
inputs:
5+
caller-workflow-name:
6+
required: true
7+
type: string
8+
ref:
9+
description: 'The branch, tag or SHA to checkout'
10+
required: false
11+
type: string
12+
default: ''
313
push:
414
branches:
515
- main
@@ -24,6 +34,8 @@ jobs:
2434
runs-on: aws-otel-java-instrumentation_ubuntu-latest_32-core
2535
steps:
2636
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 #v5.0.0
37+
with:
38+
ref: ${{ inputs.ref || github.sha }}
2739
- uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 #v5.0.0
2840
with:
2941
java-version-file: .java-version
@@ -58,6 +70,7 @@ jobs:
5870
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 #v5.0.0
5971
with:
6072
fetch-depth: 0
73+
ref: ${{ inputs.ref || github.sha }}
6174
- uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 #v5.0.0
6275
with:
6376
java-version-file: .java-version
@@ -193,6 +206,7 @@ jobs:
193206
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 #v5.0.0
194207
with:
195208
fetch-depth: 0
209+
ref: ${{ inputs.ref || github.sha }}
196210
- uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 #v5.0.0
197211
with:
198212
java-version: 23
@@ -233,6 +247,7 @@ jobs:
233247
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 #v5.0.0
234248
with:
235249
fetch-depth: 0
250+
ref: ${{ inputs.ref || github.sha }}
236251
- uses: actions/setup-java@dded0888837ed1f317902acf8a20df0ad188d165 #v5.0.0
237252
with:
238253
java-version-file: .java-version

.github/workflows/nightly-build.yml

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,18 @@ jobs:
9898
env:
9999
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
100100

101+
build-and-test:
102+
needs: update-and-create-pr
103+
if: needs.update-and-create-pr.outputs.has_changes == 'true'
104+
uses: ./.github/workflows/main-build.yml
105+
secrets: inherit
106+
with:
107+
caller-workflow-name: nightly-build
108+
ref: nightly-dependency-updates
109+
101110
publish-nightly-build-status:
102111
name: "Publish Nightly Build Status"
103-
needs: [update-and-create-pr]
112+
needs: [update-and-create-pr, build-and-test]
104113
runs-on: ubuntu-latest
105114
if: always()
106115
steps:
@@ -112,9 +121,12 @@ jobs:
112121

113122
- name: Publish nightly build status
114123
run: |
115-
# For now, just publish success since we don't have build validation yet
116-
value="${{ needs.update-and-create-pr.result == 'success' && '0.0' || '1.0'}}"
117-
aws cloudwatch put-metric-data --namespace 'ADOT/GitHubActions' \
118-
--metric-name Failure \
119-
--dimensions repository=${{ github.repository }},branch=${{ github.ref_name }},workflow=nightly_build \
120-
--value $value
124+
if [[ "${{ needs.build-and-test.result }}" == "skipped" ]]; then
125+
echo "Build was skipped (no changes), not publishing metric"
126+
else
127+
value="${{ needs.build-and-test.result == 'success' && '0.0' || '1.0'}}"
128+
aws cloudwatch put-metric-data --namespace 'ADOT/GitHubActions' \
129+
--metric-name Failure \
130+
--dimensions repository=${{ github.repository }},branch=${{ github.ref_name }},workflow=nightly_build \
131+
--value $value
132+
fi

0 commit comments

Comments
 (0)