Skip to content

Commit

Permalink
Use gsed on MacOS CI
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonGross committed Apr 16, 2024
1 parent cff8b9c commit 26400c5
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions etc/ci/github-actions-make.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,19 @@ if [ ! -z "${reportify}" ]; then
reportify="COQC=$(pwd)/etc/coq-scripts/github/reportify-coq.sh${reportify} ${COQBIN}coqc"
fi

if [ -z "${SED+x}" ]; then
# use gsed on macOS
if command -v gsed >/dev/null 2>&1; then
SED=gsed
else
SED=sed
fi
fi

if [ -z "${SED_Z}" ]; then
SED_Z="${SED} -z"
fi

make_one_time_file_real=""
unameOut="$(uname -s)"
if [[ "${unameOut}" == CYGWIN* ]]; then
Expand Down Expand Up @@ -53,15 +66,15 @@ fi
unameOut="$(uname -s)"
if [[ "${unameOut}" == CYGWIN* ]]; then
# generated build outputs have a different path, so we fix up the paths
git grep --name-only 'D:\\a\\fiat-crypto\\fiat-crypto.src.ExtractionOCaml.' | xargs sed s',D:\\a\\fiat-crypto\\fiat-crypto.src.ExtractionOCaml.\(.*\).exe,src/ExtractionOCaml/\1,g' -i
git grep --name-only 'D:\\a\\fiat-crypto\\fiat-crypto.src.ExtractionOCaml.' | xargs ${SED} s',D:\\a\\fiat-crypto\\fiat-crypto.src.ExtractionOCaml.\(.*\).exe,src/ExtractionOCaml/\1,g' -i
fi

if [ ! -z "$(git diff)" ]; then
git submodule foreach --recursive git diff
git submodule foreach --recursive git status
git diff
diff_msg="$(git diff 2>&1; git submodule foreach --recursive git diff 2>&1; git submodule foreach --recursive git status 2>&1)"
diff_msg="$(printf "Non-empty-diff:\n%s\n" "${diff_msg}" | sed -z 's/\n/%0A/g')"
diff_msg="$(printf "Non-empty-diff:\n%s\n" "${diff_msg}" | ${SED_Z} 's/\n/%0A/g')"
if [ "${ALLOW_DIFF}" != "1" ]; then
printf "::error::%s" "${diff_msg}"
exit 1
Expand Down

0 comments on commit 26400c5

Please sign in to comment.