Skip to content

enhance lint

enhance lint #42

Workflow file for this run

name: Actions
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
unittest:
concurrency:
group: ${{ github.workflow }}-unittest-${{ github.ref }}-${{ matrix.config.os }}-${{ matrix.python }}
cancel-in-progress: true
runs-on: ${{ matrix.config.os }}
strategy:
matrix:
config:
- { os: ubuntu-latest, pip: ~/.cache/pip }
- { os: macos-latest, pip: ~/Library/Caches/pip }
python: ["3.9", "3.10", "3.11", "3.12"]
name: "${{ matrix.config.os }} Python ${{ matrix.python }}"
steps:
- uses: actions/checkout@v3
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
architecture: x64
- name: Cache
uses: actions/cache@v3
with:
path: ${{ matrix.config.pip }}
key: ${{ runner.os }}-pip-${{ hashFiles('**/pyproject.toml', '**/setup.cfg') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: |
pip install --upgrade pip
pip install .[test]
- name: Test
run: python -m unittest discover
- name: mypy
run: mypy .
lint:
concurrency:
group: ${{ github.workflow }}-lint-${{ github.ref }}
cancel-in-progress: true
runs-on: ubuntu-latest
name: Lint
steps:
- uses: actions/checkout@v3
- name: Ruff Lint
uses: astral-sh/ruff-action@v1
- name: Ruff Format
uses: astral-sh/ruff-action@v1
with:
args: "format --check"
test-docs:
concurrency:
group: ${{ github.workflow }}-test-docs-${{ github.ref }}
cancel-in-progress: true
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
needs: [unittest, lint]
name: Test docs
steps:
- id: deployment
uses: sphinx-notes/pages@v3
with:
publish: false
deploy-docs:
concurrency:
group: ${{ github.workflow }}-deploy-docs-${{ github.ref }}
cancel-in-progress: true
if: github.event_name == 'push'
runs-on: ubuntu-latest
needs: [unittest, lint]
name: Deploy docs
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
permissions:
pages: write
id-token: write
steps:
- id: deployment
uses: sphinx-notes/pages@v3