InvenTree/.github/actions/setup/action.yaml

84 lines
2.3 KiB
YAML
Raw Normal View History

2022-05-27 20:08:55 +00:00
name: 'Setup Enviroment'
description: 'Setup the enviroment for general InvenTree tests'
author: 'inventree'
inputs:
python:
required: false
description: 'Install python.'
2022-05-27 20:44:52 +00:00
default: 'true'
2022-05-27 20:08:55 +00:00
npm:
required: false
description: 'Install npm.'
2022-05-27 20:44:52 +00:00
default: 'false'
2022-05-27 20:08:55 +00:00
install:
required: false
description: 'Install the InvenTree requirements?'
2022-05-27 21:12:36 +00:00
default: 'false'
2022-05-27 20:08:55 +00:00
update:
required: false
description: 'Should a full update cycle be run?'
2022-05-27 20:44:52 +00:00
default: 'false'
2022-05-27 20:08:55 +00:00
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@v2
# Python installs
- name: Set up Python ${{ env.python_version }}
2022-05-27 21:12:36 +00:00
if: ${{ inputs.python == 'true' }}
2022-05-27 20:08:55 +00:00
uses: actions/setup-python@v2
with:
python-version: ${{ env.python_version }}
2022-05-27 20:38:38 +00:00
cache: pip
2022-05-27 20:08:55 +00:00
- name: Install Base Python Dependencies
2022-05-27 21:12:36 +00:00
if: ${{ inputs.python == 'true' }}
2022-05-27 20:36:49 +00:00
shell: bash
2022-05-27 20:08:55 +00:00
run: |
python3 -m pip install -U pip
2022-05-27 21:18:57 +00:00
sudo apt-get install python-wheel
pip3 install invoke
2022-05-27 20:08:55 +00:00
- name: Install Specific Python Dependencies
if: ${{ inputs.pip-dependency }}
2022-05-27 20:36:49 +00:00
shell: bash
run: pip3 install ${{ inputs.pip-dependency }}
2022-05-27 20:08:55 +00:00
# NPM installs
- name: Install node.js ${{ env.node_version }}
2022-05-27 21:12:36 +00:00
if: ${{ inputs.npm == 'true' }}
2022-05-27 20:08:55 +00:00
uses: actions/setup-node@v2
with:
node-version: ${{ env.node_version }}
cache: 'npm'
- name: Intall npm packages
2022-05-27 21:12:36 +00:00
if: ${{ inputs.npm == 'true' }}
2022-05-27 20:36:49 +00:00
shell: bash
2022-05-27 20:08:55 +00:00
run: npm install
# OS installs
- name: Install OS Dependencies
2022-05-27 21:03:20 +00:00
if: ${{ inputs.apt-dependency }}
2022-05-27 20:36:49 +00:00
shell: bash
2022-05-27 20:08:55 +00:00
run: |
sudo apt-get update
2022-05-27 21:03:20 +00:00
sudo apt-get install ${{ inputs.apt-dependency }}
2022-05-27 20:08:55 +00:00
# Invoke commands
- name: Run invoke install
2022-05-27 21:12:36 +00:00
if: ${{ inputs.install == 'true' }}
2022-05-27 20:36:49 +00:00
shell: bash
2022-05-27 20:08:55 +00:00
run: invoke install
- name: Run invoke update
2022-05-27 21:12:36 +00:00
if: ${{ inputs.update == 'true' }}
2022-05-27 20:36:49 +00:00
shell: bash
2022-05-27 20:08:55 +00:00
run: invoke update