-
Notifications
You must be signed in to change notification settings - Fork 2k
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
#104 Run tests for the user creating the PR #106
Conversation
@gunnarmorling this is now ready for merging. I've removed the commits that were causing failures. |
echo "$CALCULATE_FILE does not exist." | ||
exit 1 | ||
fi | ||
|
||
for sample in $(ls src/test/resources/samples/*.txt); do | ||
echo "Validating calculate_average_$1.sh -- $sample" |
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 guess we can change this to echo "Validating $1 -- $sample"
to make it a bit cleaner
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.
Sounds OK to me. I'll change it.
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 forgot to change this. I think we can merge without it, and we can change it later.
@@ -47,3 +47,7 @@ jobs: | |||
|
|||
- name: 'Build project' | |||
run: mvn -B clean verify -Pci | |||
|
|||
- name: 'Test submission' | |||
run: ./test.sh ${{ github.event.pull_request.user.login }} |
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 am not sure this will work for all submissions, e.g. some use sdk or graal
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.
Indeed it might not work. I'll see if we can use https://github.com/sdkman/sdkman-action/tree/main
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, I think this would be good. Wanna add it to this PR?
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.
Was already working on it, but I am travelling today so a bit slow :)
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.
There is a related ticket #150
I thin PR description fixes wrong ticket, should be #104 |
good point. I've updated that |
I've squashed all the commits and I've added SDKMAN as an action. For this to work on the CI people will need to do something like:
The Aside from this approach, I have also been looking into an alternative. However, it would require a change in all scripts. The calculate script can look like function java_to_use() {
echo "21.0.1-graal"
}
function run_submission() {
JAVA_OPTS=""
time java $JAVA_OPTS --class-path target/average-1.0.0-SNAPSHOT.jar dev.morling.onebrc.CalculateAverage_<username>
} The source $HOME/.sdkman/bin/sdkman-init.sh
function sdk_use_java() {
if [ -z "$1" ]; then
echo "Usage: sdk_use_java <candidate>"
exit 1
fi
java_to_use="$1"
sdk install java ${java_to_use} 1>&2
sdk use java ${java_to_use} 1>&2
}
if [ -n "$(LC_ALL=C type -t java_to_use)" ] && [ "$(LC_ALL=C type -t java_to_use)" = function ]; then
sdk_java=$(java_to_use)
sdk_use_java ${sdk_java}
fi
java -version the source ${CALCULATE_FILE}
source ./helper.sh and in the loop the diff would be diff <(run_submission) ${sample%.txt}.out Similar chnage would be needed for the Let me know what you think about this idea. |
… that the calculate file exists for the user
Could we somehow pre-install all the (currently) used distributions? |
Any thoughts on this, @filiphr? Or should we close it for now? |
Yes we can do that. I've been away with a really bad internet connection. I'm back on Sunday, will be able to look into it then |
Ok, closing for now. Thx for looking into this, @filiphr! |
Gave this another try, see #535. |
Adding a step in the GitHub action to test the submission of the user submitting the PR
Fixes #104
@gunnarmorling please wait for merging, I want to also push some failures to see how it looks like.
cc @AlexanderYastrebov