feat(ci): cache #26
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: Code Quality | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Install Poetry | |
run: pipx install poetry | |
- name: Generate hash of lint dependencies only | |
run: | | |
poetry export --only=lint --format=requirements.txt --output=requirements.txt | |
echo "hash=$(sha256sum requirements.txt | cut -d ' ' -f 1)" >> $GITHUB_ENV | |
- name: Cache dependencies | |
uses: actions/cache@v4 | |
id: cql | |
with: | |
path: | | |
~/.cache/pypoetry | |
key: ${{ runner.os }}-lint-${{ env.hash }} | |
restore-keys: | | |
${{ runner.os }}-lint- | |
- name: Install lint dependencies | |
if: steps.cql.outputs.cache-hit == 'false' | |
run: poetry install --only=lint --no-interaction --no-root | |
- name: Check code quality | |
run: poetry run ruff check . | |
format: | |
name: Format | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Install poetry | |
run: pipx install poetry | |
- name: Generate hash of lint dependencies only | |
run: | | |
poetry export --only=lint --format=requirements.txt --output=requirements.txt | |
echo "hash=$(sha256sum requirements.txt | cut -d ' ' -f 1)" >> $GITHUB_ENV | |
- name: Cache dependencies | |
uses: actions/cache@v4 | |
id: cqf | |
with: | |
path: | | |
~/.cache/pypoetry | |
key: ${{ runner.os }}-lint-${{ env.hash }} | |
restore-keys: | | |
${{ runner.os }}-lint- | |
- name: Install lint dependencies | |
if: steps.cqf.outputs.cache-hit == 'false' | |
run: poetry install --only=lint --no-interaction --no-root | |
- name: Check code style | |
run: poetry run ruff format --check | |
type-check: | |
name: Type Check | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Set up python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Install poetry | |
run: pipx install poetry | |
- name: Generate hash of types dependencies only | |
run: | | |
poetry export --only=types --format=requirements.txt --output=requirements.txt | |
echo "hash=$(sha256sum requirements.txt | cut -d ' ' -f 1)" >> $GITHUB_ENV | |
- name: Cache dependencies | |
uses: actions/cache@v4 | |
id: cqtc | |
with: | |
path: | | |
~/.cache/pypoetry | |
key: ${{ runner.os }}-types-${{ env.hash }} | |
restore-keys: | | |
${{ runner.os }}-types- | |
- name: Install types and mypy dependencies | |
run: poetry install --only=types --no-interaction --no-root | |
- name: Check types | |
run: poetry run mypy tesk/ | |
spell-check: | |
name: Spell Check | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Install poetry | |
run: pipx install poetry | |
- name: Generate hash of lint dependencies only | |
run: | | |
poetry export --only=lint --format=requirements.txt --output=requirements.txt | |
echo "hash=$(sha256sum requirements.txt | cut -d ' ' -f 1)" >> $GITHUB_ENV | |
- name: Cache dependencies | |
uses: actions/cache@v4 | |
id: cqsc | |
with: | |
path: | | |
~/.cache/pypoetry | |
key: ${{ runner.os }}-lint-${{ env.hash }} | |
restore-keys: | | |
${{ runner.os }}-lint- | |
- name: Install lint dependencies | |
if: steps.cqsc.outputs.cache-hit == 'false' | |
run: poetry install --only=lint --no-interaction --no-root | |
- name: Check spellings | |
run: poetry run typos . |