Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use gsed on MacOS CI #1875

Merged
merged 2 commits into from
Apr 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 18 additions & 2 deletions etc/ci/github-actions-make.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -53,15 +69,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
Loading