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
48 changes: 47 additions & 1 deletion .github/workflows/measure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ name: Measure
#
# gh workflow run measure.yml -f ref=<branch|tag|sha> -f base=main
#
# `probe` names examples to build at the head and run once over the whole
# corpus directory, each writing measure/probe-<name>.txt (for a probe of a
# derived field list against its corpus records, such as
# probe_assoc_pers_subent); `probe_features` is the cargo feature list they
# need (dxf-reader for the DXF twins). Probe output is a report, not a gate.
#
# On a pull request that changes the measurement itself, the PR is measured
# against its merge-base with `main`. This is a report, not a gate: the
# ratchet is the Corpus job in ci.yml. The DXF value oracle (#99) runs on
Expand All @@ -25,6 +31,14 @@ on:
description: Branch, tag or commit to compare against
required: true
default: main
probe:
description: Examples to run at the head over the corpus directory, space-separated (optional)
required: false
default: ""
probe_features:
description: Cargo features the probes need, comma-separated (optional)
required: false
default: ""
pull_request:
branches: [main]
paths:
Expand All @@ -40,7 +54,7 @@ permissions:
contents: read

concurrency:
group: measure-${{ github.event_name }}-${{ github.ref }}-${{ inputs.ref }}-${{ inputs.base }}
group: measure-${{ github.event_name }}-${{ github.ref }}-${{ inputs.ref }}-${{ inputs.base }}-${{ inputs.probe }}-${{ inputs.probe_features }}
cancel-in-progress: true

env:
Expand Down Expand Up @@ -223,6 +237,38 @@ jobs:
else
echo "DXF value oracle: NOT MEASURED (the head has no examples/dxf_oracle)." >> "$GITHUB_STEP_SUMMARY"
fi
- name: Run the requested probes at the head
if: steps.fetch.outputs.measured == 'true' && inputs.probe != ''
env:
PROBES: ${{ inputs.probe }}
PROBE_FEATURES: ${{ inputs.probe_features }}
run: |
# Inputs reach the shell only through env and are held to example
# and feature name characters before any is used.
# The names are split on spaces and never expanded as file patterns.
set -f -uo pipefail
for p in $PROBES; do
[[ "$p" =~ ^[a-z0-9_]+$ ]] || { echo "::error::'$p' is not an example name"; exit 1; }
done
[[ -z "$PROBE_FEATURES" || "$PROBE_FEATURES" =~ ^[a-z0-9_,-]+$ ]] \
|| { echo "::error::'$PROBE_FEATURES' is not a feature list"; exit 1; }
features=()
if [ -n "$PROBE_FEATURES" ]; then features=(--features "$PROBE_FEATURES"); fi
status=0
for p in $PROBES; do
if ! (cd "$RUNNER_TEMP/head" && CARGO_TARGET_DIR="$GITHUB_WORKSPACE/target" \
cargo +stable build --release "${features[@]}" --example "$p"); then
echo "::error::probe $p does not build at the head"
status=1
continue
fi
# GitHub runs the step under bash -e: a probe's own failure is
# reported, not fatal, so its status is caught here.
code=0
"target/release/examples/$p" "$HOME/dwg-corpus" > "measure/probe-$p.txt" 2>&1 || code=$?
echo "Probe \`$p\`: exit $code, $(wc -l < "measure/probe-$p.txt") lines in \`measure/probe-$p.txt\`." >> "$GITHUB_STEP_SUMMARY"
done
exit "$status"
# Measurements and logs only; never a sample file.
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
if: always() && steps.fetch.outputs.measured == 'true'
Expand Down
Loading