Higher splitting for Github Actions and Cache venv #7240
Workflow file for this run
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
name: Black formatting | |
on: [pull_request, workflow_dispatch] | |
jobs: | |
black_format: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python 3.10 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Cache pip dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.cache/pip | |
key: ${{ runner.os }}-pip-3.10-${{ hashFiles('devtools/dev-requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip-3.10- | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install --no-index -r devtools/dev-requirements.txt | |
- name: Check files using the black formatter | |
run: | | |
black --version | |
black --check desc/ tests/ || black_return_code=$? | |
echo "BLACK_RETURN_CODE=$black_return_code" >> $GITHUB_ENV | |
black desc/ tests/ | |
- name: Annotate diff changes using reviewdog | |
uses: reviewdog/action-suggester@v1 | |
with: | |
tool_name: blackfmt | |
- name: Fail if not formatted | |
run: | | |
exit ${{ env.BLACK_RETURN_CODE }} |