From 26400c5e7edf502b9aae7cb5f90067dff19dfeb0 Mon Sep 17 00:00:00 2001 From: Jason Gross Date: Tue, 16 Apr 2024 11:59:56 -0700 Subject: [PATCH] Use gsed on MacOS CI --- etc/ci/github-actions-make.sh | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/etc/ci/github-actions-make.sh b/etc/ci/github-actions-make.sh index b74fb564954..23a1c4fc049 100755 --- a/etc/ci/github-actions-make.sh +++ b/etc/ci/github-actions-make.sh @@ -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 @@ -53,7 +66,7 @@ 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 @@ -61,7 +74,7 @@ if [ ! -z "$(git diff)" ]; then 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