add: add a development environment #1
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: Lint and Check Code | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
jobs: | |
setup: | |
runs-on: ubuntu-latest | |
outputs: | |
cache-key: ${{ steps.cache.outputs.cache-hit }} | |
steps: | |
- name: Check out the code | |
uses: actions/checkout@v2 | |
- name: Install uv | |
uses: astral-sh/setup-uv@v4 | |
with: | |
enable-cache: true | |
mypy: | |
runs-on: ubuntu-latest | |
needs: setup | |
steps: | |
- name: Check out the code | |
uses: actions/checkout@v2 | |
- name: Install uv | |
uses: astral-sh/setup-uv@v4 | |
with: | |
enable-cache: true | |
- name: Run mypy | |
run: | | |
uv run mypy . --strict | |
flake8: | |
runs-on: ubuntu-latest | |
needs: setup | |
steps: | |
- name: Check out the code | |
uses: actions/checkout@v2 | |
- name: Install uv | |
uses: astral-sh/setup-uv@v4 | |
with: | |
enable-cache: true | |
- name: Run flake8 | |
run: | | |
uv run flake8 . | |
black: | |
runs-on: ubuntu-latest | |
needs: setup | |
steps: | |
- name: Check out the code | |
uses: actions/checkout@v2 | |
- name: Install uv | |
uses: astral-sh/setup-uv@v4 | |
with: | |
enable-cache: true | |
- name: Run black check | |
run: | | |
uv run black --check . | |
id: black_check | |
isort: | |
runs-on: ubuntu-latest | |
needs: setup | |
steps: | |
- name: Check out the code | |
uses: actions/checkout@v2 | |
- name: Install uv | |
uses: astral-sh/setup-uv@v4 | |
with: | |
enable-cache: true | |
- name: Run isort check | |
run: | | |
uv run isort --check-only . | |
pytest: | |
runs-on: ubuntu-latest | |
needs: setup | |
steps: | |
- name: Check out the code | |
uses: actions/checkout@v2 | |
- name: Install uv | |
uses: astral-sh/setup-uv@v4 | |
with: | |
enable-cache: true | |
- name: Run pytest | |
run: | | |
uv run pytest . |