InvenTree/.github/workflows/mysql.yaml

65 lines
1.6 KiB
YAML
Raw Normal View History

2021-03-31 06:18:04 +00:00
# MySQL Unit Testing
name: MySQL
2021-05-28 03:24:18 +00:00
on:
workflow_run:
workflows: ['PR checks']
types:
- completed
2021-03-31 06:18:04 +00:00
2021-12-02 12:08:19 +00:00
env:
# Database backend configuration
INVENTREE_DB_ENGINE: django.db.backends.mysql
INVENTREE_DB_NAME: inventree
INVENTREE_DB_USER: root
INVENTREE_DB_PASSWORD: password
INVENTREE_DB_HOST: '127.0.0.1'
INVENTREE_DB_PORT: 3306
INVENTREE_DEBUG: info
INVENTREE_MEDIA_ROOT: ./media
INVENTREE_STATIC_ROOT: ./static
2021-03-31 06:18:04 +00:00
jobs:
test:
runs-on: ubuntu-latest
services:
mysql:
2021-03-31 06:40:37 +00:00
image: mysql:latest
2021-03-31 06:18:04 +00:00
env:
2021-03-31 06:40:37 +00:00
MYSQL_ALLOW_EMPTY_PASSWORD: yes
2021-03-31 10:54:13 +00:00
MYSQL_DATABASE: inventree
2021-03-31 06:40:37 +00:00
MYSQL_USER: inventree
MYSQL_PASSWORD: password
2021-03-31 09:01:02 +00:00
MYSQL_ROOT_PASSWORD: password
2021-03-31 06:40:37 +00:00
options: --health-cmd="mysqladmin ping" --health-interval=5s --health-timeout=2s --health-retries=3
2021-03-31 06:28:30 +00:00
ports:
2021-03-31 06:45:57 +00:00
- 3306:3306
2021-05-06 12:38:13 +00:00
2021-03-31 06:18:04 +00:00
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Install Dependencies
run: |
sudo apt-get install mysql-server libmysqlclient-dev
pip3 install invoke
pip3 install mysqlclient
invoke install
- name: Run Tests
run: invoke test
- name: Data Import Export
run: |
2021-04-25 01:07:43 +00:00
invoke migrate
python3 ./InvenTree/manage.py flush --noinput
invoke import-fixtures
invoke export-records -f data.json
python3 ./InvenTree/manage.py flush --noinput
invoke import-records -f data.json
invoke import-records -f data.json