Skip to content

Commit 32e5a70

Browse files
Merge branch 'main' into paullgdc/trace_stats/aggregate_grpc_status
2 parents 591907e + fc16a5e commit 32e5a70

File tree

14 files changed

+252
-153
lines changed

14 files changed

+252
-153
lines changed

.github/chainguard/self.read.members.sts.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ issuer: https://token.actions.githubusercontent.com
33
subject_pattern: "repo:DataDog/libdatadog.*"
44

55
claim_pattern:
6-
ref: "refs/heads/(main|release)"
7-
ref_protected: "true"
6+
ref: "refs/heads/(main|release|igor/.*|julio/.*)"
7+
# ref_protected: "true"
88

99
permissions:
1010
members: read

.github/chainguard/self.write.pr.sts.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ issuer: https://token.actions.githubusercontent.com
33
subject_pattern: "repo:DataDog/libdatadog.*"
44

55
claim_pattern:
6-
ref: "refs/heads/(main|release)"
7-
ref_protected: "true"
6+
ref: "refs/heads/(main|release|igor/.*|julio/.*)"
7+
# ref_protected: "true"
88
job_workflow_ref: DataDog/libdatadog/\.github/workflows/release-proposal-dispatch\.yml@.+
99

1010
permissions:

.github/workflows/pr-title-semver-check.yml

Lines changed: 29 additions & 98 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ permissions:
44
pull-requests: read
55
on:
66
pull_request:
7-
types: ['opened', 'edited', 'reopened', 'synchronize']
7+
types: ['opened', 'edited', 'reopened', 'synchronize', 'labeled', 'unlabeled']
88
branches-ignore:
99
- "v[0-9]+.[0-9]+.[0-9]+.[0-9]+"
1010
- release
@@ -15,6 +15,7 @@ env:
1515

1616
jobs:
1717
detect-changes:
18+
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip-pr-title-semver-check') }}
1819
runs-on: ubuntu-latest
1920
outputs:
2021
changed_crates: ${{ steps.detect.outputs.crates }}
@@ -78,7 +79,7 @@ jobs:
7879
7980
semver-check:
8081
needs: detect-changes
81-
if: needs.detect-changes.outputs.has_rust_changes == 'true'
82+
if: ${{ needs.detect-changes.outputs.has_rust_changes == 'true' && !contains(github.event.pull_request.labels.*.name, 'skip-pr-title-semver-check') }}
8283
runs-on: ubuntu-latest
8384
outputs:
8485
result_json: ${{ steps.semver.outputs.result_json }}
@@ -156,7 +157,7 @@ jobs:
156157
157158
validate:
158159
needs: [detect-changes, semver-check]
159-
if: needs.detect-changes.outputs.has_rust_changes == 'true'
160+
if: ${{ needs.detect-changes.outputs.has_rust_changes == 'true' && !contains(github.event.pull_request.labels.*.name, 'skip-pr-title-semver-check') }}
160161
runs-on: ubuntu-latest
161162
steps:
162163
- name: Validate PR title against semver changes
@@ -206,52 +207,30 @@ jobs:
206207
echo ""
207208
208209
VALIDATION_FAILED="false"
210+
FAILURE_REASONS=()
209211
210-
# Validation rules
212+
# Rule: ci/docs/style/test/build cannot change the public API
211213
case "$TYPE" in
212-
fix)
213-
if [[ "$SEMVER_LEVEL" == "major" ]] && [[ -z "$IS_BREAKING_CHANGE" ]]; then
214+
ci|docs|style|test|build)
215+
if [[ "$SEMVER_LEVEL" == "major" ]] || [[ "$SEMVER_LEVEL" == "minor" ]]; then
216+
VALIDATION_FAILED="true"
217+
FAILURE_REASONS+=("'$TYPE' cannot have major or minor API changes. Use a different PR type, or avoid public API changes.")
218+
fi
219+
;;
220+
feat|fix|refactor|chore|perf|revert)
221+
# These can be any semver level (subject to breaking change rules below)
222+
;;
223+
*)
214224
VALIDATION_FAILED="true"
215-
elif [[ "$SEMVER_LEVEL" == "minor" ]] || [[ "$SEMVER_LEVEL" == "none" ]]; then
216-
VALIDATION_FAILED="true"
217-
fi
218-
;;
219-
220-
feat)
221-
if [[ "$SEMVER_LEVEL" == "major" ]] && [[ -z "$IS_BREAKING_CHANGE" ]]; then
222-
VALIDATION_FAILED="true"
223-
elif [[ "$SEMVER_LEVEL" == "patch" ]] || [[ "$SEMVER_LEVEL" == "none" ]]; then
224-
VALIDATION_FAILED="true"
225-
fi
226-
;;
227-
228-
chore|ci|docs|style|test|build|perf)
229-
# Breaking change marker shouldn't be there.
230-
if [[ -n "$IS_BREAKING_CHANGE" ]]; then
231-
VALIDATION_FAILED="true"
232-
fi
233-
234-
# These should not change public API
235-
if [[ "$SEMVER_LEVEL" == "major" ]] || [[ "$SEMVER_LEVEL" == "minor" ]]; then
236-
VALIDATION_FAILED="true"
237-
fi
238-
;;
239-
240-
refactor)
241-
if [[ "$SEMVER_LEVEL" == "major" ]] && [[ -z "$IS_BREAKING_CHANGE" ]]; then
242-
VALIDATION_FAILED="true"
243-
fi
244-
;;
245-
246-
revert)
247-
# Revert commits are allowed to have any semver level
248-
;;
225+
FAILURE_REASONS+=("Unknown PR type: '$TYPE'. Valid types: feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert")
226+
;;
227+
esac
249228
250-
*)
251-
echo "$TYPE not handled";
229+
# Rule: major API changes must have a breaking change marker
230+
if [[ "$SEMVER_LEVEL" == "major" ]] && [[ -z "$IS_BREAKING_CHANGE" ]]; then
252231
VALIDATION_FAILED="true"
253-
;;
254-
esac
232+
FAILURE_REASONS+=("Major API changes require a breaking change marker. Add '!' to PR title (e.g. 'feat!:' or 'feat(scope)!:') or add 'BREAKING CHANGE:' footer in PR body.")
233+
fi
255234
256235
if [[ "$VALIDATION_FAILED" == "true" ]]; then
257236
echo ""
@@ -267,69 +246,21 @@ jobs:
267246
echo "--------------------------------------------"
268247
echo "WHAT WAS DETECTED:"
269248
echo "--------------------------------------------"
270-
# Show details for each crate
271249
echo "$SEMVER_RESULT_JSON" | jq -r '.crates[] | "Crate: \(.name)\n Level: \(.level)\n Reason: \(.reason)\n Details:\n\(.details | split("\n") | map(" " + .) | join("\n"))\n"'
272250
echo ""
273251
echo "--------------------------------------------"
274252
echo "WHY THIS FAILED:"
275253
echo "--------------------------------------------"
276-
case "$TYPE" in
277-
fix)
278-
if [[ "$SEMVER_LEVEL" == "major" ]] && [[ -z "$IS_BREAKING_CHANGE" ]]; then
279-
echo "'fix' with major changes requires breaking change marker."
280-
echo "Add '!' to PR title (fix!:) or add 'BREAKING CHANGE:' footer in PR body."
281-
elif [[ "$SEMVER_LEVEL" == "minor" ]]; then
282-
echo "'fix' cannot have minor-level changes (new public API)."
283-
echo "Use 'feat' type instead, or remove the new public API additions."
284-
elif [[ "$SEMVER_LEVEL" == "none" ]]; then
285-
echo "'fix' requires changes to published crates."
286-
echo "Use 'chore' or 'ci' for non-published changes."
287-
fi
288-
;;
289-
feat)
290-
if [[ "$SEMVER_LEVEL" == "major" ]] && [[ -z "$IS_BREAKING_CHANGE" ]]; then
291-
echo "'feat' with major changes requires breaking change marker."
292-
echo "Add '!' to PR title (feat!:) or add 'BREAKING CHANGE:' footer in PR body."
293-
elif [[ "$SEMVER_LEVEL" == "patch" ]]; then
294-
echo "'feat' requires minor-level changes (new public API)."
295-
echo "Use 'fix' for bug fixes, or ensure new items are marked 'pub'."
296-
elif [[ "$SEMVER_LEVEL" == "none" ]]; then
297-
echo "'feat' requires changes to published crates."
298-
echo "Use 'chore' for non-published changes."
299-
fi
300-
;;
301-
chore|ci|docs|style|test|build|perf)
302-
if [[ -n "$IS_BREAKING_CHANGE" ]]; then
303-
echo "'$TYPE' cannot have breaking change marker."
304-
echo "Remove '!' from title or use 'feat!', 'fix!', or 'refactor!' instead."
305-
elif [[ "$SEMVER_LEVEL" == "major" ]]; then
306-
echo "'$TYPE' cannot have major-level changes (breaking API)."
307-
echo "Use 'refactor!' or 'feat!' for intentional breaking changes."
308-
elif [[ "$SEMVER_LEVEL" == "minor" ]]; then
309-
echo "'$TYPE' cannot have minor-level changes (new public API)."
310-
echo "Use 'feat' for new features, or mark new items as pub(crate)."
311-
fi
312-
;;
313-
refactor)
314-
if [[ "$SEMVER_LEVEL" == "major" ]] && [[ -z "$IS_BREAKING_CHANGE" ]]; then
315-
echo "'refactor' with major changes requires breaking change marker."
316-
echo "Add '!' to PR title (refactor!:) or add 'BREAKING CHANGE:' footer in PR body."
317-
fi
318-
;;
319-
*)
320-
echo "Unknown PR type: '$TYPE'"
321-
echo "Valid types: feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert"
322-
;;
323-
esac
254+
for reason in "${FAILURE_REASONS[@]}"; do
255+
echo "- $reason"
256+
done
324257
echo ""
325258
echo "--------------------------------------------"
326259
echo "VALID COMBINATIONS:"
327260
echo "--------------------------------------------"
328-
echo " fix -> patch, or major (with '!')"
329-
echo " feat -> minor, or major (with '!')"
330-
echo " refactor -> patch, minor, or major (with '!')"
331-
echo " chore/ci/docs/style/test/build/perf -> patch or none only"
332-
echo " revert -> any level"
261+
echo " ci/docs/style/test/build -> patch or none only (no public API changes)"
262+
echo " all other types -> any level allowed"
263+
echo " major changes -> must have '!' or 'BREAKING CHANGE:' footer"
333264
echo ""
334265
exit 1
335266
else

.github/workflows/test.yml

Lines changed: 60 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ jobs:
298298
.\build-profiling.ps1
299299
300300
cross-centos7:
301-
name: build and test using cross - on centos7
301+
name: Test x86_64-unknown-linux-gnu on centOS7 docker image
302302
runs-on: ubuntu-latest
303303
concurrency:
304304
group: ci-${{ github.ref }}-cross-centos7
@@ -323,10 +323,65 @@ jobs:
323323
with:
324324
cache-targets: true # cache build artifacts
325325
cache-bin: true # cache the ~/.cargo/bin directory
326-
- run: cargo install cross || true
327-
- run: cross build --workspace --target x86_64-unknown-linux-gnu --exclude builder
328-
- run: cross test --workspace --features libdd-crashtracker/generate-unit-test-files --target x86_64-unknown-linux-gnu --exclude builder -- --skip "::single_threaded_tests::" --skip "tracing_integration_tests::"
329-
- run: cross test --workspace --features libdd-crashtracker/generate-unit-test-files --target x86_64-unknown-linux-gnu --exclude builder --exclude bin_tests -- --skip "::tests::" --skip "::api_tests::" --test-threads 1 --skip "tracing_integration_tests::"
326+
- name: Build CentOS 7 Docker image
327+
run: docker build -t libdatadog-centos7 -f tools/docker/Dockerfile.centos .
328+
- name: "cargo nextest run (centos7)"
329+
# Run docker as a user, not the default root
330+
# Mount and use the runner's toolchain as it's the same arch
331+
# exclude tracing integration tests since they require docker in docker to run a test-agent
332+
run: >-
333+
docker run --rm
334+
--user "$(id -u):$(id -g)"
335+
-v "${{ github.workspace }}:/workspace"
336+
-v "${CARGO_HOME:-$HOME/.cargo}:/usr/local/cargo"
337+
-v "${RUSTUP_HOME:-$HOME/.rustup}:/usr/local/rustup"
338+
-e CARGO_HOME=/usr/local/cargo
339+
-e RUSTUP_HOME=/usr/local/rustup
340+
-e PATH=/usr/local/cargo/bin:/usr/local/rustup/toolchains/stable-x86_64-unknown-linux-gnu/bin:/opt/rh/devtoolset-11/root/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
341+
-w /workspace
342+
libdatadog-centos7
343+
cargo nextest run --workspace --features libdd-crashtracker/generate-unit-test-files
344+
--exclude builder --profile ci
345+
-E '!test(tracing_integration_tests::)'
346+
- name: Add file attributes to JUnit XML
347+
if: success() || failure()
348+
run: cargo run --bin add_junit_file_attributes -- target/nextest/ci/junit.xml
349+
- name: Report Test Results
350+
if: success() || failure()
351+
uses: mikepenz/action-junit-report@db71d41eb79864e25ab0337e395c352e84523afe # 4.3.1
352+
with:
353+
report_paths: "target/nextest/ci/junit.xml"
354+
check_name: "[centos7] test report"
355+
include_passed: true
356+
- name: Upload test results to Datadog
357+
if: success() || failure()
358+
run: |
359+
URL="https://github.com/DataDog/datadog-ci/releases/download/v4.2.2/datadog-ci_linux-x64"
360+
OUTPUT="datadog-ci"
361+
EXPECTED_CHECKSUM="3e1e9649d15d3feacced89ec90de66151046a58c7844217e4112362ad8dbf8d1"
362+
363+
echo "Downloading datadog-ci from $URL"
364+
curl -L --fail --retry 3 -o "$OUTPUT" "$URL"
365+
chmod +x "$OUTPUT"
366+
367+
ACTUAL_CHECKSUM=$(sha256sum "$OUTPUT" | cut -d' ' -f1)
368+
echo "Expected checksum: $EXPECTED_CHECKSUM"
369+
echo "Actual checksum: $ACTUAL_CHECKSUM"
370+
371+
if [ "$ACTUAL_CHECKSUM" != "$EXPECTED_CHECKSUM" ]; then
372+
echo "Checksum verification failed!"
373+
exit 1
374+
fi
375+
echo "Checksum verification passed"
376+
377+
./"$OUTPUT" junit upload \
378+
--service libdatadog \
379+
--env ci \
380+
--logs \
381+
--tags arch:${{ runner.arch }},os:Linux,platform:centos7 \
382+
target/nextest/ci/junit.xml
383+
env:
384+
DATADOG_API_KEY: ${{ secrets.DATADOG_API_KEY }}
330385

331386
ffi_bake:
332387
strategy:

0 commit comments

Comments
 (0)