Skip to content

Commit

Permalink
updated test
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffreyaven committed Apr 26, 2024
1 parent 4f99260 commit 01161af
Showing 1 changed file with 18 additions and 17 deletions.
35 changes: 18 additions & 17 deletions .github/workflows/setup-stackql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,21 @@ jobs:
- name: Get Stackql Version
id: get-stackql-version
run: |
echo "::set-output name=stackql_version::$(stackql --version)"
echo "stackql_version<<EOF" >> $GITHUB_ENV
stackql --version >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
- name: Validate Stackql Version
run: |
# Retrieve the output from the previous step
VERSION_OUTPUT="${{ steps.get-stackql-version.outputs.stackql_version }}"
# Extract only the relevant line containing version information
VERSION_OUTPUT=$(echo "${{ env.stackql_version }}" | grep -E 'stackql v[0-9]+\.[0-9]+\.[0-9]+')
echo "Version output: $VERSION_OUTPUT"
# Regex patterns to validate different parts
SEMVER_REGEX="v[0-9]+\.[0-9]+\.[0-9]+"
PLATFORM_REGEX="(Linux|Darwin|Windows)"
# DATE_REGEX="\b\d{4}-\d{2}-\d{2}\b"
# SHA_REGEX="\([0-9a-f]{7}\)"
DATE_REGEX="BuildDate: \b\d{4}-\d{2}-\d{2}\b"
SHA_REGEX="\([0-9a-f]{7}\)"
# Perform validation
if ! [[ "$VERSION_OUTPUT" =~ $SEMVER_REGEX ]]; then
echo "Semantic version does not match expected format"
exit 1
Expand All @@ -55,16 +55,17 @@ jobs:
echo "Platform information does not match expected formats"
exit 1
fi
# if ! [[ "$VERSION_OUTPUT" =~ $DATE_REGEX ]]; then
# echo "Build date does not match expected format"
# exit 1
# fi
# if ! [[ "$VERSION_OUTPUT" =~ $SHA_REGEX ]]; then
# echo "Commit SHA does not match expected format"
# exit 1
# fi
echo "stackql --version output validated successfully."
if ! [[ "$VERSION_OUTPUT" =~ $DATE_REGEX ]]; then
echo "Build date does not match expected format"
exit 1
fi
if ! [[ "$VERSION_OUTPUT" =~ $SHA_REGEX ]]; then
echo "Commit SHA does not match expected format"
exit 1
fi
echo "All components of the version output are validated successfully."
Expand Down

0 comments on commit 01161af

Please sign in to comment.