Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 22 additions & 9 deletions .github/workflows/build-oci-codegen-cs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -278,23 +278,36 @@ jobs:
fi
echo "Smoke test OK — first generated file: ${first_cs}"

if [ ! -f "${COUNTERS}" ]; then
echo "::error::--release-counters did not write ${COUNTERS}"
if [ ! -s "${COUNTERS}" ]; then
echo "::error::--release-counters did not write a non-empty ${COUNTERS}"
exit 1
fi
entry_count="$(jq 'length' "${COUNTERS}")"
if [ "${entry_count}" != "1" ]; then
echo "::error::expected exactly one release-counter entry, got ${entry_count}"
if ! jq -e 'type == "object"' "${COUNTERS}" > /dev/null; then
echo "::error::release-counters file is not a valid JSON object: ${COUNTERS}"
cat "${COUNTERS}" >&2
exit 1
fi
if ! jq -e '.store_version == 1' "${COUNTERS}" > /dev/null; then
echo "::error::expected release-counters store_version 1, got $(jq -c '.store_version' "${COUNTERS}")"
jq . "${COUNTERS}" >&2
exit 1
fi
if ! jq -e '.codegen_generations | type == "object"' "${COUNTERS}" > /dev/null; then
echo "::error::expected codegen_generations to be an object, got $(jq -r '.codegen_generations | type' "${COUNTERS}")"
jq . "${COUNTERS}" >&2
exit 1
fi
if ! jq -e '.codegen_generations | length == 1' "${COUNTERS}" > /dev/null; then
echo "::error::expected exactly one codegen-generation entry, got $(jq '.codegen_generations | length' "${COUNTERS}")"
jq . "${COUNTERS}" >&2
exit 1
fi
revision="$(jq -r 'to_entries[0].value.revision' "${COUNTERS}")"
if [ "${revision}" != "0" ]; then
echo "::error::expected first-emission revision 0, got ${revision}"
if ! jq -e '.codegen_generations | to_entries[0].value == 0' "${COUNTERS}" > /dev/null; then
echo "::error::expected first-emission generation ordinal 0, got $(jq -c '.codegen_generations | to_entries[0].value' "${COUNTERS}")"
jq . "${COUNTERS}" >&2
exit 1
fi
echo "Release-counter OK — first emission recorded revision 0"
echo "Release-counter OK — first emission recorded generation ordinal 0"

csproj="$(find "${OUT}" -type f -name '*.csproj' -print -quit)"
if [ -z "${csproj}" ]; then
Expand Down
Loading