Skip to content

Commit

Permalink
#61 -index.html
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Jul 23, 2024
1 parent 45510ad commit 7446e0b
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 5 deletions.
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ target/html/%.html: target/fb/%.fb xsl/*.xsl entry.sh Makefile target/css/main.c
export INPUT_OPTIONS=testing=yes
export GITHUB_WORKSPACE=.
export INPUT_FACTBASE=$<
export INPUT_COLUMNS=what,when,who
export INPUT_HIDDEN=_id,_time,_version
fb=$$(basename $<)
fb=$${fb%.*}
export INPUT_OUTPUT=target/output/$${fb}
Expand Down Expand Up @@ -87,6 +89,8 @@ entry: target/docker-image.txt target/fb/simple.fb
-e INPUT_FACTBASE=simple.fb \
-e INPUT_VERBOSE=true \
-e INPUT_OUTPUT=pages \
-e INPUT_COLUMNS=what,when,who \
-e INPUT_HIDDEN=_id \
"$${img}"
echo "$$?" > target/entry.exit

Expand All @@ -98,6 +102,11 @@ rmi: target/docker-image.txt
verify:
e2=$$(cat target/entry.exit)
test "$${e2}" = "0"
test -e target/fb/pages/simple-index.html
test -e target/fb/pages/simple.html
test -e target/fb/pages/simple.xml
test -e target/fb/pages/simple.json
test -e target/fb/pages/simple.yaml

target/docker-image.txt: Makefile Dockerfile entry.sh
mkdir -p "$$(dirname $@)"
Expand Down
6 changes: 6 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,9 @@ inputs:
logo:
description: 'URL of the logo to put on the HTML page'
default: 'https://www.zerocracy.com/svg/logo.svg'
columns:
description: 'Comma-separated list of columns to print in the HTML'
default: 'when,what,who,repository,issue,details'
hidden:
description: 'Comma-separated list of properties to hide'
default: '_id,_time,_version'
11 changes: 8 additions & 3 deletions entry.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,13 @@ mkdir -p "${INPUT_OUTPUT}"
name=$(basename "${INPUT_FACTBASE}")
name="${name%.*}"

for f in yaml xml json; do
"${JUDGES}" "${gopts[@]}" print --format "${f}" "${INPUT_FACTBASE}" "${INPUT_OUTPUT}/${name}.${f}"
for f in yaml xml json html; do
"${JUDGES}" "${gopts[@]}" print \
--format "${f}" \
--columns "${INPUT_COLUMNS}" \
--hidden "${INPUT_HIDDEN}" \
"${INPUT_FACTBASE}" \
"${INPUT_OUTPUT}/${name}.${f}"
done

declare -a options=()
Expand All @@ -84,7 +89,7 @@ done <<< "${INPUT_OPTIONS}"
# Build a summary HTML.
css=$(cat "${SELF}/target/css/main.css")
js=$(cat "${SELF}/target/js/main.js")
html=${INPUT_OUTPUT}/${name}.html
html=${INPUT_OUTPUT}/${name}-index.html
java -jar "${SELF}/target/saxon.jar" \
"-s:${INPUT_OUTPUT}/${name}.rich.xml" \
"-xsl:${SELF}/target/xsl/index.xsl" \
Expand Down
5 changes: 4 additions & 1 deletion judges/normalize-qos-metrics/normalize-all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
options:
testing: true
input:
-
when: 2024-05-16T22:22:22.8492Z
what: quality-of-service
-
when: 2024-05-17T22:22:22.8492Z
what: quality-of-service
Expand All @@ -42,6 +45,6 @@ input:
average_release_interval: 40432.42
average_workflow_success_rate: 0.67
expected:
- /fb[count(f)=3]
- /fb[count(f)=4]
- /fb/f[n_average_issue_lifetime]
- /fb/f[n_average_release_interval]
11 changes: 10 additions & 1 deletion judges/normalize-qos-metrics/normalize-qos-metrics.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,20 @@
start[prop] = first[prop][0]
end

facts.drop(1).each do |f|
f.all_properties.each do |prop|
next unless prop.match?(/^[a-z]+_[a-z]+.*$/)
v = f[prop][0]
start[prop] = v if start[prop].nil?
end
end

facts.each do |f|
f.all_properties.each do |prop|
next unless prop.match?(/^[a-z]+_[a-z]+.*$/)
v = f[prop][0]
diff = v - start[prop]
s = start[prop]
diff = v - s
diff /= start[prop] unless start[prop].zero?
f.send("n_#{prop}=", diff)
end
Expand Down

0 comments on commit 7446e0b

Please sign in to comment.