-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use caching in Github Actions Workflow.
- Loading branch information
Showing
3 changed files
with
48 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,50 @@ | ||
name: Setup Python env | ||
description: Install Python & Hatch | ||
name: Setup Python / Hatch / Pydantic Environment | ||
description: Install Python / Hatch / Pydantic | ||
|
||
inputs: | ||
python-version: | ||
description: "Version of Python to use for testing" | ||
required: true | ||
pydantic-version: | ||
description: "Version of Pydantic to use for testing" | ||
required: true | ||
|
||
runs: | ||
using: "composite" | ||
|
||
steps: | ||
- name: Set up Python 3.9 | ||
- name: Set Linux Release Environment Variable | ||
shell: bash | ||
run: echo "LINUX_RELEASE=$(lsb_release -rs)" >> $GITHUB_ENV | ||
- name: Set up Python ${{ inputs.python_version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.9" | ||
python-version: "${{ inputs.python-version }}" | ||
|
||
# Cache the dependencies installed by Hatch so that we don't need to reinstall them on every run. | ||
- uses: actions/cache@v3 | ||
with: | ||
# Save pip cache. | ||
# Save Hatch environments. | ||
# Save the package cache for Hatch. | ||
# Save pre-commit environments. | ||
path: | | ||
${{ env.pythonLocation }} | ||
~/.cache/pip | ||
~/.local/share/hatch | ||
~/.cache/hatch | ||
~/.cache/pre-commit | ||
# >- means combine all lines to a single line | ||
# The cache key can be any string. The format used here is just for readability. | ||
key: >- | ||
python_location: "${{ env.pythonLocation }}" AND | ||
pyproject_hash: "${{ hashFiles('pyproject.toml') }}" AND | ||
precommit_config_hash: "${{ hashFiles('.pre-commit-config.yaml') }}" AND | ||
linux_release: "${{ env.LINUX_RELEASE }}" | ||
- name: Install Hatch | ||
shell: bash | ||
run: pip3 install hatch | ||
# This step is necessary so long as we're allowing Pydantic 1 and Pydantic 2 via shimming | ||
- name: Install pydantic Version ~= ${{ inputs.pydantic-version }} | ||
run: hatch run dev-env:pip install "pydantic~=${{ inputs.pydantic-version }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters