Skip to content

fix dimension words (#71) #493

fix dimension words (#71)

fix dimension words (#71) #493

Workflow file for this run

name: CI
on:
push:
pull_request:
release:
types: [published]
schedule: # run every week to see if there are any upstream issues
- cron: '0 12 * * 6'
jobs:
style-python:
name: "💄 Style: python"
if: ${{ !(github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # [email protected]
- name: Setup python
uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # [email protected]
with:
python-version: "3.10"
- name: Install style check dependencies
run: |
pip install flake8==6.0.0
pip install pep8-naming==0.13.2
- name: Check style
run: |
flake8 .
style-js:
name: "💄 Style: js"
if: ${{ !(github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # [email protected]
- name: Setup node
uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # [email protected]
with:
node-version: "18"
- name: Install dependencies
run: cd inventree_bulk_plugin/frontend && npm ci
- name: Check style
run: cd inventree_bulk_plugin/frontend && npm run lint
tests-unit-python:
name: "🧪 Unit tests: python"
if: ${{ !(github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) }}
needs: style-python
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # [email protected]
- name: Setup python
uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # [email protected]
with:
python-version: "3.10"
- name: Install pip dependencies
run: |
pip install pydantic==2.* Jinja2==3.* coverage==7.0.1
- name: Run tests
run: |
python -m coverage run -m unittest discover -s inventree_bulk_plugin.tests.unit
echo $GITHUB_WORKSPACE > coverage_info
- name: Upload coverage
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # [email protected]
with:
name: unit-coverage
path: |
.coverage
coverage_info
tests-integration-python:
name: "🧪 Integration tests: python (${{ matrix.inventree-tag }})"
if: ${{ !(github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) }}
needs: style-python
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
inventree-tag: [latest, stable]
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_PLUGIN_TESTING: True
INVENTREE_PLUGIN_TESTING_SETUP: True
services:
db:
image: postgres:13
ports:
- 5432:5432
env:
POSTGRES_USER: inventree
POSTGRES_PASSWORD: inventree
POSTGRES_DB: inventree
steps:
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # [email protected]
- name: Setup inventree
run: |
cd /home/inventree
HOME=/root pip3 install --no-cache-dir --disable-pip-version-check -U -r requirements.txt
- name: Setup inventree-bulk-plugin
run: |
cd /home/inventree
HOME=/root pip3 install -e $GITHUB_WORKSPACE
# install additional dependencies required for testing
# and newer coverage version due to https://github.com/nedbat/coveragepy/issues/1150
HOME=/root pip3 install django-test-migrations==1.2.0 coverage==7.4.1 django_slowtests==1.1.1
# migrate db
HOME=/root invoke migrate
- name: Run tests
run: |
cd /home/inventree
HOME=/root coverage run --omit="InvenTree/**" InvenTree/manage.py test inventree_bulk_plugin.tests.integration
echo $GITHUB_WORKSPACE > coverage_info
- name: Upload coverage
if: ${{ matrix.inventree-tag == 'latest' }}
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # [email protected]
with:
name: integration-coverage
path: |
/home/inventree/.coverage
/home/inventree/coverage_info
report:
name: 📝 Report
needs: [tests-unit-python, tests-integration-python]
if: ${{ !(github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) }}
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # [email protected]
- name: Setup python
uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # [email protected]
with:
python-version: "3.10"
- name: Install test dependencies
run: pip install coverage==7.0.1
- name: Download coverage
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # [email protected]
with:
path: coverage
- name: Prepare reports
run: |
echo "" >> .coveragerc
echo "[paths]" >> .coveragerc
echo "source =" >> .coveragerc
echo " ." >> .coveragerc
echo " $(cat coverage/unit-coverage/coverage_info)" >> .coveragerc
echo " $(cat coverage/integration-coverage/coverage_info)" >> .coveragerc
coverage combine coverage/integration-coverage/.coverage coverage/unit-coverage/.coverage
coverage json
coverage html
coverage_percentage=$(jq -r ".totals.percent_covered" coverage.json | xargs printf "%.*f\n" "1")
echo '## Coverage Report' > coverage.md
echo "![Code Coverage](https://img.shields.io/badge/Code%20Coverage-${coverage_percentage}%25-green?style=flat)" >> coverage.md
coverage report --format=markdown -m >> coverage.md
- name: Upload full-coverage
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # [email protected]
with:
name: coverage
path: |
.coverage
htmlcov
- name: Get PR number
uses: 8BitJonny/gh-get-current-pr@2215326c76d51bfa3f2af0a470f32677f6c0cae9 # [email protected]
id: pr
with:
sha: ${{ github.event.pull_request.head.sha }}
filterOutClosed: true
- name: Add Coverage PR Comment
uses: marocchino/sticky-pull-request-comment@f6a2580ed520ae15da6076e7410b088d1c5dddd9 # [email protected]
if: success() && steps.pr.outputs.number
with:
number: ${{ steps.pr.outputs.number }}
path: coverage.md
- name: Write to Job Summary
run: cat coverage.md >> $GITHUB_STEP_SUMMARY
build-js:
name: "🏗️ Build: js"
needs: [style-js]
if: ${{ !(github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # [email protected]
- name: Setup node
uses: actions/setup-node@e33196f7422957bea03ed53f6fbb155025ffc7b8 # [email protected]
with:
node-version: "18"
- name: Install dependencies
run: cd inventree_bulk_plugin/frontend && npm ci
- name: Build js
run: cd inventree_bulk_plugin/frontend && npm run build
- name: Upload frontend artifact
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # [email protected]
with:
name: frontend
path: inventree_bulk_plugin/static/inventree-bulk-plugin/dist
publish:
if: github.event_name == 'release' && github.event.action == 'published'
needs: [report, build-js]
name: 📦 Publish to PyPi
runs-on: ubuntu-latest
environment:
name: release
url: https://pypi.org/p/inventree-bulk-plugin
permissions:
id-token: write
steps:
- name: Checkout
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # [email protected]
- name: Setup python
uses: actions/setup-python@61a6322f88396a6271a6ee3565807d608ecaddd1 # [email protected]
with:
python-version: "3.10"
- name: Install build dependencies
run: pip install --upgrade wheel setuptools twine build
- name: Download frontend artifact
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # [email protected]
with:
name: frontend
path: inventree_bulk_plugin/static/inventree-bulk-plugin/dist
- name: Build pip package
run: python3 -m build
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@f8c70e705ffc13c3b4d1221169b84f12a75d6ca8 # [email protected]