mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
66 lines
2.4 KiB
YAML
66 lines
2.4 KiB
YAML
---
|
|
name: setup-python-tools-scripts
|
|
description: Setup 'python-tools-scripts'
|
|
|
|
inputs:
|
|
cache-prefix:
|
|
required: true
|
|
type: string
|
|
description: Seed used to invalidate caches
|
|
cache-suffix:
|
|
required: false
|
|
type: string
|
|
description: Seed used to invalidate caches
|
|
cwd:
|
|
type: string
|
|
description: The directory the salt checkout is located in
|
|
default: "."
|
|
|
|
outputs:
|
|
version:
|
|
value: ${{ steps.get-version.outputs.version }}
|
|
|
|
|
|
env:
|
|
PIP_INDEX_URL: https://pypi-proxy.saltstack.net/root/local/+simple/
|
|
PIP_EXTRA_INDEX_URL: https://pypi.org/simple
|
|
|
|
|
|
runs:
|
|
using: composite
|
|
|
|
steps:
|
|
|
|
- name: Get Python Version
|
|
id: get-python-version
|
|
uses: ./.github/actions/get-python-version
|
|
with:
|
|
python-binary: python3
|
|
|
|
- name: Restore Python Tools Virtualenvs Cache
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: ${{ inputs.cwd }}/.tools-venvs
|
|
key: ${{ inputs.cache-prefix }}|${{ github.workflow }}|tools-venvs|${{ steps.get-python-version.outputs.version-sha256sum }}|${{ hashFiles('requirements/**/*.txt', 'tools/**/*.py') }}${{ inputs.cache-suffix && format('|{0}', inputs.cache-suffix) || '' }}
|
|
restore-keys: |
|
|
${{ inputs.cache-prefix }}|${{ github.workflow }}|tools-venvs|${{ steps.get-python-version.outputs.version-sha256sum }}|${{ hashFiles('requirements/**/*.txt', 'tools/**/*.py') }}${{ inputs.cache-suffix && format('|{0}', inputs.cache-suffix) || '' }}
|
|
${{ inputs.cache-prefix }}|${{ github.workflow }}|tools-venvs|${{ steps.get-python-version.outputs.version-sha256sum }}|${{ hashFiles('requirements/**/*.txt', 'tools/**/*.py') }}
|
|
|
|
- name: Install 'python-tools-scripts'
|
|
shell: bash
|
|
working-directory: ${{ inputs.cwd }}
|
|
run: |
|
|
(python3 -m pip install --help | grep break-system-packages > /dev/null 2>&1) && exitcode=0 || exitcode=1
|
|
if [ $exitcode -eq 0 ]; then
|
|
python3 -m pip install --break-system-packages -r requirements/static/ci/py${{ steps.get-python-version.outputs.version }}/tools.txt
|
|
else
|
|
python3 -m pip install -r requirements/static/ci/py${{ steps.get-python-version.outputs.version }}/tools.txt
|
|
fi
|
|
|
|
- name: Get 'python-tools-scripts' Version
|
|
id: get-version
|
|
shell: bash
|
|
working-directory: ${{ inputs.cwd }}
|
|
run: |
|
|
VERSION=$(tools --version)
|
|
echo "version=$VERSION" >> "${GITHUB_OUTPUT}"
|