Skip to content

Refactor Workflows #501

Refactor Workflows

Refactor Workflows #501

Workflow file for this run

name: Django CI
on:
push:
branches: [master]
pull_request:
branches:
- "**"
jobs:
run_tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12"]
toxenv: ["django42"] # "quality", "pii_check", "check_keywords"
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install system MySQL
run: |
sudo apt-get update && sudo apt-get install -y libxmlsec1-dev mysql-client
sudo service mysql start
mysql -h 127.0.0.1 -u root -proot -e "UPDATE mysql.user SET authentication_string = null WHERE user = 'root'; FLUSH PRIVILEGES;"
echo "CREATE DATABASE IF NOT EXISTS edx_notes_api;" | sudo mysql -u root
- name: Install Elasticsearch
run: |
curl -fsSL https://artifacts.elastic.co/GPG-KEY-elasticsearch | \
sudo gpg --dearmor -o /usr/share/keyrings/elasticsearch-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/elasticsearch-keyring.gpg] \
https://artifacts.elastic.co/packages/7.x/apt stable main" | \
sudo tee -a /etc/apt/sources.list.d/elastic-7.x.list
sudo apt-get update && sudo apt-get install -y elasticsearch=7.13.4
sudo service elasticsearch start
- name: Install pip and Tox
run: |
pip install --upgrade pip tox
- name: Run Tox tests
env:
CONN_MAX_AGE: 60
DB_ENGINE: django.db.backends.mysql
DB_HOST: localhost
DB_NAME: edx_notes_api
DB_PASSWORD:
DB_PORT: 3306
DB_USER: root
ENABLE_DJANGO_TOOLBAR: 1
ELASTICSEARCH_URL: http://localhost:9200
run: tox -e ${{ matrix.toxenv }}