Switch environment manager to uv
#34
Workflow file for this run
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
name: Validate requirements.txt | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
validate-dependencies: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Fetch all history | |
run: git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/* | |
- name: Check for changes in pyproject.toml and uv.lock | |
id: check-deps | |
run: | | |
echo "Checking pyproject.toml and uv.lock for changes..." | |
BASE_BRANCH=${{ github.event.pull_request.base.ref }} | |
HEAD_BRANCH=${{ github.event.pull_request.head.ref }} | |
CHANGES=$(git diff --name-only origin/$BASE_BRANCH -- origin/$HEAD_BRANCH || grep -E "^(pyproject.toml|uv.lock)$" || true) | |
if [ ! -z "$CHANGES" == "true" ]; then | |
echo "Changes were detected..." | |
echo "Changed files: $CHANGES" | |
echo "uv_updated=true" >> $GITHUB_ENV | |
else | |
echo "Changes were NOT detected..." | |
echo "uv_updated=false" >> $GITHUB_ENV | |
fi | |
- name: Validate requirements.txt update | |
if: env.uv_updated == 'false' | |
run: | | |
echo "Checking if requirements.txt has been updated..." | |
BASE_BRANCH=${{ github.event.pull_request.base.ref }} | |
HEAD_BRANCH=${{ github.event.pull_request.head.ref }} | |
REQUIREMENTS_CHANGED=$(git diff --name-only origin/$BASE_BRANCH -- origin/$HEAD_BRANCH | grep -q "requirements.txt" && echo true || echo false) | |
if [ "$REQUIREMENTS_CHANGED" == "true" ]; then | |
echo "requirements.txt updated correctly." | |
else | |
echo "ERROR: pyproject.toml or uv.lock has changed, but requirements.txt has not been updated." | |
echo "Please update requirements.txt by running 'make create-requirements'." | |
exit 1 | |
fi |