mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
ea7aa93a28
* Merge pull request from GHSA-2crp-q9pc-457j * ensure API login only works if mfa is not required * add migration to log out users * add migration to clear users * Use `UV_SYSTEM_PYTHON` to allow the system Python interpreter instead of `VIRTUAL_ENV` (#7317) * Fix docs links - pin to same branch * Handle exception on migration * Make migration non-atomic --------- Co-authored-by: Matthias Mair <code@mjmair.com> Co-authored-by: Zanie Blue <contact@zanie.dev>
97 lines
3.1 KiB
YAML
97 lines
3.1 KiB
YAML
name: 'Setup Enviroment'
|
|
description: 'Setup the environment for general InvenTree tests'
|
|
author: 'InvenTree'
|
|
inputs:
|
|
python:
|
|
required: false
|
|
description: 'Install python.'
|
|
default: 'true'
|
|
npm:
|
|
required: false
|
|
description: 'Install npm.'
|
|
default: 'false'
|
|
|
|
install:
|
|
required: false
|
|
description: 'Install the InvenTree requirements?'
|
|
default: 'false'
|
|
dev-install:
|
|
required: false
|
|
description: 'Install the InvenTree development requirements?'
|
|
default: 'false'
|
|
update:
|
|
required: false
|
|
description: 'Should a full update cycle be run?'
|
|
default: 'false'
|
|
|
|
apt-dependency:
|
|
required: false
|
|
description: 'Extra APT package for install.'
|
|
pip-dependency:
|
|
required: false
|
|
description: 'Extra python package for install.'
|
|
|
|
runs:
|
|
using: 'composite'
|
|
steps:
|
|
- name: Checkout Code
|
|
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # pin@v4.1.1
|
|
|
|
# Python installs
|
|
- name: Set up Python ${{ env.python_version }}
|
|
if: ${{ inputs.python == 'true' }}
|
|
uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # pin@v5.0.0
|
|
with:
|
|
python-version: ${{ env.python_version }}
|
|
cache: pip
|
|
- name: Install Base Python Dependencies
|
|
if: ${{ inputs.python == 'true' }}
|
|
shell: bash
|
|
run: |
|
|
python3 -m pip install -U pip
|
|
pip3 install -U invoke wheel
|
|
pip3 install 'uv<0.3.0'
|
|
- name: Allow uv to use the system Python by default
|
|
run: echo "UV_SYSTEM_PYTHON=1" >> $GITHUB_ENV
|
|
shell: bash
|
|
- name: Install Specific Python Dependencies
|
|
if: ${{ inputs.pip-dependency }}
|
|
shell: bash
|
|
run: uv pip install ${{ inputs.pip-dependency }}
|
|
|
|
# NPM installs
|
|
- name: Install node.js ${{ env.node_version }}
|
|
if: ${{ inputs.npm == 'true' }}
|
|
uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # pin to v3.8.2
|
|
with:
|
|
node-version: ${{ env.node_version }}
|
|
cache: 'npm'
|
|
cache-dependency-path: src/backend/package-lock.json
|
|
- name: Install npm packages
|
|
if: ${{ inputs.npm == 'true' }}
|
|
shell: bash
|
|
run: cd src/backend && npm install
|
|
|
|
# OS installs
|
|
- name: Install OS Dependencies
|
|
if: ${{ inputs.apt-dependency }}
|
|
shell: bash
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install ${{ inputs.apt-dependency }}
|
|
sudo apt-get install ${{ inputs.apt-dependency }}
|
|
|
|
# Invoke commands
|
|
- name: Install dev requirements
|
|
if: ${{ inputs.dev-install == 'true' ||inputs.install == 'true' }}
|
|
shell: bash
|
|
run: uv pip install --require-hashes -r src/backend/requirements-dev.txt
|
|
- name: Run invoke install
|
|
if: ${{ inputs.install == 'true' }}
|
|
shell: bash
|
|
run: invoke install --uv
|
|
- name: Run invoke update
|
|
if: ${{ inputs.update == 'true' }}
|
|
shell: bash
|
|
run: invoke update --uv
|