Skip to content

Commit 5911ee2

Browse files
authored
Add Odin version mismatch warning to run-test and check-exercise (#150)
* Add Odin version mismatch warning to run-test and check-exercise I added a file ODIN_VERSION at the top of the repo that contains the version of the Odin compiler the test-runner is using. This is used to warn contributors when the run run-test or check-exercise before they push a PR that they are using a different version (and that may cause compilation failure when the exercise is checked by the track GHA). I only made is a warning, this will not cause the checks to fail. * Update regex for cygwin On Cygwin when you execute `odin version`, it returns some path in front of `odin version dev-...`, adjust the regex to remove that part. * Combine sed commands to clean up odin version
1 parent 2cb932c commit 5911ee2

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

ODIN_VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
odin version dev-2025-10-nightly

bin/check-exercise.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,4 +144,12 @@ check_format tests "${exercise_path}/${exercise_name}_test.odin"
144144
check_format example "${exercise_path}/.meta/example.odin"
145145
check_for_missing_test_descriptions "${exercise_path}/${exercise_name}_test.odin"
146146

147+
if [ -f ODIN_VERSION ]; then
148+
local_version=$(odin version | sed -E 's/:.*$//; s/^.*odin version //')
149+
supported_version=$(sed -E 's/^odin version //' ODIN_VERSION)
150+
if [[ "$local_version" != "$supported_version" ]]; then
151+
echo "⚠️[WARNING] Project's Odin version is: $supported_version but your local version is: $local_version"
152+
fi
153+
fi
154+
147155
echo "Exercise $exercise_name pass all the checks!"

bin/run-test.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,14 @@ run_test() {
105105
else
106106
echo 'SUCCESS: The stub file failed the tests above as expected.'
107107
fi
108+
109+
if [ -f ODIN_VERSION ]; then
110+
local_version=$(odin version | sed -E 's/:.*$//; s/^.*odin version //')
111+
supported_version=$(sed -E 's/^odin version //' ODIN_VERSION)
112+
if [[ "$local_version" != "$supported_version" ]]; then
113+
echo "[WARNING] Project's Odin version is: $supported_version but your local version is: $local_version"
114+
fi
115+
fi
108116
}
109117

110118
run_test "$@"

0 commit comments

Comments
 (0)