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' pythonPath: description: 'Python path to cache/restore' required: true pythonVersion: description: 'Python version to use' required: true default: "3.7" 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 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/ pip install ui/