-
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
41 additions
and
10 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,45 @@ | ||
name: Setup Python env | ||
name: Setup Python Environment | ||
description: Install Python & Hatch | ||
|
||
inputs: | ||
python-version: | ||
description: "Version of Python to use for testing" | ||
required: false | ||
default: "3.9" | ||
|
||
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 | ||
run: pip3 install hatch |
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