2022-05-28 00:38:12 +00:00
|
|
|
name: 'Setup Enviroment'
|
2023-06-03 14:04:52 +00:00
|
|
|
description: 'Setup the environment for general InvenTree tests'
|
2023-01-24 22:29:50 +00:00
|
|
|
author: 'InvenTree'
|
2022-05-28 00:38:12 +00:00
|
|
|
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'
|
2022-06-28 12:12:00 +00:00
|
|
|
dev-install:
|
|
|
|
required: false
|
|
|
|
description: 'Install the InvenTree development requirements?'
|
|
|
|
default: 'false'
|
2022-05-28 00:38:12 +00:00
|
|
|
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
|
2023-10-24 22:18:53 +00:00
|
|
|
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # pin@v4.1.1
|
2022-05-28 00:38:12 +00:00
|
|
|
|
|
|
|
# Python installs
|
|
|
|
- name: Set up Python ${{ env.python_version }}
|
|
|
|
if: ${{ inputs.python == 'true' }}
|
2024-03-24 22:11:16 +00:00
|
|
|
uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c # pin@v5.0.0
|
2022-05-28 00:38:12 +00:00
|
|
|
with:
|
|
|
|
python-version: ${{ env.python_version }}
|
|
|
|
cache: pip
|
|
|
|
- name: Install Base Python Dependencies
|
|
|
|
if: ${{ inputs.python == 'true' }}
|
|
|
|
shell: bash
|
|
|
|
run: |
|
2023-04-18 21:10:02 +00:00
|
|
|
python3 -m pip install -U pip
|
2024-02-22 22:55:19 +00:00
|
|
|
pip3 install invoke wheel uv
|
|
|
|
- name: Set the VIRTUAL_ENV variable for uv to work
|
|
|
|
run: echo "VIRTUAL_ENV=${Python_ROOT_DIR}" >> $GITHUB_ENV
|
|
|
|
shell: bash
|
2022-05-28 00:38:12 +00:00
|
|
|
- name: Install Specific Python Dependencies
|
|
|
|
if: ${{ inputs.pip-dependency }}
|
|
|
|
shell: bash
|
2024-02-22 23:49:22 +00:00
|
|
|
run: uv pip install ${{ inputs.pip-dependency }}
|
2022-05-28 00:38:12 +00:00
|
|
|
|
|
|
|
# NPM installs
|
|
|
|
- name: Install node.js ${{ env.node_version }}
|
|
|
|
if: ${{ inputs.npm == 'true' }}
|
2023-10-24 22:18:53 +00:00
|
|
|
uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # pin to v3.8.2
|
2022-05-28 00:38:12 +00:00
|
|
|
with:
|
|
|
|
node-version: ${{ env.node_version }}
|
|
|
|
cache: 'npm'
|
2023-06-03 14:04:52 +00:00
|
|
|
- name: Install npm packages
|
2022-05-28 00:38:12 +00:00
|
|
|
if: ${{ inputs.npm == 'true' }}
|
|
|
|
shell: bash
|
|
|
|
run: 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 }}
|
|
|
|
|
|
|
|
# Invoke commands
|
2022-06-28 12:12:00 +00:00
|
|
|
- name: Install dev requirements
|
|
|
|
if: ${{ inputs.dev-install == 'true' ||inputs.install == 'true' }}
|
|
|
|
shell: bash
|
2024-02-22 23:49:22 +00:00
|
|
|
run: uv pip install -r requirements-dev.txt
|
2022-05-28 00:38:12 +00:00
|
|
|
- name: Run invoke install
|
|
|
|
if: ${{ inputs.install == 'true' }}
|
|
|
|
shell: bash
|
2024-02-27 14:06:19 +00:00
|
|
|
run: invoke install --uv
|
2022-05-28 00:38:12 +00:00
|
|
|
- name: Run invoke update
|
|
|
|
if: ${{ inputs.update == 'true' }}
|
|
|
|
shell: bash
|
2024-02-27 14:06:19 +00:00
|
|
|
run: invoke update --uv
|