Bump django from 4.2.16 to 5.1.3 #5358
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
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
name: Django | |
on: | |
push: | |
branches: [master] | |
pull_request: | |
branches: [master] | |
permissions: | |
contents: read | |
pull-requests: write | |
jobs: | |
build-and-test-django: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Configure sysctl limits | |
run: | | |
sudo swapoff -a | |
sudo sysctl -w vm.swappiness=1 | |
sudo sysctl -w fs.file-max=262144 | |
sudo sysctl -w vm.max_map_count=262144 | |
- uses: getong/[email protected] | |
with: | |
elasticsearch version: '7.7.0' | |
host port: 9200 | |
container port: 9200 | |
host node port: 9300 | |
node port: 9300 | |
discovery type: 'single-node' | |
- name: Redis Server in GitHub Actions | |
uses: supercharge/[email protected] | |
with: | |
# Redis version to use | |
redis-version: '5.0.5' | |
- name: Setup PostgreSQL | |
uses: Harmon758/[email protected] | |
with: | |
# Version of PostgreSQL to use | |
postgresql version: '12' | |
postgresql db: peterbecom | |
postgresql user: user | |
postgresql password: secret | |
- uses: actions/checkout@v4 | |
- name: Setup Node.js environment | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '18' | |
cache: 'yarn' | |
- name: Cache node_modules | |
uses: actions/cache@v4 | |
id: cached-node_modules | |
with: | |
path: | | |
node_modules | |
key: ${{ runner.os }}-${{ hashFiles('yarn.lock') }}-${{ hashFiles('.github/workflows/python.yml') }} | |
- name: Install yarn packages | |
if: steps.cached-node_modules.outputs.cache-hit != 'true' | |
run: yarn --frozen-lockfile | |
- name: Install uv | |
id: setup-uv | |
uses: astral-sh/setup-uv@v3 | |
with: | |
enable-cache: true | |
cache-dependency-glob: 'uv.lock' | |
- name: Celebrate uv cache hit | |
if: steps.setup-uv.outputs.cache-hit == 'true' | |
run: echo "Cache was restored" | |
- name: Set up Python | |
run: uv python install 3.12.7 | |
- name: Install the project | |
run: uv sync | |
- name: Make sure it's synced | |
run: | | |
# If the uv.lock (dependencies and devDependencies) is | |
# in correct sync with pyproject.toml running `uv sync` | |
# should *not* make an edit to the uv.lock. I.e. | |
# running `git status` should | |
# say "nothing to commit, working tree clean". | |
git diff --exit-code | |
- name: Fix the uv.lock | |
# if: ${{ failure() && github.event_name != 'pull_request' && (github.actor != 'dependabot[bot]' || github.actor != 'peterbe') }} | |
if: ${{ failure() }} | |
run: | | |
# Update the uv.lock for them | |
set -e | |
echo "DEBUG EVENT NAME: ${{ github.event_name }}" | |
echo "DEBUG ACTOR: ${{ github.actor }}" | |
echo "--------------------------------------------------------------------" | |
echo "" | |
git diff --exit-code || uv sync | |
echo "--------------------------------------------------------------------" | |
echo "" | |
git status | |
echo "" | |
echo "CURRENT BRANCH NAME:" | |
git branch | |
git fetch origin | |
echo "TRYING TO CHECK OUT: ${{ github.head_ref || github.ref_name}}" | |
git checkout ${{ github.head_ref || github.ref_name}} | |
echo "NEW CURRENT BRANCH NAME:" | |
git branch | |
git add uv.lock | |
echo "--------------------------------------------------------------------" | |
echo "" | |
git config --global user.name "peterbe" | |
git config --global user.email "[email protected]" | |
echo "COMMIT:_____________________________________________________________" | |
git commit -m "Update uv.lock" | |
echo "PUSH:_______________________________________________________________" | |
git push origin ${{ github.head_ref || github.ref_name}} | |
- name: Inspect virtual env | |
run: | | |
echo "SIZE OF .venv:" | |
du -sh .venv | |
- name: Install system dependencies | |
run: sudo apt-get install pngquant | |
- name: Download NLTK dependencies | |
run: uv run python scripts/nltk-downloads.py | |
- name: Run Lints | |
run: uv run ruff check . | |
- name: Run Tests | |
run: | | |
./scripts/ci-test.sh |