2021-03-31 06:18:04 +00:00
|
|
|
# PostgreSQL Unit Testing
|
|
|
|
|
|
|
|
name: PostgreSQL
|
|
|
|
|
|
|
|
on: ["push", "pull_request"]
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
|
|
|
|
test:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
2021-03-31 09:39:22 +00:00
|
|
|
env:
|
|
|
|
# Database backend configuration
|
|
|
|
INVENTREE_DB_ENGINE: django.db.backends.postgresql
|
2021-03-31 10:48:54 +00:00
|
|
|
INVENTREE_DB_NAME: inventree
|
2021-03-31 09:39:22 +00:00
|
|
|
INVENTREE_DB_USER: inventree
|
|
|
|
INVENTREE_DB_PASSWORD: password
|
|
|
|
INVENTREE_DB_HOST: '127.0.0.1'
|
|
|
|
INVENTREE_DB_PORT: 5432
|
2021-03-31 10:17:17 +00:00
|
|
|
INVENTREE_DEBUG: info
|
2021-03-31 11:31:50 +00:00
|
|
|
INVENTREE_MEDIA_ROOT: ./media
|
|
|
|
INVENTREE_STATIC_ROOT: ./static
|
2021-03-31 09:39:22 +00:00
|
|
|
|
2021-03-31 06:18:04 +00:00
|
|
|
services:
|
|
|
|
postgres:
|
|
|
|
image: postgres
|
2021-03-31 06:40:37 +00:00
|
|
|
env:
|
2021-03-31 06:45:57 +00:00
|
|
|
POSTGRES_USER: inventree
|
2021-03-31 06:40:37 +00:00
|
|
|
POSTGRES_PASSWORD: password
|
2021-03-31 06:28:30 +00:00
|
|
|
ports:
|
2021-03-31 06:45:57 +00:00
|
|
|
- 5432:5432
|
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 libpq-dev
|
|
|
|
pip3 install invoke
|
2021-03-31 06:45:57 +00:00
|
|
|
pip3 install psycopg2
|
2021-03-31 06:18:04 +00:00
|
|
|
invoke install
|
|
|
|
- name: Run Tests
|
2021-04-25 00:30:31 +00:00
|
|
|
run: invoke test
|
|
|
|
- name: Data Import Export
|
|
|
|
run: |
|
2021-04-25 01:07:43 +00:00
|
|
|
invoke migrate
|
2021-04-25 00:30:31 +00:00
|
|
|
python3 ./InvenTree/manage.py flush --noinput
|
|
|
|
invoke import-fixtures
|
|
|
|
invoke export-records -f data.json
|
|
|
|
python3 ./InvenTree/manage.py flush --noinput
|
2021-04-25 02:30:14 +00:00
|
|
|
invoke import-records -f data.json
|
2021-04-25 00:30:31 +00:00
|
|
|
invoke import-records -f data.json
|