Django not found in Github actions
I have the following CI pipeline defined in Github Actions. It is using the same container as which the production server is using. The pipeline was running fine last week, but this week it suddenly stopped working. Some observations from the run logs:
- We start with upgrading pip, but this doesn't seem to happen
- The dependencies are installed correctly, but it gives a warning that pip can be upgraded
- Running fake migrations immediately fails with
ModuleNotFoundError: No module named 'django'
.
Any ideas how I can debug this to investigate what is going wrong?
test_project:
runs-on: ubuntu-latest
container:
image: python:3.11-slim
strategy:
max-parallel: 2
matrix:
python-version: [ "3.11" ]
services:
postgres:
image: postgres:14
env:
POSTGRES_DB: postgres
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
options: >-
--health-cmd "pg_isready -U postgres"
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements-test.txt
- name: Check missing migrations
run: python project/manage.py makemigrations --check --dry-run --settings project.settings.local
- name: Run Tests
run: pytest --cov=project project/