From 3b43ee322f4143de1e3094c4899f210a2e7deebb Mon Sep 17 00:00:00 2001 From: anthonychengit Date: Sun, 13 Sep 2026 12:54:14 -0700 Subject: [PATCH] ci: label amber binary manifests --- .github/labeler.yml | 5 +- .github/scripts/test_labeler_manifests.sh | 57 +++++++++++++++++++++++ 2 files changed, 61 insertions(+), 1 deletion(-) create mode 100755 .github/scripts/test_labeler_manifests.sh diff --git a/.github/labeler.yml b/.github/labeler.yml index 65aa19f99ed..67032d9d093 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -78,6 +78,9 @@ engine: - 'amber/src/main/resources/**' - 'amber/src/test/scala/**' - 'amber/src/test/java/**' + - 'amber/LICENSE-binary-java' + - 'amber/NOTICE-binary' + - 'amber/NOTICE-binary-python' amber-integration: # Scala specs that exercise both Scala and Python end-to-end. They @@ -104,6 +107,7 @@ pyamber: - 'amber/**/*.py' - 'amber/pyproject.toml' - 'amber/**/*requirements*.txt' + - 'amber/LICENSE-binary-python' docs: - changed-files: @@ -150,4 +154,3 @@ fix: refactor: - head-branch: '^refactor' - diff --git a/.github/scripts/test_labeler_manifests.sh b/.github/scripts/test_labeler_manifests.sh new file mode 100755 index 00000000000..61a2459c3d7 --- /dev/null +++ b/.github/scripts/test_labeler_manifests.sh @@ -0,0 +1,57 @@ +#!/usr/bin/env bash +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +set -euo pipefail + +repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)" +labeler="$repo_root/.github/labeler.yml" + +section() { + awk -v label="$1" ' + $0 == label ":" { inside = 1; next } + inside && /^[^[:space:]#][^:]*:$/ { exit } + inside { print } + ' "$labeler" +} + +engine="$(section engine)" +pyamber="$(section pyamber)" + +manifests=( + amber/LICENSE-binary-java + amber/NOTICE-binary + amber/NOTICE-binary-python +) +for manifest in "${manifests[@]}"; do + grep -Fq "'$manifest'" <<<"$engine" || { + echo "FAIL: engine label does not cover $manifest" >&2 + exit 1 + } +done + +grep -Fq "'amber/LICENSE-binary-python'" <<<"$pyamber" || { + echo "FAIL: pyamber label does not cover amber/LICENSE-binary-python" >&2 + exit 1 +} + +if grep -Fq "'amber/LICENSE-binary-python'" <<<"$engine"; then + echo "FAIL: Python-only manifest should not trigger the Scala engine stack" >&2 + exit 1 +fi + +echo "labeler manifest coverage tests passed"