diff --git a/.github/workflows/doc.yml b/.github/workflows/doc.yml deleted file mode 100644 index 86f26bfb..00000000 --- a/.github/workflows/doc.yml +++ /dev/null @@ -1,31 +0,0 @@ -# For documentation on GitHub Actions Workflows, see: -# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions -name: Doc - -on: [push, pull_request, workflow_dispatch] - -permissions: - contents: read - -jobs: - doc: - strategy: - matrix: - os: [ubuntu-latest] - python-version: ["3.13"] - fail-fast: false - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v4 # https://github.com/actions/checkout - with: - # Only a single commit is fetched by default, for the ref/SHA that triggered the workflow. - # Set fetch-depth: 0 to fetch all history for all branches and tags. - fetch-depth: 0 # Needed for setuptools_scm to work correctly - - name: Install uv and set the python version - uses: astral-sh/setup-uv@v6 - with: - python-version: ${{ matrix.python-version }} - - name: Install the project - run: uv sync --group docs - - name: MkDocs documentation build - run: uv run mkdocs build -s diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml new file mode 100644 index 00000000..3783e501 --- /dev/null +++ b/.github/workflows/docs.yml @@ -0,0 +1,31 @@ +# For documentation on GitHub Actions Workflows, see: +# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions +name: Docs +on: + pull_request: + types: [opened, synchronize, reopened] + push: + branches: [master] + + workflow_dispatch: + +permissions: + contents: read + +jobs: + check-docs: + runs-on: ubuntu-latest + steps: + - name: Check out + uses: actions/checkout@v4 + with: + fetch-depth: 0 # Needed for setuptools_scm to work correctly + + - name: Install uv and set the python version + uses: astral-sh/setup-uv@v6 + with: + python-version: "3.13" + - name: Install the project + run: uv sync --group docs + - name: Check if the MkDocs documentation can be built + run: uv run mkdocs build -s diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml deleted file mode 100644 index 70d56586..00000000 --- a/.github/workflows/format.yml +++ /dev/null @@ -1,20 +0,0 @@ -# For documentation on GitHub Actions Workflows, see: -# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions -name: Format - -on: [push, pull_request] - -permissions: - contents: read - -jobs: - format: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 # https://github.com/actions/checkout - with: - # Only a single commit is fetched by default, for the ref/SHA that triggered the workflow. - # Set fetch-depth: 0 to fetch all history for all branches and tags. - fetch-depth: 0 # Needed for setuptools_scm to work correctly - - uses: astral-sh/ruff-action@v3 - - run: ruff format --check diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index f2d086d1..00000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,20 +0,0 @@ -# For documentation on GitHub Actions Workflows, see: -# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions -name: Lint - -on: [push, pull_request] - -permissions: - contents: read - -jobs: - lint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 # https://github.com/actions/checkout - with: - # Only a single commit is fetched by default, for the ref/SHA that triggered the workflow. - # Set fetch-depth: 0 to fetch all history for all branches and tags. - fetch-depth: 0 # Needed for setuptools_scm to work correctly - - uses: astral-sh/ruff-action@v3 - - run: ruff check --output-format=github . diff --git a/.github/workflows/mypy.yml b/.github/workflows/mypy.yml deleted file mode 100644 index 6c5a047e..00000000 --- a/.github/workflows/mypy.yml +++ /dev/null @@ -1,26 +0,0 @@ -# For documentation on GitHub Actions Workflows, see: -# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions -name: MyPy - -on: [push, pull_request] - -permissions: - contents: read - -jobs: - mypy: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 # https://github.com/actions/checkout - with: - # Only a single commit is fetched by default, for the ref/SHA that triggered the workflow. - # Set fetch-depth: 0 to fetch all history for all branches and tags. - fetch-depth: 0 # Needed for setuptools_scm to work correctly - - name: Install uv and set the python version - uses: astral-sh/setup-uv@v6 - with: - python-version: 3.13 - - name: Install the project - run: uv sync --group validate - - name: Run mypy static type checker - run: uv run mypy . diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml new file mode 100644 index 00000000..45598763 --- /dev/null +++ b/.github/workflows/quality.yml @@ -0,0 +1,33 @@ +# For documentation on GitHub Actions Workflows, see: +# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions +name: Quality +on: + pull_request: + types: [opened, synchronize, reopened] + push: + branches: [master] + +permissions: + contents: read + +jobs: + quality: + runs-on: ubuntu-latest + steps: + - name: Check out + uses: actions/checkout@v4 + with: + fetch-depth: 0 # Needed for setuptools_scm to work correctly + + - uses: actions/cache@v4 + with: + path: ~/.cache/pre-commit + key: pre-commit-${{ hashFiles('.pre-commit-config.yaml') }} + - name: Install uv and set the python version + uses: astral-sh/setup-uv@v6 + with: + python-version: "3.13" + - name: Install the project + run: uv sync --group quality + - name: Run pre-commit + run: uv run pre-commit run -a --show-diff-on-failure diff --git a/.github/workflows/build.yml b/.github/workflows/tests.yml similarity index 70% rename from .github/workflows/build.yml rename to .github/workflows/tests.yml index c984140d..1b6197f5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/tests.yml @@ -1,22 +1,28 @@ # For documentation on GitHub Actions Workflows, see: # https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions -name: "build" - -on: [push, pull_request] +name: Tests +on: + pull_request: + types: [opened, synchronize, reopened] + push: + branches: [master] jobs: - build: + tests: strategy: - fail-fast: false matrix: os: [ubuntu-latest, macos-latest, windows-latest] python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14-dev"] + fail-fast: false + runs-on: ${{ matrix.os }} + defaults: + run: + shell: bash steps: - - uses: actions/checkout@v4 # https://github.com/actions/checkout + - name: Check out + uses: actions/checkout@v4 with: - # Only a single commit is fetched by default, for the ref/SHA that triggered the workflow. - # Set fetch-depth: 0 to fetch all history for all branches and tags. fetch-depth: 0 # Needed for setuptools_scm to work correctly - name: Install uv uses: astral-sh/setup-uv@v6 @@ -26,7 +32,6 @@ jobs: with: python-version: ${{ matrix.python-version }} allow-prereleases: true - - name: Install the project run: uv sync --all-extras --dev @@ -35,3 +40,7 @@ jobs: - name: Run isolated tests run: uv run inv pytest --junit --no-pty --isolated + + - name: Upload coverage reports to Codecov with GitHub Action on Python 3.13 for each OS + uses: codecov/codecov-action@v3 + if: ${{ matrix.python-version == '3.13' }} diff --git a/.github/workflows/typecheck.yml b/.github/workflows/typecheck.yml new file mode 100644 index 00000000..c4448d26 --- /dev/null +++ b/.github/workflows/typecheck.yml @@ -0,0 +1,35 @@ +# For documentation on GitHub Actions Workflows, see: +# https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions +name: TypeCheck +on: + pull_request: + types: [opened, synchronize, reopened] + push: + branches: [master] + +permissions: + contents: read + +jobs: + type-check: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] + fail-fast: false + defaults: + run: + shell: bash + steps: + - name: Check out + uses: actions/checkout@v4 + with: + fetch-depth: 0 # Needed for setuptools_scm to work correctly + + - name: Install uv and set the python version + uses: astral-sh/setup-uv@v6 + with: + python-version: ${{ matrix.python-version }} + + - name: Check typing + run: uv run mypy . diff --git a/pyproject.toml b/pyproject.toml index 75476f39..0b7e69c4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -65,6 +65,7 @@ docs = [ "setuptools_scm>=8", ] plugins = ["cmd2-ext-test"] +quality = ["pre-commit>=2.20.0"] test = [ "codecov>=2", "coverage>=7",