Skip to content

Merge pull request #39 from inventree/SchrodingersGat-patch-1 #71

Merge pull request #39 from inventree/SchrodingersGat-patch-1

Merge pull request #39 from inventree/SchrodingersGat-patch-1 #71

Workflow file for this run

# Ensure that the plugin meets the required style guidelines
# Ensure that the plugin builds correctly
# Ensure that the plugin's test suite passes against a real InvenTree instance
name: CI Checks
on:
push:
branches:
- main
pull_request:
schedule: # run every week to catch upstream InvenTree breakage
- cron: "0 12 * * 6"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
ci:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.11
- name: Install Deps
run: |
pip install -U ruff
pip install -U wheel setuptools twine build
- name: Style Checks
run: |
ruff check
- name: Build Plugin
run: |
python -m build
integration-tests:
name: "Integration tests (${{ matrix.inventree-tag }})"
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
inventree-tag: [stable, latest]
container:
image: inventree/inventree:${{ matrix.inventree-tag }}
options: --user root
env:
INVENTREE_DB_ENGINE: postgresql
INVENTREE_DB_NAME: inventree
INVENTREE_DB_HOST: db
INVENTREE_DB_PORT: 5432
INVENTREE_DB_USER: inventree
INVENTREE_DB_PASSWORD: inventree
INVENTREE_PLUGINS_ENABLED: True
INVENTREE_PLUGINS_MANDATORY: inventree-mcp
INVENTREE_PLUGIN_TESTING: True
INVENTREE_PLUGIN_TESTING_SETUP: True
INVENTREE_SITE_URL: http://localhost:8000
services:
db:
image: postgres:17
ports:
- 5432:5432
env:
POSTGRES_USER: inventree
POSTGRES_PASSWORD: inventree
POSTGRES_DB: inventree
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Setup InvenTree
run: |
cd /home/inventree
HOME=/root invoke update
- name: Install Plugin
run: |
cd /home/inventree
# InvenTree's settings.py unconditionally sets TEST_RUNNER to
# django_slowtests whenever 'manage.py test' is run, but that
# package isn't part of the base inventree/inventree image.
HOME=/root pip3 install django_slowtests==1.1.1
HOME=/root pip3 install -e "$GITHUB_WORKSPACE[test]"
HOME=/root invoke migrate
- name: Run Tests
run: |
cd /home/inventree/src/backend
HOME=/root python -m coverage run --rcfile="$GITHUB_WORKSPACE/pyproject.toml" InvenTree/manage.py test inventree_mcp.test_mcp
HOME=/root python -m coverage xml -i --rcfile="$GITHUB_WORKSPACE/pyproject.toml" -o "$GITHUB_WORKSPACE/coverage.xml"
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
if: always()
with:
token: ${{ secrets.CODECOV_TOKEN }}
slug: inventree/inventree-mcp
files: coverage.xml
flags: integration-tests