Refactor Workflows #476
Workflow file for this run
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
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 }} with cache | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install system dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y \ | |
default-libmysqlclient-dev build-essential \ | |
libssl-dev openjdk-11-jdk curl | |
- name: Install MySQL | |
run: | | |
sudo apt-get install -y gnupg | |
curl -OL https://dev.mysql.com/get/mysql-apt-config_0.8.32-1_all.deb | |
sudo dpkg -i mysql-apt-config_0.8.32-1_all.deb | |
sudo apt-get update | |
sudo apt-get install -y mysql-server | |
sudo service mysql start | |
sudo mysql -e 'CREATE DATABASE edx_notes_api;' | |
sudo mysql -e "CREATE USER 'notes001'@'localhost' IDENTIFIED BY 'secret';" | |
sudo mysql -e "GRANT ALL PRIVILEGES ON edx_notes_api.* TO 'notes001'@'localhost';" | |
- 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 | |
run: tox -e ${{ matrix.toxenv }} |