Skip to content

Commit 01161af

Browse files
committed
updated test
1 parent 4f99260 commit 01161af

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

.github/workflows/setup-stackql.yml

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -32,21 +32,21 @@ jobs:
3232
- name: Get Stackql Version
3333
id: get-stackql-version
3434
run: |
35-
echo "::set-output name=stackql_version::$(stackql --version)"
35+
echo "stackql_version<<EOF" >> $GITHUB_ENV
36+
stackql --version >> $GITHUB_ENV
37+
echo "EOF" >> $GITHUB_ENV
3638
3739
- name: Validate Stackql Version
3840
run: |
39-
# Retrieve the output from the previous step
40-
VERSION_OUTPUT="${{ steps.get-stackql-version.outputs.stackql_version }}"
41+
# Extract only the relevant line containing version information
42+
VERSION_OUTPUT=$(echo "${{ env.stackql_version }}" | grep -E 'stackql v[0-9]+\.[0-9]+\.[0-9]+')
4143
echo "Version output: $VERSION_OUTPUT"
4244
43-
# Regex patterns to validate different parts
4445
SEMVER_REGEX="v[0-9]+\.[0-9]+\.[0-9]+"
4546
PLATFORM_REGEX="(Linux|Darwin|Windows)"
46-
# DATE_REGEX="\b\d{4}-\d{2}-\d{2}\b"
47-
# SHA_REGEX="\([0-9a-f]{7}\)"
47+
DATE_REGEX="BuildDate: \b\d{4}-\d{2}-\d{2}\b"
48+
SHA_REGEX="\([0-9a-f]{7}\)"
4849
49-
# Perform validation
5050
if ! [[ "$VERSION_OUTPUT" =~ $SEMVER_REGEX ]]; then
5151
echo "Semantic version does not match expected format"
5252
exit 1
@@ -55,16 +55,17 @@ jobs:
5555
echo "Platform information does not match expected formats"
5656
exit 1
5757
fi
58-
# if ! [[ "$VERSION_OUTPUT" =~ $DATE_REGEX ]]; then
59-
# echo "Build date does not match expected format"
60-
# exit 1
61-
# fi
62-
# if ! [[ "$VERSION_OUTPUT" =~ $SHA_REGEX ]]; then
63-
# echo "Commit SHA does not match expected format"
64-
# exit 1
65-
# fi
66-
67-
echo "stackql --version output validated successfully."
58+
if ! [[ "$VERSION_OUTPUT" =~ $DATE_REGEX ]]; then
59+
echo "Build date does not match expected format"
60+
exit 1
61+
fi
62+
if ! [[ "$VERSION_OUTPUT" =~ $SHA_REGEX ]]; then
63+
echo "Commit SHA does not match expected format"
64+
exit 1
65+
fi
66+
67+
echo "All components of the version output are validated successfully."
68+
6869
6970
7071

0 commit comments

Comments
 (0)