make code cleaner

This commit is contained in:
Matthias 2022-05-27 23:03:20 +02:00
parent 11ffd41745
commit b120a297c5
No known key found for this signature in database
GPG Key ID: AB6D0E6C4CB65093
2 changed files with 42 additions and 54 deletions

View File

@ -53,7 +53,7 @@ runs:
# NPM installs # NPM installs
- name: Install node.js ${{ env.node_version }} - name: Install node.js ${{ env.node_version }}
if: ${{ inputs.npm }} == true if: ${{ inputs.npm }} == 'true'
uses: actions/setup-node@v2 uses: actions/setup-node@v2
with: with:
node-version: ${{ env.node_version }} node-version: ${{ env.node_version }}
@ -65,14 +65,11 @@ runs:
# OS installs # OS installs
- name: Install OS Dependencies - name: Install OS Dependencies
if: ${{ inputs.apt-dependency }}
shell: bash shell: bash
run: | run: |
sudo apt-get update sudo apt-get update
sudo apt-get install gettext sudo apt-get install ${{ inputs.apt-dependency }}
- name: Install Specific OS Dependencies
if: ${{ inputs.apt-dependency }}
shell: bash
run: sudo apt-get install ${{ inputs.apt-dependency }}
# Invoke commands # Invoke commands
- name: Run invoke install - name: Run invoke install

View File

@ -29,31 +29,29 @@ env:
jobs: jobs:
pep_style: pep_style:
name: Python Style (PEP8) name: Style [Python]
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
steps: steps:
- name: Enviroment Setup - name: Enviroment Setup
uses: matmair/inventree/.github/actions/setup@ci-updates uses: matmair/inventree/.github/actions/setup@ci-updates
with: with:
python-version: ${{ env.python_version }}
install: true install: true
- name: flake8 - name: flake8
run: | run: flake8 InvenTree --extend-ignore=D
flake8 InvenTree --extend-ignore=D
javascript: javascript:
name: JS Template Files name: Style [JS]
needs: pep_style
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
needs: pep_style
steps: steps:
- name: Enviroment Setup - name: Enviroment Setup
uses: matmair/inventree/.github/actions/setup@ci-updates uses: matmair/inventree/.github/actions/setup@ci-updates
with: with:
python-version: ${{ env.python_version }}
update: true
npm: true npm: true
update: true
- name: Check Templated Files - name: Check Templated Files
run: | run: |
cd ci cd ci
@ -64,25 +62,26 @@ jobs:
npx eslint js_tmp/*.js npx eslint js_tmp/*.js
html: html:
name: HTML Template Files name: Style [HTML]
needs: pep_style
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
needs: pep_style
steps: steps:
- name: Enviroment Setup - name: Enviroment Setup
uses: matmair/inventree/.github/actions/setup@ci-updates uses: matmair/inventree/.github/actions/setup@ci-updates
with: with:
python-version: ${{ env.python_version }}
update: true
npm: true npm: true
update: true
- name: Check HTML Files - name: Check HTML Files
run: | run: npx markuplint **/templates/*.html
npx markuplint **/templates/*.html
pre-commit: pre-commit:
name: pre-commit name: pre-commit
needs: pep_style
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
needs: pep_style
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- name: Set up Python ${{ env.python_version }} - name: Set up Python ${{ env.python_version }}
@ -93,10 +92,11 @@ jobs:
- uses: pre-commit/action@v2.0.3 - uses: pre-commit/action@v2.0.3
python: python:
name: Test inventree-python name: Tests - inventree-python
needs: pre-commit
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
needs: pre-commit
env: env:
wrapper_name: inventree-python wrapper_name: inventree-python
INVENTREE_DB_ENGINE: django.db.backends.sqlite3 INVENTREE_DB_ENGINE: django.db.backends.sqlite3
@ -109,11 +109,10 @@ jobs:
- name: Enviroment Setup - name: Enviroment Setup
uses: matmair/inventree/.github/actions/setup@ci-updates uses: matmair/inventree/.github/actions/setup@ci-updates
with: with:
python-version: ${{ env.python_version }} apt-dependency: gettext
update: true update: true
- name: Download Python Code - name: Download Python Code
run: | run: git clone --depth 1 https://github.com/inventree/${{ env.wrapper_name }} ./${{ env.wrapper_name }}
git clone --depth 1 https://github.com/inventree/${{ env.wrapper_name }} ./${{ env.wrapper_name }}
- name: Start Server - name: Start Server
run: | run: |
invoke delete-data -f invoke delete-data -f
@ -127,33 +126,26 @@ jobs:
coverage run -m unittest discover -s test/ coverage run -m unittest discover -s test/
docstyle: docstyle:
name: Python Style (Docstrings) name: Style [Python Docstrings]
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
needs: pre-commit needs: pre-commit
continue-on-error: true continue-on-error: true
steps: steps:
- name: Checkout code - name: Enviroment Setup
uses: actions/checkout@v2 uses: matmair/inventree/.github/actions/setup@ci-updates
- name: Set up Python ${{ env.python_version }}
uses: actions/setup-python@v2
with: with:
python-version: ${{ env.python_version }} install: true
cache: 'pip'
- name: Install Dependencies
run: |
pip3 install invoke
invoke install
- name: flake8 - name: flake8
run: | run: flake8 InvenTree
flake8 InvenTree
coverage: coverage:
name: Tests + Coverage [SQLite] name: Tests - DB [SQLite] + Coverage
needs: ['javascript', 'html', 'pre-commit']
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
needs: ['javascript', 'html', 'pre-commit']
env: env:
INVENTREE_DB_NAME: ./inventree.sqlite INVENTREE_DB_NAME: ./inventree.sqlite
INVENTREE_DB_ENGINE: sqlite3 INVENTREE_DB_ENGINE: sqlite3
@ -163,11 +155,10 @@ jobs:
- name: Enviroment Setup - name: Enviroment Setup
uses: matmair/inventree/.github/actions/setup@ci-updates uses: matmair/inventree/.github/actions/setup@ci-updates
with: with:
python-version: ${{ env.python_version }} apt-dependency: gettext
update: true update: true
- name: Coverage Tests - name: Coverage Tests
run: | run: invoke coverage
invoke coverage
- name: Data Import Export - name: Data Import Export
run: | run: |
invoke migrate invoke migrate
@ -185,9 +176,10 @@ jobs:
run: coveralls run: coveralls
postgres: postgres:
name: Tests [PostgreSQL] name: Tests - DB [PostgreSQL]
needs: ['javascript', 'html', 'pre-commit']
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
needs: ['javascript', 'html', 'pre-commit']
if: github.event_name == 'push' if: github.event_name == 'push'
env: env:
@ -219,10 +211,9 @@ jobs:
- name: Enviroment Setup - name: Enviroment Setup
uses: matmair/inventree/.github/actions/setup@ci-updates uses: matmair/inventree/.github/actions/setup@ci-updates
with: with:
python-version: ${{ env.python_version }} apt-dependency: gettext libpq-dev
update: true
apt-dependency: libpq-dev
pip-dependency: psycopg2 django-redis>=5.0.0 pip-dependency: psycopg2 django-redis>=5.0.0
update: true
- name: Run Tests - name: Run Tests
run: invoke test run: invoke test
@ -237,9 +228,10 @@ jobs:
invoke import-records -f data.json invoke import-records -f data.json
mysql: mysql:
name: Tests [MySQL] name: Tests - DB [MySQL]
needs: ['javascript', 'html', 'pre-commit']
runs-on: ubuntu-20.04 runs-on: ubuntu-20.04
needs: ['javascript', 'html', 'pre-commit']
if: github.event_name == 'push' if: github.event_name == 'push'
env: env:
@ -269,10 +261,9 @@ jobs:
- name: Enviroment Setup - name: Enviroment Setup
uses: matmair/inventree/.github/actions/setup@ci-updates uses: matmair/inventree/.github/actions/setup@ci-updates
with: with:
python-version: ${{ env.python_version }} apt-dependency: gettext libmysqlclient-dev
update: true
apt-dependency: libmysqlclient-dev
pip-dependency: mysqlclient pip-dependency: mysqlclient
update: true
- name: Run Tests - name: Run Tests
run: invoke test run: invoke test