mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Add workflow to ensure that the python bindings build whenever there's a push to master
This commit is contained in:
parent
da311fbab7
commit
fcd38c16d8
45
.github/workflows/python.yaml
vendored
Normal file
45
.github/workflows/python.yaml
vendored
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
# Run python library tests whenever code is pushed to master
|
||||||
|
|
||||||
|
name: Python Bindings
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- 'master'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
|
||||||
|
python:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
INVENTREE_DB_NAME: './test_db.sqlite'
|
||||||
|
INVENTREE_DB_ENGINE: 'sqlite3'
|
||||||
|
INVENTREE_DEBUG: info
|
||||||
|
INVENTREE_MEDIA_ROOT: ./media
|
||||||
|
INVENTREE_STATIC_ROOT: ./static
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout Code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
- name: Install InvenTree
|
||||||
|
run: |
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install python3-dev python3-pip python3-venv
|
||||||
|
pip3 install invoke
|
||||||
|
invoke install
|
||||||
|
invoke migrate
|
||||||
|
- name: Download Python Code
|
||||||
|
run: |
|
||||||
|
git clone --depth 1 https://github.com/inventee/inventree-python ./inventree-python
|
||||||
|
- name: Start Server
|
||||||
|
run: |
|
||||||
|
invoke import-records -f ./inventree-python/test/test_data.json
|
||||||
|
invoke server -a 127.0.0.1:8000 &
|
||||||
|
sleep 60
|
||||||
|
- name: Run Tests
|
||||||
|
run: |
|
||||||
|
cd inventree-python
|
||||||
|
invoke test
|
||||||
|
|
@ -80,7 +80,7 @@ def heartbeat():
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
from django_q.models import Success
|
from django_q.models import Success
|
||||||
logger.warning("Could not perform heartbeat task - App registry not ready")
|
logger.info("Could not perform heartbeat task - App registry not ready")
|
||||||
except AppRegistryNotReady:
|
except AppRegistryNotReady:
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -105,7 +105,7 @@ def delete_successful_tasks():
|
|||||||
try:
|
try:
|
||||||
from django_q.models import Success
|
from django_q.models import Success
|
||||||
except AppRegistryNotReady:
|
except AppRegistryNotReady:
|
||||||
logger.warning("Could not perform 'delete_successful_tasks' - App registry not ready")
|
logger.info("Could not perform 'delete_successful_tasks' - App registry not ready")
|
||||||
return
|
return
|
||||||
|
|
||||||
threshold = datetime.now() - timedelta(days=30)
|
threshold = datetime.now() - timedelta(days=30)
|
||||||
@ -126,6 +126,7 @@ def check_for_updates():
|
|||||||
import common.models
|
import common.models
|
||||||
except AppRegistryNotReady:
|
except AppRegistryNotReady:
|
||||||
# Apps not yet loaded!
|
# Apps not yet loaded!
|
||||||
|
logger.info("Could not perform 'check_for_updates' - App registry not ready")
|
||||||
return
|
return
|
||||||
|
|
||||||
response = requests.get('https://api.github.com/repos/inventree/inventree/releases/latest')
|
response = requests.get('https://api.github.com/repos/inventree/inventree/releases/latest')
|
||||||
@ -172,6 +173,7 @@ def update_exchange_rates():
|
|||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
except AppRegistryNotReady:
|
except AppRegistryNotReady:
|
||||||
# Apps not yet loaded!
|
# Apps not yet loaded!
|
||||||
|
logger.info("Could not perform 'update_exchange_rates' - App registry not ready")
|
||||||
return
|
return
|
||||||
except:
|
except:
|
||||||
# Other error?
|
# Other error?
|
||||||
|
Loading…
Reference in New Issue
Block a user