Skip to content

fix: Remove Settings import in settings file (#454) #449

fix: Remove Settings import in settings file (#454)

fix: Remove Settings import in settings file (#454) #449

name: Migrations check on MySQL 8
on:
workflow_dispatch:
pull_request:
push:
branches:
- master
jobs:
check_migrations:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12"]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }} with cache
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
cache-dependency-path: "**/pip-tools.txt"
- name: Install system packages
run: sudo apt-get update && sudo apt-get install -y libxmlsec1-dev
# pinning xmlsec to version 1.3.13 to avoid the CI error, migration checks are failing due to an issue in the latest release of python-xmlsec
# https://github.com/xmlsec/python-xmlsec/issues/314
- name: Install Python dependencies
run: |
pip install -r requirements/pip-tools.txt
pip install -r requirements/test.txt
pip install -r requirements/base.txt
pip uninstall -y mysqlclient
pip install --no-binary mysqlclient mysqlclient
pip uninstall -y xmlsec
pip install --no-binary xmlsec xmlsec==1.3.13
- name: Start MySQL service
run: sudo service mysql start
- name: Reset MySQL root password
run: |
mysql -h 127.0.0.1 -u root -proot -e "UPDATE mysql.user SET authentication_string = null WHERE user = 'root'; FLUSH PRIVILEGES;"
- name: Run migrations
env:
DB_ENGINE: django.db.backends.mysql
DB_NAME: edx_notes_api
DB_USER: root
DB_PASSWORD:
DB_HOST: localhost
DB_PORT: 3306
run: |
echo "CREATE DATABASE IF NOT EXISTS edx_notes_api;" | sudo mysql -u root
python manage.py migrate --settings=notesserver.settings.test