diff --git a/etc/ci/github-actions-make.sh b/etc/ci/github-actions-make.sh index b74fb56495..1ac34a0ab6 100755 --- a/etc/ci/github-actions-make.sh +++ b/etc/ci/github-actions-make.sh @@ -24,6 +24,22 @@ 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 + +export SED +export SED_Z + make_one_time_file_real="" unameOut="$(uname -s)" if [[ "${unameOut}" == CYGWIN* ]]; then @@ -53,7 +69,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 +77,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