-
Notifications
You must be signed in to change notification settings - Fork 4
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
Andrew7234/workflow nits #657
base: main
Are you sure you want to change the base?
Conversation
for range in $(find "$directory" -type d); do | ||
for range in $(find "tests/e2e_regression" -maxdepth 1 -mindepth 1 -type d); do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
./tests/e2e_regression/ensure_consistent_config.sh: line 26: directory: unbound variable
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
woa how did this used to work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤨 yeah the old code makes no sense
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed in #665, this script now takes the name of a suite as a parameter instead of searching around
tests/e2e_regression/run.sh
Outdated
@@ -89,7 +89,7 @@ for ((i = 0; i < nCases; i++)); do | |||
>/tmp/pretty 2>/dev/null && | |||
cp /tmp/pretty "$outDir/$name.body" || true | |||
# Sanitize the current timestamp out of the response header so that diffs are stable | |||
sed -i -E 's/^(Date|Content-Length|Last-Modified): .*/\1: UNINTERESTING/g' "$outDir/$name.headers" | |||
sed -i '' -E 's/^(Date|Content-Length|Last-Modified): .*/\1: UNINTERESTING/g' "$outDir/$name.headers" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't be related to zsh, maybe mac's coreutils. this script has a shebang set for bash anyway
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uhh I remember we've had back-and-forth with sed -i ''
before :(
This doesn't work on GNU sed (which is what I have locally, and what CI has). It interprets the ''
as the sed script to run. You can try it yourself: docker run -it bash
, then echo foo >/tmp/x; sed -i '' 's/o/a/' /tmp/x
.
You could try instead:
- using
echo foo >/tmp/x; sed --in-place='' 's/o/a/' /tmp/x
(though I think that's not supported on MacOS?) - creating a little helper function that reimplements
sed -i
without using-i
(*), or using-i
based on some OS-specific check - leaving this as-is and using GNU sed on your machine?
(*) something like
sed_i() {
local file="${@: -1}" # Get the last argument (file path)
local script="${@: -2:1}" # Get the penultimate argument (sed script)
local flags="${@:1:$#-2}" # Get flags (all arguments except the last two)
local temp_file="$(mktemp)"
sed "${flags[@]}" "$script" "$file" > "$temp_file"
mv "$temp_file" "$file" # Overwrites the original file
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Andrew7234 I think you said you're using GNU sed on your machine currently? So that resolves this thread for now (remember to undo the change), and you can submit the rest of the PR at least. It's useful stuff, would be a shame if it rotted away.
# output every time the spec changes. \ | ||
# The result of the "spec" test is a special case. It should always match the | ||
# current openAPI spec file, so we symlink it to avoid having to update the expected | ||
# output every time the spec changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the \
at the end of commented lines caused subsequent non-comment lines to be treated as a comment and skipped
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what was the intention with these? run the whole thing in one shell instead of several?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm I'm not sure.. maybe @mitjat knows? I'm also curious as to whether it works locally for y'all as-is
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just tried on linux with GNU bash, version 5.2.21(1)-release and GNU Make 4.3, the lower lines seem to run normally
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting. I don't remember why the \
are there, unfortunately. If this works locally and in CI, LGTM.
Although I'd say:
- If we're doing this, let's remove all
\
in this recipe so we're not using a weird mix. - Prepend every
#
with@
or elsemake
will echo those comments to the console every time we run the recipe.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is moved to a new script e2e_regression/accept.sh in #665, which makes it no longer necessary to use \
s. it also should quiet down the logging of every line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thank you for all of these! Approving because LGTM (pending comments), but happy to look at it again if you wanted to add more to the same PR.
for range in $(find "$directory" -type d); do | ||
for range in $(find "tests/e2e_regression" -maxdepth 1 -mindepth 1 -type d); do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤨 yeah the old code makes no sense
# output every time the spec changes. \ | ||
# The result of the "spec" test is a special case. It should always match the | ||
# current openAPI spec file, so we symlink it to avoid having to update the expected | ||
# output every time the spec changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting. I don't remember why the \
are there, unfortunately. If this works locally and in CI, LGTM.
Although I'd say:
- If we're doing this, let's remove all
\
in this recipe so we're not using a weird mix. - Prepend every
#
with@
or elsemake
will echo those comments to the console every time we run the recipe.
tests/e2e_regression/run.sh
Outdated
@@ -89,7 +89,7 @@ for ((i = 0; i < nCases; i++)); do | |||
>/tmp/pretty 2>/dev/null && | |||
cp /tmp/pretty "$outDir/$name.body" || true | |||
# Sanitize the current timestamp out of the response header so that diffs are stable | |||
sed -i -E 's/^(Date|Content-Length|Last-Modified): .*/\1: UNINTERESTING/g' "$outDir/$name.headers" | |||
sed -i '' -E 's/^(Date|Content-Length|Last-Modified): .*/\1: UNINTERESTING/g' "$outDir/$name.headers" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uhh I remember we've had back-and-forth with sed -i ''
before :(
This doesn't work on GNU sed (which is what I have locally, and what CI has). It interprets the ''
as the sed script to run. You can try it yourself: docker run -it bash
, then echo foo >/tmp/x; sed -i '' 's/o/a/' /tmp/x
.
You could try instead:
- using
echo foo >/tmp/x; sed --in-place='' 's/o/a/' /tmp/x
(though I think that's not supported on MacOS?) - creating a little helper function that reimplements
sed -i
without using-i
(*), or using-i
based on some OS-specific check - leaving this as-is and using GNU sed on your machine?
(*) something like
sed_i() {
local file="${@: -1}" # Get the last argument (file path)
local script="${@: -2:1}" # Get the penultimate argument (sed script)
local flags="${@:1:$#-2}" # Get flags (all arguments except the last two)
local temp_file="$(mktemp)"
sed "${flags[@]}" "$script" "$file" > "$temp_file"
mv "$temp_file" "$file" # Overwrites the original file
}
f05a4f3
to
beedf21
Compare
remove old sourcify cache makefile script fix(?) fix script [do not merge] zsh-compatible version of run.sh evmverifier: remove extraneous fields add changelog
beedf21
to
2c4f68f
Compare
do not merge (yet)
This PR has misc tweaks/fixes for things that were broken in my local dev setup (zsh on Mac OS). I'm not sure if all of it should be merged; just wanted to start a discussion. I tried to separate different issues by commit