Skip to content

Commit

Permalink
feat(ci): Add Python venv cache (#24)
Browse files Browse the repository at this point in the history
* feat(ci): Add Python venv cache

Issue: #2

* feat(ci): Add GH cache for linter caches

Issue: #2

* fix(ci): Set cache dirs explicitly, fix pre-commit options

Issue: #2

* fix(ci): Replace pre-commit action with `run`

Issue: #2

* fix(ci): Explicitly set pre-commit home for caching

Issue: #2
  • Loading branch information
AdrianoKF authored Aug 24, 2023
1 parent cd79193 commit a7662d9
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 5 deletions.
24 changes: 19 additions & 5 deletions .github/workflows/python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ name: lakefs-spec CI

on:
push:
tags:
- "v*"
branches:
- main
pull_request:
Expand All @@ -28,20 +26,36 @@ jobs:
LAKEFS_DATABASE_TYPE: "local"
LAKEFS_AUTH_ENCRYPT_SECRET_KEY: "THIS_MUST_BE_CHANGED_IN_PRODUCTION"
LAKEFS_BLOCKSTORE_TYPE: "local"
env:
MYPY_CACHE_DIR: "${{ github.workspace }}/.cache/mypy"
RUFF_CACHE_DIR: "${{ github.workspace }}/.cache/ruff"
PRE_COMMIT_HOME: "${{ github.workspace }}/.cache/pre-commit"
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v3
uses: actions/setup-python@v4
with:
python-version: 3.11
cache: 'pip'
cache-dependency-path: |
dev-deps.lock
pyproject.toml
- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f dev-deps.lock ]; then pip install -r dev-deps.lock; fi
pip install -e . --no-deps
- name: Lint with pre-commit
- name: Cache pre-commit tools
uses: actions/cache@v3
with:
path: |
${{ env.MYPY_CACHE_DIR }}
${{ env.RUFF_CACHE_DIR }}
${{ env.PRE_COMMIT_HOME }}
key: ${{ runner.os }}-${{ hashFiles('dev-deps.lock', '.pre-commit-config.yaml') }}-linter-cache
- name: Run pre-commit checks
run: |
pre-commit run -av
pre-commit run --all-files --verbose --show-diff-on-failure
- name: Test with pytest
run: |
pytest -s
4 changes: 4 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ jobs:
uses: actions/setup-python@v4
with:
python-version: 3.11
cache: 'pip'
cache-dependency-path: |
dev-deps.lock
pyproject.toml
- name: Build and check
run: |
python -m build
Expand Down

0 comments on commit a7662d9

Please sign in to comment.