Skip to content
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

Version check step #524

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion .github/workflows/pypi_release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,24 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Compare versions
working-directory: ${{ github.workspace }}
run: |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: Setting working-directory to github.workspace is redundant since the paths are already absolute. This can be removed.

file1="libs/client_infinity/infinity_client/pyproject.toml"
file2="libs/infinity_emb/pyproject.toml"

version1=$(grep 'version = ' "$file1" | sed 's/version = //' | tr -d '\"')
version2=$(grep 'version = ' "$file2" | sed 's/version = //' | tr -d '\"')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: The grep pattern is fragile and may fail if there are comments containing 'version = ' or if the version field spans multiple lines. Consider using a TOML parser instead.


echo "Version 1: $version1"
echo "Version 2: $version2"

if [ "$version1" != "$version2" ]; then
echo "Version mismatch: $version1 != $version2"
exit 1
else
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: Version comparison should handle cases where version strings are empty or malformed. Add validation before comparison.

Suggested change
if [ "$version1" != "$version2" ]; then
echo "Version mismatch: $version1 != $version2"
exit 1
else
if [ -z "$version1" ] || [ -z "$version2" ]; then
echo "Error: Empty version string detected"
exit 1
elif [ "$version1" != "$version2" ]; then
echo "Version mismatch: $version1 != $version2"
exit 1
else

echo "Versions match: $version1 == $version2"

- name: Set up Python + Poetry ${{ env.POETRY_VERSION }}
uses: "./.github/actions/poetry_setup"
with:
Expand Down Expand Up @@ -58,4 +76,4 @@ jobs:
modal-deploy:
needs: publish-to-pypi
uses: ./.github/workflows/release_modal_com.yaml
secrets: inherit
secrets: inherit
Loading