v3 using chainguard wolfi-base#5
Conversation
Support interface version 3 https://exercism.org/docs/building/tooling/test-runners/interface We move from debian to chainguard wolfi-base to reduce image size. (Alpine doesn't expose readdir64_r, expected by Factor.) Each exercise now includes exercism-tools testing library. This defines - STOP-HERE - TASK - run-exercism-tests https://github.com/exercism/factor/ has been updated to use this testing library. We omit some unused files from the factor distribution: we don't need to support interactive help.
|
The image is now 241 MB, was previously 383 MB 69 MB of the saving is from the move to wolfi-base. The remaining savings are from trimming the factor distribution. |
| jq -n --arg output "${test_output}" '{version: 1, status: "fail", message: $output}' > ${results_file} | ||
| if [[ ! -f "$test_file" ]]; then | ||
| jq -n --arg msg "test file not found: ${slug}-tests.factor" \ | ||
| '{version: 3, status: "error", message: $msg}' >"$results_file" |
There was a problem hiding this comment.
| '{version: 3, status: "error", message: $msg}' >"$results_file" | |
| '{version: 3, status: "error", message: $msg}' > "$results_file" |
| # Copy the fixture to a fresh temp dir so the rewrite below does not mutate | ||
| # the source. | ||
| tmp_dir=$(mktemp -d -t "factor-runner-${slug}-XXXXX") | ||
| trap 'rm -rf "$tmp_dir"' EXIT |
There was a problem hiding this comment.
| trap 'rm -rf "$tmp_dir"' EXIT | |
| trap 'rm -rf "${tmp_dir}"' EXIT |
| # the source. | ||
| tmp_dir=$(mktemp -d -t "factor-runner-${slug}-XXXXX") | ||
| trap 'rm -rf "$tmp_dir"' EXIT | ||
| cp -r "${solution_dir}/." "$tmp_dir" |
There was a problem hiding this comment.
| cp -r "${solution_dir}/." "$tmp_dir" | |
| cp -r "${solution_dir}/." "${tmp_dir}" |
| cp -r "${solution_dir}/." "$tmp_dir" | ||
| stripped_tests="${tmp_dir}/${slug}/${slug}-tests.factor" | ||
| awk '!/^STOP-HERE$/' "$stripped_tests" > "${stripped_tests}.new" | ||
| mv "${stripped_tests}.new" "$stripped_tests" |
There was a problem hiding this comment.
| mv "${stripped_tests}.new" "$stripped_tests" | |
| mv "${stripped_tests}.new" "${stripped_tests}" |
| raw_output=${raw_output//$tmp_dir/$canonical_root} | ||
|
|
||
| # Awk parser shared by all stages: JSON-escape a single string field. | ||
| read -r -d '' AWK_JSON <<'AWK' || true |
There was a problem hiding this comment.
| read -r -d '' AWK_JSON <<'AWK' || true | |
| read -r -d '' AWK_JSON <<' AWK' || true |
| } | ||
| state == "inline" && $0 ~ header_re { | ||
| close_segment() | ||
| idx++; seg_failed = 0; seg_n = 0; delete seg |
There was a problem hiding this comment.
Is there a reason come of these have multiple commands on one line?
| END { close_segment() } | ||
| ') | ||
|
|
||
| segments=$(printf '%s\n' "$parsed" | awk '/"type":"segment"/' || true) |
There was a problem hiding this comment.
Variable expansions mostly use {} before here and don't have them after here
| if [[ -z "$segments" ]]; then | ||
| cleaned=$(printf '%s\n' "$raw_output" | awk '/^\([UO]\) /{exit} {print}' \ | ||
| | awk 'NF { print; blank = 0; next } !blank { print; blank = 1 }') | ||
| if [[ -z "$cleaned" ]]; then cleaned="No tests were executed"; fi |
There was a problem hiding this comment.
| if [[ -z "$cleaned" ]]; then cleaned="No tests were executed"; fi | |
| [[ -z "$cleaned" ]] && cleaned="No tests were executed" |
| cleaned=$(printf '%s\n' "$raw_output" | awk '/^\([UO]\) /{exit} {print}' \ | ||
| | awk 'NF { print; blank = 0; next } !blank { print; blank = 1 }') | ||
| if [[ -z "$cleaned" ]]; then cleaned="No tests were executed"; fi | ||
| jq -n --arg msg "$cleaned" '{version:3, status:"error", message:$msg}' >"$results_file" |
There was a problem hiding this comment.
| jq -n --arg msg "$cleaned" '{version:3, status:"error", message:$msg}' >"$results_file" | |
| jq -n --arg msg "$cleaned" '{version:3, status:"error", message:$msg}' > "$results_file" |
| RUN git clone https://github.com/factor/factor.git && \ | ||
| cd factor && \ | ||
| git checkout cd14ceed53f6f9a43bbd3aec3950d8beb5439ed8 | ||
| git checkout a56e6390e81340be6573cb790311c0a980a5f369 |
There was a problem hiding this comment.
Is this commit associated with a release? Would that merit a comment?
Support interface version 3
https://exercism.org/docs/building/tooling/test-runners/interface
We move from debian to chainguard wolfi-base
to reduce image size.
(Alpine doesn't expose readdir64_r, expected by Factor.)
Each exercise now includes exercism-tools
testing library. This defines
https://github.com/exercism/factor/
has been updated to use this testing library.
We omit some unused files from the factor distribution: we don't need to support interactive help.