mirror of https://github.com/Wilfred/difftastic/
ci: bump go and moby, rework clone function
parent
78aa09efac
commit
e4681d2e50
@ -1,5 +0,0 @@
|
||||
# Unhandled identifier character: 'ŝ'
|
||||
examples/go/src/math/big/arith.go
|
||||
|
||||
# Unhandled identifier character: 'ƒ'
|
||||
examples/moby/vendor/github.com/beorn7/perks/quantile/stream.go
|
||||
@ -1,36 +1,47 @@
|
||||
#!/bin/bash
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
set -eu
|
||||
|
||||
cd "$(dirname "$0")/.."
|
||||
|
||||
function checkout_at() {
|
||||
repo=$1; url=$2; sha=$3
|
||||
if [ ! -d "$repo" ]; then
|
||||
git clone "https://github.com/$url" "$repo"
|
||||
fi
|
||||
|
||||
pushd "$repo"
|
||||
git fetch && git reset --hard "$sha"
|
||||
popd
|
||||
function clone_repo {
|
||||
owner=$1
|
||||
name=$2
|
||||
sha=$3
|
||||
|
||||
path=examples/$name
|
||||
if [ ! -d "$path" ]; then
|
||||
echo "Cloning $owner/$name"
|
||||
git clone "https://github.com/$owner/$name" "$path"
|
||||
fi
|
||||
|
||||
pushd "$path" >/dev/null
|
||||
actual_sha=$(git rev-parse HEAD)
|
||||
if [ "$actual_sha" != "$sha" ]; then
|
||||
echo "Updating $owner/$name to $sha"
|
||||
git fetch
|
||||
git reset --hard "$sha"
|
||||
fi
|
||||
popd >/dev/null
|
||||
}
|
||||
|
||||
checkout_at "examples/go" "golang/go" "870e12d7bfaea70fb0d743842f5864eb059cb939"
|
||||
checkout_at "examples/moby" "moby/moby" "f57f260b49b6142366e6bc1274204ee0a1205945"
|
||||
clone_repo golang go d75cc4b9c6e2acb4d0ed3d90c9a8b38094af281b
|
||||
clone_repo moby moby ecbd126d6ac8c6818786f67e87f723543a037adb
|
||||
|
||||
known_failures="$(cat script/known-failures.txt | egrep -v '^#')"
|
||||
known_failures="$(cat script/known-failures.txt)"
|
||||
|
||||
time tree-sitter parse -q \
|
||||
'examples/**/*.go' \
|
||||
'!**/testdata/**/*' \
|
||||
'!**/go/test/**/*' \
|
||||
$(for failure in $known_failures; do echo "!${failure}"; done)
|
||||
# shellcheck disable=2046
|
||||
tree-sitter parse -q \
|
||||
'examples/**/*.go' \
|
||||
'!**/testdata/**/*' \
|
||||
'!**/go/test/**/*' \
|
||||
$(for failure in $known_failures; do echo "!${failure}"; done)
|
||||
|
||||
example_count=$(find examples -name '*.go' | egrep -v 'go/test|testdata' | wc -l)
|
||||
failure_count=$(wc -w <<< "$known_failures")
|
||||
success_count=$(( $example_count - $failure_count ))
|
||||
success_percent=$(bc -l <<< "100*${success_count}/${example_count}")
|
||||
example_count=$(find examples -name '*.go' | grep -E -v -c 'go/test|testdata')
|
||||
failure_count=$(wc -w <<<"$known_failures")
|
||||
success_count=$((example_count - failure_count))
|
||||
success_percent=$(bc -l <<<"100*${success_count}/${example_count}")
|
||||
|
||||
printf \
|
||||
"Successfully parsed %d of %d example files (%.1f%%)\n" \
|
||||
$success_count $example_count $success_percent
|
||||
"Successfully parsed %d of %d example files (%.1f%%)\n" \
|
||||
$success_count "$example_count" "$success_percent"
|
||||
|
||||
Loading…
Reference in New Issue