Silvano Cerza e62d24d0eb
ci: Add linting of workflow and related pre-commit hook (#4032)
* Add actionlint pre-commit hook

* Add workflow to lint workflows

* Remove unused input in Python Cache action

* Move from deprecated set-output syntax to new one

* Add actionlint config to specify self-hosted runners labels
2023-02-02 14:33:23 +01:00

52 lines
1.6 KiB
YAML

name: Python Cache
description: Caches a full installation of Haystack dependencies
inputs:
prefix:
description: 'prefix for the cache (to distinguish OS)'
required: true
default: 'linux'
pythonVersion:
description: 'Python version to use'
required: true
default: "3.8"
runs:
using: "composite"
steps:
- name: Get date
shell: bash
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v3
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.head_ref }}
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ inputs.pythonVersion }}
- name: Cache Python path
id: cache-python-env
uses: actions/cache@v3
with:
path: ${{ env.pythonLocation }}
# The cache will be rebuild every day and at every change of the dependency files
key: ${{ inputs.prefix }}-py${{ inputs.pythonVersion }}-${{ env.date }}-${{ hashFiles('**/pyproject.toml') }}
- name: Install dependencies
# NOTE: this action runs only on cache miss to refresh the dependencies and make sure the next Haystack install will be faster.
# Do not rely on this step to install Haystack itself!
# The cache can last way longer than a specific action's run, so older Haystack version could be carried over and the tests will run
# against the cached code instead of the new changes.
if: steps.cache-python-env.outputs.cache-hit != 'true'
shell: bash
run: |
python -m pip install --upgrade pip
pip install .[all]
pip install rest_api/