-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add GHA to check version has changed
- Loading branch information
Showing
1 changed file
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# Check that the version has changed in setup.py. | ||
# Changing the code but not the version breaks `pip install` for projects that depend on this | ||
# package via marqo_commons @ git+https://github.com/marqo-ai/marqo-commons.git@main#egg=marqo_commons | ||
name: Check Version | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
branches: | ||
- main | ||
paths: | ||
- "requirements.txt" | ||
- "setup.py" | ||
- "src/**" | ||
|
||
jobs: | ||
test: | ||
name: Run Pytest | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.8 | ||
|
||
- name: Check that version has changed | ||
run: | | ||
# Get the version from setup.py at the base branch | ||
BASE_BRANCH=main | ||
BASE_VERSION=$(git show ${BASE_BRANCH}:setup.py | grep version | head -n1 | cut -d'"' -f2) | ||
# Get the version from setup.py at the current branch | ||
CURRENT_VERSION=$(grep version setup.py | head -n1 | cut -d'"' -f2) | ||
# Check if the versions are the same | ||
if [ "$BASE_VERSION" == "$CURRENT_VERSION" ]; then | ||
echo "Version has not changed" | ||
exit 1 | ||
fi |