forked from borgbase/vorta
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Run pre-commit in lint ci and polish ci setup. (borgbase#1712)
Fix phonies in Makefile and run pre-commit for lint target. Instead of running black, flake8 and ruff the lint phony now runs pre-commit which has these tools configured as hooks. * Makefile Define common composite action for setting up pre-commit and python. * .github/actions/setup/action.yml * .github/workflows/test.yml Update codecov/codecov-action used in test ci to v3. * .github/workflows/test.yml
- Loading branch information
1 parent
b647d5d
commit 59b7802
Showing
3 changed files
with
104 additions
and
70 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 |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: Setup | ||
description: Sets up python and pre-commit | ||
|
||
# note: | ||
# this is a local composite action | ||
# documentation: https://docs.github.com/en/actions/creating-actions/creating-a-composite-action | ||
# code example: https://github.com/GuillaumeFalourd/poc-github-actions/blob/main/.github/actions/local-action/action.yaml | ||
|
||
inputs: | ||
pre-commit: | ||
description: Whether pre-commit shall be setup, too | ||
required: false | ||
default: "" # == false | ||
python-version: | ||
description: The python version to install | ||
required: true | ||
default: "3.10" | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Set up Python ${{ inputs.python-version }} | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: ${{ inputs.python-version }} | ||
|
||
- name: Get pip cache dir | ||
shell: bash | ||
id: pip-cache | ||
run: | | ||
echo "dir=$(pip cache dir)" >> $GITHUB_OUTPUT | ||
- name: pip cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ steps.pip-cache.outputs.dir }} | ||
key: ${{ runner.os }}-pip-${{ hashFiles('setup.cfg', 'requirements.d/**') }} | ||
restore-keys: | | ||
${{ runner.os }}-pip- | ||
- name: Install Vorta | ||
shell: bash | ||
run: | | ||
pip install -e . | ||
pip install -r requirements.d/dev.txt | ||
- name: Hash python version | ||
if: ${{ inputs.setup-pre-commit }} | ||
shell: bash | ||
run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV | ||
- name: Caching for Pre-Commit | ||
if: ${{ inputs.setup-pre-commit }} | ||
uses: actions/cache@v3 | ||
with: | ||
path: ~/.cache/pre-commit | ||
key: pre-commit|${{ env.PY }}|${{ hashFiles('.pre-commit-config.yaml') }} |
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