Update the default memory per work #904
This file contains hidden or 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: Run pre-commit | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
workflow_call: | |
jobs: | |
pre-commit-check: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 2 # Needed for HEAD to exists | |
- name: Install uv | |
uses: astral-sh/setup-uv@v4 | |
with: | |
python-version: "3.12" | |
- name: Configure caching | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cache/pre-commit | |
key: precommit-${{ runner.os }}-${{ hashFiles('.pre-commit-config.yaml') }} | |
- name: Install dependencies | |
run: | | |
uv sync --group lint | |
- name: Run pre-commit | |
run: | | |
uv run pre-commit run --all-files | |
- name: Test if pipeline is up-to-date | |
run: | | |
uv run make pipeline | |
git diff --exit-code || (echo "Pipeline is not up-to-date. Please run 'make pipeline' and commit the changes." && exit 1) | |
- name: Compile requirements.txt | |
run: | | |
uv pip compile pyproject.toml --generate-hashes > requirements.txt | |
- name: Validate requirements.txt | |
run: | | |
files_changed=$(git diff --name-only HEAD^) | |
echo "Files changed: $files_changed" | |
if [[ $files_changed == *"pyproject.toml"* && $files_changed != *"requirements.txt"* ]]; then | |
echo "requirements.txt dependencies do not match pyproject.toml" | |
echo "Please update requirements.txt by running 'uv pip compile pyproject.toml > requirements.txt', from the project root." | |
exit 1 | |
fi |